-
Notifications
You must be signed in to change notification settings - Fork 508
EKF: Consolidate range finder checking #477
Conversation
This brings all the range finder data checks (excluding innovation consistency checks) into one place and eliminates the need to perform range checking external to the library. The hard coded optical flow tilt limit is changed to use the same value as the range finder. Variable names are changed to make a clear distinction between the max/min values calculated by the stuck range check and the max/min valid values for the sensor.
Reversion test using replay data: https://logs.px4.io/plot_app?log=a56f0800-6944-4f46-8171-4a7fab048923 |
@@ -282,7 +282,7 @@ struct parameters { | |||
float max_vel_for_range_aid{1.0f}; ///< maximum ground velocity for which we allow to use the range finder as height source (if range_aid == 1) | |||
int32_t range_aid{0}; ///< allow switching primary height source to range finder if certian conditions are met | |||
float range_aid_innov_gate{1.0f}; ///< gate size used for innovation consistency checks for range aid fusion | |||
float range_cos_max_tilt{0.7071f}; ///< cosine of the maximum tilt angle from the vertical that permits use of range finder data | |||
float range_cos_max_tilt{0.7071f}; ///< cosine of the maximum tilt angle from the vertical that permits use of range finder and flow data |
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.
It would be good to mention explicitly the value of this angle.
if (_rng_check_min_val < 0.1f || _range_sample_delayed.rng < _rng_check_min_val) { | ||
_rng_check_min_val = _range_sample_delayed.rng; | ||
if (_rng_stuck_min_val < 0.1f || _range_sample_delayed.rng < _rng_stuck_min_val) { | ||
_rng_stuck_min_val = _range_sample_delayed.rng; |
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.
Off topic for this PR, but I would prefer if the stuck range checks eventually got pulled out of the ecl EKF and into the specific driver of the device which exhibits this failure mode. Generally I am not aware of any recent Lidar sensor which still exhibits this issue.
This could be a part of the cleanup for PX4/PX4-Autopilot#9861.
@@ -598,7 +598,7 @@ class Ekf : public EstimatorInterface | |||
void rangeAidConditionsMet(); | |||
|
|||
// check for "stuck" range finder measurements when rng was not valid for certain period |
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.
Comment is outdated.
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.
Minor nitpicks about comments, otherwise good to go!
DESCRIPTION
This brings all the range finder data checks (excluding innovation consistency checks) into one place and eliminates the need to perform range checking external to the library. Having checks in multiple places has previously resulted in unintended loss of functionality over time which had to be fixed by #476. This PR should reduce the likelihood of this type of bug being introduced in the future.
The hard coded optical flow tilt limit has also been changed to use the same value as the range finder for consistency.
Variable names have been changed changed to make a clear distinction between the max/min values calculated by by the stuck range check and the max/min valid values published by the sensor.
TESTING
For full test coverage we would need to check: