PX4-ECL icon indicating copy to clipboard operation
PX4-ECL copied to clipboard

sympy generated code vs final code

Open tianzhuqiao opened this issue 1 year ago • 1 comments

Thanks for the great project. I am reading the doc and code; and for some fusion, I am not sure how we use the generated code (from python sympy) in the final code. For example,

this is the generated code for gps yaw fusion https://github.com/PX4/PX4-ECL/blob/b3fed06fe822d08d19ab1d2c2f8daf7b7d21951c/EKF/python/ekf_derivation/generated/gps_yaw_generated.cpp#L2

and this is the final code https://github.com/PX4/PX4-ECL/blob/b3fed06fe822d08d19ab1d2c2f8daf7b7d21951c/EKF/gps_yaw_fusion.cpp#L77

Looks like they doesn't match with each other. Do I miss something? Or do we update the model (either in sympy or in the final code)? Thanks!

tianzhuqiao avatar Sep 27 '23 15:09 tianzhuqiao

Hi @tianzhuqiao , this repo is not updated anymore, we moved everything to PX4 directly. We also migrated the derivation to SymForce, this allows to change the derivation in python, re-generate the code in a couple of seconds and test immediately without having to copy-paste anything.

Here is the new derivation: https://github.com/PX4/PX4-Autopilot/blob/8ea04b0f8fd896c73f0fd47e92957072f31d46f1/src/modules/ekf2/EKF/python/ekf_derivation/derivation.py#L392-L414

Here is for example the auto-generated code for the GNSS yaw fusion: https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/ekf2/EKF/python/ekf_derivation/generated/compute_gnss_yaw_pred_innov_var_and_h.h

And here is where the generated function is used: https://github.com/PX4/PX4-Autopilot/blob/8ea04b0f8fd896c73f0fd47e92957072f31d46f1/src/modules/ekf2/EKF/gps_yaw_fusion.cpp#L100 No more mix of auto-generated code in the cpp files.

bresch avatar Sep 28 '23 09:09 bresch