Skip to content

Commit 7dc9ca8

Browse files
committed
land_detector: multicopter ground contact only use vz setpoint if finite
1 parent b2b02d7 commit 7dc9ca8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/modules/land_detector/MulticopterLandDetector.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,15 @@ bool MulticopterLandDetector::_get_ground_contact_state()
189189

190190
// if we have a valid velocity setpoint and the vehicle is demanded to go down but no vertical movement present,
191191
// we then can assume that the vehicle hit ground
192-
_in_descend = _is_climb_rate_enabled() && (_vehicle_local_position_setpoint.vz >= land_speed_threshold);
192+
if (_is_climb_rate_enabled()) {
193+
if (PX4_ISFINITE(_vehicle_local_position_setpoint.vz)) {
194+
_in_descend = (_vehicle_local_position_setpoint.vz >= land_speed_threshold);
195+
}
196+
197+
} else {
198+
_in_descend = false;
199+
}
200+
193201
bool hit_ground = _in_descend && !vertical_movement;
194202

195203
bool ground_contact = false;

0 commit comments

Comments
 (0)