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: Vector24f -> VectorState #22105

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Ekf2: Vector24f -> VectorState #22105

merged 2 commits into from
Sep 21, 2023

Conversation

bresch
Copy link
Member

@bresch bresch commented Sep 20, 2023

Solved Problem

State vector type contains the number of elements in its name, this would cause to rename everything is its size changes.

Solution

rename
Vector24f -> VectorState
SquareMatrix24f -> SquareMatrixState
SparseMatrix24f -> SparseMatrixState

Additional changes: used auto-generated State constants instead of more hardcoded indexes
Note: missing is still the airspeed reset

Test coverage

unit tests

Then the state vector size can be changes without having to update the
name
@bresch bresch added the EKF2 label Sep 20, 2023
@bresch bresch requested a review from dagar September 20, 2023 12:21
@bresch bresch self-assigned this Sep 20, 2023
@@ -148,8 +148,8 @@ void Ekf::fuseOptFlow()
}
}

SparseVector24f<0,1,2,3,4,5,6> Hfusion(H);
Vector24f Kfusion = P * Hfusion / _aid_src_optical_flow.innovation_variance[index];
SparseVectorState<0,1,2,3,4,5,6> Hfusion(H);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dagar The sparse vector optimization is still in the way if we want to be able to swap state blocks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do SparseVectorState<State::quat_nominal.idx, State::quat_nominal.idx + 1, ... but it isn't so nice as it wouldn't leverage the .dof of each state.
Would you know how to do it nicely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you know how to do it nicely?

Not off the top of my head, but given there are only a few SparseVectors I'd be tempted to do a quick check to see how much they really save, and perhaps even do a size/speed comparison with symforce. There might be a worthwhile tradeoff for the very sparse observation matrices?

@dagar dagar merged commit 9e962f3 into main Sep 21, 2023
87 checks passed
@dagar dagar deleted the pr-ekf2-vectorstate branch September 21, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants