Hello, I am working on retrieving the gimbal’s roll, pitch, and yaw angles for my project. My goal is to obtain these angles using MAVLink messages and properly handle the received data.
i tried with MOUNT_ORIENTATION but no output received.
Any guidance or steps to achieve this would be greatly appreciated!
Try to to request the MOUNT_ORIENTATION message using MAV_CMD_REQUEST_MESSAGE first, because some mavlink messages are not streamed by default until you request them.
Here an example using pymavlink:
def request_mount_orientation():
master.mav.command_long_send(
master.target_system, # Target system (vehicle)
master.target_component, # Target component (gimbal or autopilot)
mavutil.mavlink.MAV_CMD_REQUEST_MESSAGE, # Command to request a specific message
0, # Confirmation (0 = first transmission)
mavutil.mavlink.MAVLINK_MSG_ID_MOUNT_ORIENTATION, # ID of the MOUNT_ORIENTATION message (265)
0, 0, 0, 0, 0, 0 # Unused parameters
)
You can try requesting the GIMBAL_DEVICE_ATTITUDE_STATUS (285) message, which will provide the quaternion components q (w, x, y, z). These components can then be converted to Euler angles.