-
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
FW LandDetector: disregard horizontal velocity if local_position.v_xy_valid is false #24133
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,9 +71,18 @@ bool FixedwingLandDetector::_get_landed_state() | |
|
||
} else if (hrt_elapsed_time(&_vehicle_local_position.timestamp) < 1_s) { | ||
|
||
// Horizontal velocity complimentary filter. | ||
float val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicle_local_position.vx * _vehicle_local_position.vx + | ||
_vehicle_local_position.vy * _vehicle_local_position.vy); | ||
float val; | ||
|
||
if (!_vehicle_local_position.v_xy_valid) { | ||
// set _velocity_xy_filtered to 0 if data is invalid | ||
val = 0.0f; | ||
|
||
} else { | ||
// Horizontal velocity complimentary filter. | ||
val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicle_local_position.vx * _vehicle_local_position.vx + | ||
_vehicle_local_position.vy * _vehicle_local_position.vy); | ||
} | ||
|
||
|
||
if (PX4_ISFINITE(val)) { | ||
_velocity_xy_filtered = val; | ||
|
@@ -105,6 +114,14 @@ bool FixedwingLandDetector::_get_landed_state() | |
const float acc_hor = matrix::Vector2f(_acceleration).norm(); | ||
_xy_accel_filtered = _xy_accel_filtered * 0.8f + acc_hor * 0.18f; | ||
|
||
// Check for angular velocity (disregard yaw) | ||
float max_rotation_threshold = math::radians(_param_lndfw_rot_max.get()); | ||
val = _angular_velocity.xy().norm(); // TODO: check if this should be low pass filtered | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in MC landing detector the angular velocity is not filtered. Unsure if it might be necessary for FW - I don't know how noisy the data usually is in comparison. |
||
|
||
if (PX4_ISFINITE(val)) { | ||
_velocity_rotational = val; | ||
} | ||
|
||
// make groundspeed threshold tighter if airspeed is invalid | ||
const float vel_xy_max_threshold = airspeed_invalid ? 0.7f * _param_lndfw_vel_xy_max.get() : | ||
_param_lndfw_vel_xy_max.get(); | ||
|
@@ -113,7 +130,8 @@ bool FixedwingLandDetector::_get_landed_state() | |
landDetected = _airspeed_filtered < _param_lndfw_airspd.get() | ||
&& _velocity_xy_filtered < vel_xy_max_threshold | ||
&& _velocity_z_filtered < _param_lndfw_vel_z_max.get() | ||
&& _xy_accel_filtered < _param_lndfw_xyaccel_max.get(); | ||
&& _xy_accel_filtered < _param_lndfw_xyaccel_max.get() | ||
&& _velocity_rotational < max_rotation_threshold; | ||
|
||
} else { | ||
// Control state topic has timed out and we need to assume we're landed. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,14 @@ PARAM_DEFINE_FLOAT(LNDFW_AIRSPD_MAX, 6.00f); | |
* @group Land Detector | ||
*/ | ||
PARAM_DEFINE_FLOAT(LNDFW_TRIG_TIME, 2.f); | ||
|
||
/** | ||
* Fixed-wing land detector: max rotation | ||
* | ||
* Maximum allowed angular velocity around each axis allowed in the landed state. | ||
* | ||
* @unit deg/s | ||
* @decimal 1 | ||
* @group Land Detector | ||
*/ | ||
PARAM_DEFINE_FLOAT(LNDFW_ROT_MAX, 5.0f); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made up this default value - needs to be verified/adjusted. |
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.
We may need to add some logic that makes the acceleration threshold tighter if we don't have ground speed and airspeed. Similar to what we already do for the ground speed check if there is no airspeed.
Otherwise it gets dangerous to fly planes without GPS and without airspeed sensor, as then they could detect "landing" in-air if flies very smoothly.