From 3ec4ef65e1d9e3b30fc3d668c18313154f579fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 17 Jul 2024 16:28:05 -0300 Subject: [PATCH] build: patches: Add improve_support_gimbal_device_attitude_status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- ...upport_gimbal_device_attitude_status.patch | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 build/patches/improve_support_gimbal_device_attitude_status.patch diff --git a/build/patches/improve_support_gimbal_device_attitude_status.patch b/build/patches/improve_support_gimbal_device_attitude_status.patch new file mode 100644 index 0000000000..467bbfaae8 --- /dev/null +++ b/build/patches/improve_support_gimbal_device_attitude_status.patch @@ -0,0 +1,120 @@ +diff --git a/message_definitions/v1.0/common.xml b/message_definitions/v1.0/common.xml +index 1ccad646..6029e80e 100644 +--- a/message_definitions/v1.0/common.xml ++++ b/message_definitions/v1.0/common.xml +@@ -1119,19 +1119,37 @@ + + Flags for gimbal device (lower level) operation. + +- Set to retracted safe position (no stabilization), takes presedence over all other flags. ++ Set to retracted safe position (no stabilization), takes precedence over all other flags. + + +- Set to neutral position (horizontal, forward looking, with stabiliziation), takes presedence over all other flags except RETRACT. ++ Set to neutral/default position, taking precedence over all other flags except RETRACT. Neutral is commonly forward-facing and horizontal (roll=pitch=yaw=0) but may be any orientation. + + +- Lock roll angle to absolute angle relative to horizon (not relative to drone). This is generally the default with a stabilizing gimbal. ++ Lock roll angle to absolute angle relative to horizon (not relative to vehicle). This is generally the default with a stabilizing gimbal. + + +- Lock pitch angle to absolute angle relative to horizon (not relative to drone). This is generally the default. ++ Lock pitch angle to absolute angle relative to horizon (not relative to vehicle). This is generally the default with a stabilizing gimbal. ++ ++ ++ Lock yaw angle to absolute angle relative to North (not relative to vehicle). If this flag is set, the yaw angle and z component of angular velocity are relative to North (earth frame, x-axis pointing North), else they are relative to the vehicle heading (vehicle frame, earth frame rotated so that the x-axis is pointing forward). + + +- Lock yaw angle to absolute angle relative to North (not relative to drone). If this flag is set, the quaternion is in the Earth frame with the x-axis pointing North (yaw absolute). If this flag is not set, the quaternion frame is in the Earth frame rotated so that the x-axis is pointing forward (yaw relative to vehicle). ++ Lock yaw angle to absolute angle relative to North (not relative to vehicle). If this flag is set, the yaw angle and z component of angular velocity are relative to North (earth frame, x-axis pointing North), else they are relative to the vehicle heading (vehicle frame, earth frame rotated so that the x-axis is pointing forward). ++ ++ ++ Yaw angle and z component of angular velocity are relative to the vehicle heading (vehicle frame, earth frame rotated such that the x-axis is pointing forward). ++ ++ ++ Yaw angle and z component of angular velocity are relative to North (earth frame, x-axis is pointing North). ++ ++ ++ Gimbal device can accept yaw angle inputs relative to North (earth frame). This flag is only for reporting (attempts to set this flag are ignored). ++ ++ ++ The gimbal orientation is set exclusively by the RC signals feed to the gimbal's radio control inputs. MAVLink messages for setting the gimbal orientation (GIMBAL_DEVICE_SET_ATTITUDE) are ignored. ++ ++ ++ The gimbal orientation is determined by combining/mixing the RC signals feed to the gimbal's radio control inputs and the MAVLink messages for setting the gimbal orientation (GIMBAL_DEVICE_SET_ATTITUDE). How these two controls are combined or mixed is not defined by the protocol but is up to the implementation. + + + +@@ -1182,7 +1200,7 @@ + There is an error with the gimbal power source. + + +- There is an error with the gimbal motor's. ++ There is an error with the gimbal motors. + + + There is an error with the gimbal's software. +@@ -1190,6 +1208,12 @@ + + There is an error with the gimbal's communication. + ++ ++ Gimbal device is currently calibrating. ++ ++ ++ Gimbal device is not assigned to a gimbal manager. ++ + + + +@@ -6471,25 +6495,41 @@ + Low level message to control a gimbal device's attitude. This message is to be sent from the gimbal manager to the gimbal device component. Angles and rates can be set to NaN according to use case. + System ID + Component ID +- Low level gimbal flags. ++ Low level gimbal flags. + Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, set all fields to NaN if only angular velocity should be used) + X component of angular velocity, positive is banking to the right, NaN to be ignored. + Y component of angular velocity, positive is tilting up, NaN to be ignored. + Z component of angular velocity, positive is panning to the right, NaN to be ignored. + + +- +- +- Message reporting the status of a gimbal device. This message should be broadcasted by a gimbal device component. The angles encoded in the quaternion are in the global frame (roll: positive is tilt to the right, pitch: positive is tilting up, yaw is turn to the right). This message should be broadcast at a low regular rate (e.g. 10Hz). ++ Message reporting the status of a gimbal device. ++ This message should be broadcast by a gimbal device component at a low regular rate (e.g. 5 Hz). ++ For the angles encoded in the quaternion and the angular velocities holds: ++ If the flag GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME is set, then they are relative to the vehicle heading (vehicle frame). ++ If the flag GIMBAL_DEVICE_FLAGS_YAW_IN_EARTH_FRAME is set, then they are relative to absolute North (earth frame). ++ If neither of these flags are set, then (for backwards compatibility) it holds: ++ If the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set, then they are relative to absolute North (earth frame), ++ else they are relative to the vehicle heading (vehicle frame). ++ Other conditions of the flags are not allowed. ++ The quaternion and angular velocities in the other frame can be calculated from delta_yaw and delta_yaw_velocity as ++ q_earth = q_delta_yaw * q_vehicle and w_earth = w_delta_yaw_velocity + w_vehicle (if not NaN). ++ If neither the GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME nor the GIMBAL_DEVICE_FLAGS_YAW_IN_EARTH_FRAME flag is set, ++ then (for backwards compatibility) the data in the delta_yaw and delta_yaw_velocity fields are to be ignored. ++ New implementations should always set either GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME or GIMBAL_DEVICE_FLAGS_YAW_IN_EARTH_FRAME, ++ and always should set delta_yaw and delta_yaw_velocity either to the proper value or NaN. + System ID + Component ID + Timestamp (time since system boot). + Current gimbal flags set. +- Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation, the frame is depends on whether the flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set) +- X component of angular velocity (NaN if unknown) +- Y component of angular velocity (NaN if unknown) +- Z component of angular velocity (NaN if unknown) +- Failure flags (0 for no failure) ++ Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description. ++ X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown. ++ Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown. ++ Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown. ++ Failure flags (0 for no failure) ++ ++ Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown. ++ Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown. ++ This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0. + + +