Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EKF2: remove sparse vector optimization #22164

Merged
merged 1 commit into from
Oct 2, 2023
Merged

EKF2: remove sparse vector optimization #22164

merged 1 commit into from
Oct 2, 2023

Conversation

bresch
Copy link
Member

@bresch bresch commented Oct 2, 2023

Solved Problem

The sparse vector template requires to know which states are non-zero in the observation jacobian. This complicates the modularity of the code when the state vector or the derivation is changed. The risk of forgetting to update the list of non-zero states is also high and since it's only used for a couple of matrix-vector multiplications, the reduced CPU load is very minimal (on fmu-v5, removing the optimization on the mag 3D fusion doesn't show any change in CPU usage).

Solution

Use dense vectors. The computation cost difference is almost negligible for this size.

Changelog Entry

For release notes:

-
New parameter: -
Documentation: -

Alternatives

I tried to directly compute the Kalman gain in the SymForce derivation. This could make the code faster but increases flash space. Since we're short on flash space but not on CPU usage, this option was rejected.

Test coverage

Unit tests

The sparse vector template requires to know which states are non-zero in
the observation jacobian. This complicates the modularity of the code
when the state vector or the derivation is changed.
The computation cost difference is almost negligible for this size.
@bresch bresch added the EKF2 label Oct 2, 2023
@bresch bresch requested a review from dagar October 2, 2023 07:04
@bresch bresch self-assigned this Oct 2, 2023
@dagar dagar merged commit 10db6b6 into main Oct 2, 2023
87 checks passed
@dagar dagar deleted the pr-ekf2-sparse branch October 2, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants