From 7a538d55d1ddabb6a68676eba7893adae786db12 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Sun, 9 Aug 2026 13:27:34 +1200 Subject: [PATCH] fix(gimbal): set angular_velocity to NaN for test angle command The test input's angle branch set only the quaternion, leaving angular_velocity at its stale (zero) value. A downstream that prioritizes rate over angle - e.g. the SITL gz gimbal, which holds position on a finite near-zero rate - then ignores the commanded angle, so 'gimbal test pitch X' did not move the gimbal. Set the rates to NaN for angle commands, matching InputRC's angle mode. Signed-off-by: Julian Oes --- src/modules/gimbal/input_test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/gimbal/input_test.cpp b/src/modules/gimbal/input_test.cpp index 67dc9525125..8a5fedcb02e 100644 --- a/src/modules/gimbal/input_test.cpp +++ b/src/modules/gimbal/input_test.cpp @@ -66,6 +66,13 @@ InputTest::UpdateResult InputTest::update(unsigned int timeout_ms, ControlData & matrix::Quatf q(euler); q.copyTo(control_data.type_data.angle.q); + // Angle command: no rate. Must be set explicitly, otherwise a stale + // angular_velocity is forwarded and a downstream that prioritizes rate + // (e.g. a device holding position on zero rate) ignores the angle. + control_data.type_data.angle.angular_velocity[0] = NAN; + control_data.type_data.angle.angular_velocity[1] = NAN; + control_data.type_data.angle.angular_velocity[2] = NAN; + } else { control_data.type_data.angle.frames[0] = ControlData::TypeData::TypeAngle::Frame::AngularRate; control_data.type_data.angle.frames[1] = ControlData::TypeData::TypeAngle::Frame::AngularRate;