mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(mavlink): reject SET_ATTITUDE_TARGET with a non-finite thrust (#29328)
A NaN thrust setpoint means "stop the motors on that axis" to the control allocator. SET_ATTITUDE_TARGET validated the attitude but passed thrust through unchecked, so a companion sending a NaN thrust stopped all lift motors of a multicopter in Offboard, while the message kept the offboard heartbeat alive so the offboard loss failsafe never triggered. Drop the whole message, as is already done for an unusable attitude. Tested in SIH: streaming SET_ATTITUDE_TARGET with a NaN thrust in Offboard no longer produces a non-finite vehicle_thrust_setpoint; the offboard loss failsafe takes over and the vehicle holds altitude.
This commit is contained in:
1 parent
eea568dcda
commit
6d2620a418
1 file changed
+7
@@ -1887,6 +1887,13 @@ MavlinkReceiver::handle_message_set_attitude_target(mavlink_message_t *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
// A non-finite thrust setpoint stops the motors on that axis (see VehicleThrustSetpoint.msg), so drop the
|
||||
// whole message for the same reason as an unusable attitude.
|
||||
if ((thrust_body && !matrix::Vector3f(attitude_target.thrust_body).isAllFinite())
|
||||
|| (!thrust_body && thrust && !PX4_ISFINITE(attitude_target.thrust))) {
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle_status_s vehicle_status{};
|
||||
_vehicle_status_sub.copy(&vehicle_status);
|
||||
|
||||
|
||||
Reference in new issue
Block a user