-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
New filter for distance sensor validation #24106
base: main
Are you sure you want to change the base?
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 768 byte (0.04 %)]
px4_fmu-v6x [Total VM Diff: 760 byte (0.04 %)]
Updated: 2024-12-20T13:03:26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if using sequential fusion would actually give nicer code in the end so you wouldn't need to build all those 2x2 matrices
src/modules/ekf2/EKF/aid_sources/range_finder/range_finder_consistency_check.cpp
Outdated
Show resolved
Hide resolved
src/modules/ekf2/EKF/aid_sources/range_finder/range_finder_consistency_check.cpp
Outdated
Show resolved
Hide resolved
src/modules/ekf2/EKF/aid_sources/range_finder/range_finder_consistency_check.hpp
Outdated
Show resolved
Hide resolved
src/modules/ekf2/EKF/aid_sources/range_finder/range_finder_consistency_check.cpp
Outdated
Show resolved
Hide resolved
499efdc
to
f7052d6
Compare
f7052d6
to
11655eb
Compare
11655eb
to
9f42b6e
Compare
if (horizontal_motion) { | ||
_time_last_horizontal_motion = time_us; | ||
} | ||
float p[4] = {z_var, 0.f, 0.f, z_var + dist_bottom_var}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to initialize the covariance elements as height and terrain states are correlated:
https://colab.research.google.com/drive/11gIyOub-rub4uL7mZHH1gGICL3fTTEyH?usp=sharing
[h_var, h_var ]
[h_var, d_var + h_var]
_time_last_horizontal_motion = time_us; | ||
} | ||
float p[4] = {z_var, 0.f, 0.f, z_var + dist_bottom_var}; | ||
_P = Matrix<float, RangeFilter::size, RangeFilter::size>(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_P = Matrix<float, RangeFilter::size, RangeFilter::size>(p); | |
_P = SquareMatrix<float, RangeFilter::size>(p); |
} | ||
float p[4] = {z_var, 0.f, 0.f, z_var + dist_bottom_var}; | ||
_P = Matrix<float, RangeFilter::size, RangeFilter::size>(p); | ||
sym::RangeValidationFilter(&_H); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you set the output to be None in symforce it will create a function that returns H instead of having to pass it via a pointer (
generate_px4_function(compute_airspeed_h, output_names=None) |
_x(RangeFilter::z.idx) = z; | ||
_x(RangeFilter::terrain.idx) = z - dist_bottom; | ||
_initialized = true; | ||
_state = _test_ratio_lpf.getState() < 1.f ? KinematicState::UNKNOWN : KinematicState::INCONSISTENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need to have that in the init function? That's anyway only called when there was no sensor data for a long time, right? Then you could just set it to UNKNOWN
Solved Problem
The distance sensor is being fused or used to reset the terrain state, even though its measurements do not accurately represent the distance to the ground due to obstructions caused by rain, snow, fog etc.
Solution
Now the distance sensor can be in 3 different states based on the lpf test ratio of a simple kalman filter:
consistent
,inconsistent
andunknown
. A terrain reset can only happen when the state is consistent. The sensor will be used for normal fusion in both consistent and inconsistent states. Together with the already existing fog detector, the robustness against sensor blockage/failure is increased.new:
old: