Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

EKF: Consolidate range finder checking #477

Merged
merged 1 commit into from
Jul 12, 2018
Merged

Conversation

priseborough
Copy link
Collaborator

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:

  • Data below min valid (on ground and in air)
  • Data above min valid (on ground and in air)
  • Data returning to valid range after > 10 seconds out of range and sticking at a constant value (on ground and in air)
  • Vehicle tilted > 45 deg

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.
@priseborough
Copy link
Collaborator Author

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
Copy link
Member

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;
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

Comment is outdated.

Copy link
Member

@mhkabir mhkabir left a 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!

@LorenzMeier LorenzMeier merged commit 4d59c83 into master Jul 12, 2018
@LorenzMeier LorenzMeier deleted the pr-ekfRangeChecks branch July 12, 2018 16:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants