gimbal: handle NaN pitch/yaw in DO_GIMBAL_MANAGER_PITCHYAW (#27206)

NaN signals "unset" per the MAVLink spec. Without a guard,
math::radians(NaN) propagates through the Eulerf-to-Quatf conversion
and produces q=[nan,nan,nan,nan], freezing the gimbal. Substitute 0
for any non-finite axis with PX4_ISFINITE, matching the manual-control
pattern at input_mavlink.cpp:951.

Closes #26640.
This commit is contained in:
G. Amponis authored and GitHub committed 2026-05-04 09:45:54 +12:00
1 parent f63b0d6b6f
commit ef1853eec9
1 file changed
+4 -2
+4 -2
View File
@@ -910,8 +910,10 @@ InputMavlinkGimbalV2::_process_command(ControlData &control_data, const vehicle_
if (vehicle_command.source_system == control_data.sysid_primary_control &&
vehicle_command.source_component == control_data.compid_primary_control) {
const matrix::Eulerf euler(0.0f, math::radians(vehicle_command.param1),
math::radians(vehicle_command.param2));
const matrix::Eulerf euler(
0.0f,
PX4_ISFINITE(vehicle_command.param1) ? math::radians(vehicle_command.param1) : 0.0f,
PX4_ISFINITE(vehicle_command.param2) ? math::radians(vehicle_command.param2) : 0.0f);
const matrix::Quatf q(euler);
const matrix::Vector3f angular_velocity(NAN, math::radians(vehicle_command.param3),
math::radians(vehicle_command.param4));