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: check mag field with mag bias removed #23584

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dagar
Copy link
Member

@dagar dagar commented Aug 20, 2024

  • this is to allow the estimated mag bias to clear mag_field_disturbed and unlock mag_3D/mag_hdg

Opening for review, discussion, testing.

@dagar dagar added the EKF2 label Aug 20, 2024
@dagar dagar requested a review from bresch August 20, 2024 17:00
@@ -131,7 +131,7 @@ void Ekf::controlMagFusion(const imuSample &imu_sample)
&& mag_sample.mag.isAllFinite();

const bool starting_conditions_passing = continuing_conditions_passing
&& checkMagField(mag_sample.mag)
&& checkMagField(mag_sample.mag - _state.mag_B)
Copy link
Member

Choose a reason for hiding this comment

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

Should we then rather have the checkMagField in common_conditions_passing ? Otherwise the bias can't be learned if "mag" fusion doesn't start.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, doesn't make sense otherwise. Thanks

@dagar dagar force-pushed the pr-ekf2_check_mag_field_with_bias branch from 00ef505 to 8dc84c7 Compare August 27, 2024 15:16
@dagar dagar marked this pull request as ready for review August 27, 2024 15:19
@dagar dagar changed the title [WIP] ekf2: check mag field with mag bias removed ekf2: check mag field with mag bias removed Aug 27, 2024
@dagar
Copy link
Member Author

dagar commented Aug 27, 2024

@bresch are you using the _mag_strength and _mag_inclination logging and if so do you want it to be from the raw mag_sample or bias corrected?

_mag_inclination = asinf(mag_earth(2) / fmaxf(mag_earth.norm(), 1e-4f));

If it matters I'll split up checkMagField(), probably make it a pure function, and then set the rest of these logging and status fields separately.

@dagar dagar force-pushed the pr-ekf2_check_mag_field_with_bias branch from 8dc84c7 to 490eb7e Compare August 27, 2024 16:38
 - this is to allow the estimated mag bias to clear mag_field_disturbed
   and unlock mag_3D/mag_hdg
@dagar dagar force-pushed the pr-ekf2_check_mag_field_with_bias branch from 490eb7e to 4a646e8 Compare August 27, 2024 16:47
@bresch
Copy link
Member

bresch commented Aug 28, 2024

are you using the _mag_strength and _mag_inclination logging and if so do you want it to be from the raw mag_sample or bias corrected?

Yes, I find it really useful to quickly check if there is an issue with the mag. Since we'll do the checks on the bias-corrected data with this PR, I think it makes sense to also log the bias-corrected inclination and strength (as they can be used to tune the thresholds).

@dagar dagar marked this pull request as draft September 13, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants