-
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
Add max_altitude and _vehicle_attitude.timestamp validity checks to MulticopterLandDetector and standardize var naming #12681
Conversation
@@ -131,42 +131,44 @@ bool MulticopterLandDetector::_get_ground_contact_state() | |||
return true; | |||
} | |||
|
|||
// land speed threshold | |||
float land_speed_threshold = 0.9f * math::max(_params.landSpeed, 0.1f); | |||
if (_vehicle_local_position.v_z_valid) { |
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.
What happens if this is not valid? (Tested?)
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 the z velocity is not valid it will never show a _state = LandDetectionState::GROUND_CONTACT;
state and the vehicle_land_detected_s
uORB topic will never show a true ground contacted state.
In studying the code to answer your question, for the ground contact state to be true, _vehicle_local_position.xy_valid
must also be true, (checked in the _has_position_lock()
, and this is also being checked in _has_altitude_lock()
so I think this change can be reverted. Thanks so much for pointing this out! I'll push up a commit that reverts this change.
@@ -42,22 +42,19 @@ | |||
|
|||
#pragma once | |||
|
|||
#include "LandDetector.h" | |||
#include <math.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.
Is this just for the INFINITY?
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.
Yes, that's correct.
b659346
to
66bcf6b
Compare
Tested on PixRacer V4: Position Mode: Good. - Procedure Notes: Log: Master comparison: Tested on CUAV V5+: Position Mode: Good. - Procedure Notes: Log: Master comparison: |
Thank you @jorge789 ! |
66bcf6b
to
5468d5a
Compare
Flight tested on a Tarot T960 hexa (~6kg takeoff weight), pixhawk 4 (fmu-v5), one short takeoff/land, one 28 minute flight, good land detection:
Additional flight testing on a 250 quad racer, pixhawk 4 mini: |
@@ -251,6 +251,10 @@ float MulticopterLandDetector::_get_max_altitude() | |||
/* TODO: add a meaningful altitude */ | |||
float valid_altitude_max = _param_lndmc_alt_max.get(); | |||
|
|||
if (valid_altitude_max < 0.0f) { | |||
return INFINITY; |
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.
Does this cause vehicle_land_detected
to be published constantly (~ 50 Hz)? Check uorb top
.
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.
Hi @dagar, It doesn't appear to:
@mcsauder can you resolve the merge conflict? |
…Detector class. Rename local camelCase vars to snake_case and control_mode -> vehicle_control_mode to match typdef with established class convention.
65202ec
to
1131828
Compare
Rebased on current PX4:master and flight tested on a 250 quad, pixhawk 4 mini. Flight testing checks out fine, as previous: |
…MulticopterLandDetector class. (PX4#12681) * Rename local camelCase vars to snake_case and control_mode -> vehicle_control_mode to match typdef with established class convention.
… from MulticopterLandDetector::_get_maybe_landed_state(). (#13072) PR #12681 added a check to the MulticopterLandDetector::_get_maybe_landed_state() method for a valid vehicle_attitude.timstamp value to finish work in PR #9756. It was discovered that the addition of that check leaves it possible to fly in acro mode without a valid attitude and auto-disarm can engage, allowing the multicopter to fall out of the sky.
Describe problem solved by the proposed pull request
This PR adds validity checks to methods in the
MulticopterLandDetector
class:(already accomplished through_vehicle_local_position.v_z_valid
to_get_ground_contact_state()
_has_altitude_lock()
)valid_altitude_max
validity check to_get_max_altitude()
_vehicle_attitude.timestamp
check to_get_maybe_landed_state()
A few local vars are made snake_case to standardize against file convention and
control_mode
is renamed tovehicle_control_mode
to match its typdef and the established class convention.One unneeded
#include
is deleted fromLandDetector.h
and the#include
list alphabetized.Test data / coverage
Flight tested on a 250 quad with pixhawk 4 mini. Landing detection results are identical to PX4:master.
Additional context
These changes complete the
MulticopterLandDetector
logic changes introduced in #9756 . See also #11857 .Please let me know if you'd like anything about this PR changed. Thanks!
-Mark