Skip to content

[Bug] gz_x500_gimbal: gimbal_device_attitude_status reports large roll/yaw when commanding pitch = -90° #26599

@haojiahuo123

Description

@haojiahuo123

Describe the bug

Describe the bug
In Gazebo (gz) simulation make px4_sitl gz_x500_gimbal, when I command the gimbal to point straight down (pitch = -90°), the reported gimbal_device_attitude_status shows pitch close to -90° but also shows a large roll and yaw angle. This happens consistently across repeated tests.
This is problematic because users may rely on gimbal_device_attitude_status (or the printed Euler angles derived from it) to understand and control the gimbal attitude.

Expected behavior
gimbal_device_attitude_status.q should remain correct and consistent. If the PX4 console prints Euler angles derived from the quaternion, the printed angles should be chosen in a way that is continuous and not misleading near pitch = ±90° (e.g., avoid large roll/yaw jumps for essentially the same attitude).

Actual behavior
After sending pitch = -90°, the reported attitude is stable but includes large roll and yaw values:
TOPIC: gimbal_device_attitude_status
gimbal_device_attitude_status
timestamp: 737172000 (0.036000 seconds ago)

q: [-0.50009, -0.49912, 0.50071, -0.50009] **(Roll: -77.8 deg, Pitch: -89.9 deg, Yaw: 167.7 deg)**
failure_flags: 0
delta_yaw: 0.00000
delta_yaw_velocity: 0.00000
device_flags: 64 (0b100'0000)
target_system: 0
target_component: 0
gimbal_device_id: 0
received_from_mavlink: False
Image

Steps to reproduce

  1. Start SITL:
    make px4_sitl gz_x500_gimbal
  2. Configure gimbal for v2 control (default gimbal manager workflow).
  3. Use pymavlink to send gimbal manager commands. Send MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW with:
    pitch=-90 deg, yaw=0 deg
  4. Observe:
    listener gimbal_device_attitude_status

Flight Log / Additional Information

PX4 version: 1.17.0
PX4 git-branch: main
Gazebo version:Gazebo Sim, version 8.10.0
Operating System:Ubuntu 22.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions