pathfinder-for-autonomous-navigation / psim

Six DOF flight simulator and related GNC implementations.
MIT License
4 stars 6 forks source link

Fix Attitude Estimator Sun Vector Representation #289

Closed kylekrol closed 3 years ago

kylekrol commented 3 years ago

Fix Attitude Estimator Sun Vector Representation

Fixes #229.

Summary of changes

The attitude estimator was having difficulty in processing sun vectors when the expected measurement was nearly aligned with the body z axis. Given the filter used a spherical angle sun vector representation, some of the generated sigma points would have phi values nearly 180 degrees apart from one another (if a sigma point rotation tipped the expected sun vector measurement over top of the z axis). This caused the filter to have severe stability issues.

To remedy this, an extra transformation bringing the sun vector to the x axis is applied to all measurements. This ensures our noise representation is spherical coordinates doesn't exhibit large nonlinearities.

Testing

Plots were generated using the following command (note PRs through #288 are required for testing):

python -m psim -s 20000 -p fc/attitude,sensors/sun_sensors -ps 1 -c sensors/base,truth/base,truth/deployment -v AttitudeEstimatorTestGnc

Before the update:

broke_px broke_py broke_pz

After the update:

fix_px fix_py fix_pz