mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 09:33:36 +08:00
StickAccelerationXY: if invalid pos, do not give pos sp
This commit is contained in:
@@ -204,6 +204,14 @@ void StickAccelerationXY::lockPosition(const Vector3f &pos, const matrix::Vector
|
||||
const bool moving = _velocity_setpoint.norm_squared() > FLT_EPSILON;
|
||||
const bool position_locked = Vector2f(_position_setpoint).isAllFinite();
|
||||
|
||||
if (!pos.isAllFinite()) {
|
||||
// position is invalid. We may still enter here through a mode
|
||||
// requiring only relaxed local position. In this case, no
|
||||
// position locking can happen, so we give no position setpoint.
|
||||
_position_setpoint.setNaN();
|
||||
return;
|
||||
}
|
||||
|
||||
// lock position
|
||||
if (!moving && !position_locked) {
|
||||
_position_setpoint = pos.xy();
|
||||
|
||||
Reference in New Issue
Block a user