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

Robustify range finder kinematic consistency check #22117

Merged
merged 1 commit into from
Sep 22, 2023
Merged

Conversation

bresch
Copy link
Member

@bresch bresch commented Sep 21, 2023

Solved Problem

I've seen logs where the kinematic consistency is false on takeoff and remains unchanged during the whole flight because the vehicle is always moving horizontally. The underlying kinematic consistency check was passing and it is highly unlikely to have a false passing detection because of terrain height changes (the terrain usually only creates false alarms).

Solution

Even if there is some horizontal motion, a passing check should be accepted as the terrain can be flat. However, the vehicle must not be moving horizontally to invalidate the consistency as a change in terrain can make the kinematic check temporarily fail.

Changelog Entry

For release notes:

Robustify range finder kinematic consistency check
New parameter: -
Documentation: -

Test coverage

replay on https://logs.px4.io/plot_app?log=466e8bd1-6100-42eb-a518-41b4cfbde149

Context

Related links, screenshot before/after, video

Even if there is some horizontal motion, a passing check should be
accepted as the terrain can be flat. However, the vehicle must not be
moving horizontally to invalidate the consistency as a change in terrain
can make the kinematic check temporarily fail.
// Run the kinematic consistency check when not moving horizontally
if (_control_status.flags.in_air && !_control_status.flags.fixed_wing
&& (sq(_state.vel(0)) + sq(_state.vel(1)) < fmaxf(P.trace<2>(State::vel.idx), 0.1f))) {
if (_control_status.flags.in_air) {
Copy link
Member

Choose a reason for hiding this comment

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

What's the harm in letting this always run (!in_air)? The actual usage in the terrain estimator is still going to require in_air && rng_kin_consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

An issue I see is when the operator is powering the drone but is still manipulating it before takeoff. There is then a high chance to fail the consistency check for no real reason. It should then be validated again after takeoff, so in theory it's not a big problem, the terrain estimator will just start a bit later and the 5s of no terrain aiding timeout should be enough.

@@ -68,12 +72,20 @@ void RangeFinderConsistencyCheck::update(float dist_bottom, float dist_bottom_va

void RangeFinderConsistencyCheck::updateConsistency(float vz, uint64_t time_us)
{
if (fabsf(vz) < _min_vz_for_valid_consistency) {
// We can only check consistency if there is vertical motion
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't you want to still invalidate if there's horizontal motion?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we can validate regardless of the horizontal motion, but we can only invalidate if we're only moving vertically, otherwise a change in terrain height would invalidate too.

@dagar dagar merged commit db97a38 into main Sep 22, 2023
86 of 87 checks passed
@dagar dagar deleted the pr-ekf2-rng-kin branch September 22, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants