2
0

mavlink_msg_gimbal_device_attitude_status.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. #pragma once
  2. // MESSAGE GIMBAL_DEVICE_ATTITUDE_STATUS PACKING
  3. #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS 285
  4. typedef struct __mavlink_gimbal_device_attitude_status_t {
  5. uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
  6. float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.*/
  7. float angular_velocity_x; /*< [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.*/
  8. float angular_velocity_y; /*< [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.*/
  9. float angular_velocity_z; /*< [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.*/
  10. uint32_t failure_flags; /*< Failure flags (0 for no failure)*/
  11. uint16_t flags; /*< Current gimbal flags set.*/
  12. uint8_t target_system; /*< System ID*/
  13. uint8_t target_component; /*< Component ID*/
  14. float delta_yaw; /*< [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.*/
  15. float delta_yaw_velocity; /*< [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.*/
  16. uint8_t gimbal_device_id; /*< 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.*/
  17. } mavlink_gimbal_device_attitude_status_t;
  18. #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN 49
  19. #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN 40
  20. #define MAVLINK_MSG_ID_285_LEN 49
  21. #define MAVLINK_MSG_ID_285_MIN_LEN 40
  22. #define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC 137
  23. #define MAVLINK_MSG_ID_285_CRC 137
  24. #define MAVLINK_MSG_GIMBAL_DEVICE_ATTITUDE_STATUS_FIELD_Q_LEN 4
  25. #if MAVLINK_COMMAND_24BIT
  26. #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS { \
  27. 285, \
  28. "GIMBAL_DEVICE_ATTITUDE_STATUS", \
  29. 12, \
  30. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) }, \
  31. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) }, \
  32. { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) }, \
  33. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_gimbal_device_attitude_status_t, flags) }, \
  34. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_gimbal_device_attitude_status_t, q) }, \
  35. { "angular_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_x) }, \
  36. { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) }, \
  37. { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) }, \
  38. { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) }, \
  39. { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) }, \
  40. { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) }, \
  41. { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) }, \
  42. } \
  43. }
  44. #else
  45. #define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS { \
  46. "GIMBAL_DEVICE_ATTITUDE_STATUS", \
  47. 12, \
  48. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) }, \
  49. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) }, \
  50. { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) }, \
  51. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_gimbal_device_attitude_status_t, flags) }, \
  52. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_gimbal_device_attitude_status_t, q) }, \
  53. { "angular_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_x) }, \
  54. { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) }, \
  55. { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) }, \
  56. { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) }, \
  57. { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) }, \
  58. { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) }, \
  59. { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) }, \
  60. } \
  61. }
  62. #endif
  63. /**
  64. * @brief Pack a gimbal_device_attitude_status message
  65. * @param system_id ID of this system
  66. * @param component_id ID of this component (e.g. 200 for IMU)
  67. * @param msg The MAVLink message to compress the data into
  68. *
  69. * @param target_system System ID
  70. * @param target_component Component ID
  71. * @param time_boot_ms [ms] Timestamp (time since system boot).
  72. * @param flags Current gimbal flags set.
  73. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
  74. * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
  75. * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
  76. * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
  77. * @param failure_flags Failure flags (0 for no failure)
  78. * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
  79. * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
  80. * @param gimbal_device_id 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.
  81. * @return length of the message in bytes (excluding serial stream start sign)
  82. */
  83. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  84. uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
  85. {
  86. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  87. char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN];
  88. _mav_put_uint32_t(buf, 0, time_boot_ms);
  89. _mav_put_float(buf, 20, angular_velocity_x);
  90. _mav_put_float(buf, 24, angular_velocity_y);
  91. _mav_put_float(buf, 28, angular_velocity_z);
  92. _mav_put_uint32_t(buf, 32, failure_flags);
  93. _mav_put_uint16_t(buf, 36, flags);
  94. _mav_put_uint8_t(buf, 38, target_system);
  95. _mav_put_uint8_t(buf, 39, target_component);
  96. _mav_put_float(buf, 40, delta_yaw);
  97. _mav_put_float(buf, 44, delta_yaw_velocity);
  98. _mav_put_uint8_t(buf, 48, gimbal_device_id);
  99. _mav_put_float_array(buf, 4, q, 4);
  100. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  101. #else
  102. mavlink_gimbal_device_attitude_status_t packet;
  103. packet.time_boot_ms = time_boot_ms;
  104. packet.angular_velocity_x = angular_velocity_x;
  105. packet.angular_velocity_y = angular_velocity_y;
  106. packet.angular_velocity_z = angular_velocity_z;
  107. packet.failure_flags = failure_flags;
  108. packet.flags = flags;
  109. packet.target_system = target_system;
  110. packet.target_component = target_component;
  111. packet.delta_yaw = delta_yaw;
  112. packet.delta_yaw_velocity = delta_yaw_velocity;
  113. packet.gimbal_device_id = gimbal_device_id;
  114. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  115. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  116. #endif
  117. msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS;
  118. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  119. }
  120. /**
  121. * @brief Pack a gimbal_device_attitude_status message
  122. * @param system_id ID of this system
  123. * @param component_id ID of this component (e.g. 200 for IMU)
  124. * @param status MAVLink status structure
  125. * @param msg The MAVLink message to compress the data into
  126. *
  127. * @param target_system System ID
  128. * @param target_component Component ID
  129. * @param time_boot_ms [ms] Timestamp (time since system boot).
  130. * @param flags Current gimbal flags set.
  131. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
  132. * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
  133. * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
  134. * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
  135. * @param failure_flags Failure flags (0 for no failure)
  136. * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
  137. * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
  138. * @param gimbal_device_id 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.
  139. * @return length of the message in bytes (excluding serial stream start sign)
  140. */
  141. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  142. uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
  143. {
  144. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  145. char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN];
  146. _mav_put_uint32_t(buf, 0, time_boot_ms);
  147. _mav_put_float(buf, 20, angular_velocity_x);
  148. _mav_put_float(buf, 24, angular_velocity_y);
  149. _mav_put_float(buf, 28, angular_velocity_z);
  150. _mav_put_uint32_t(buf, 32, failure_flags);
  151. _mav_put_uint16_t(buf, 36, flags);
  152. _mav_put_uint8_t(buf, 38, target_system);
  153. _mav_put_uint8_t(buf, 39, target_component);
  154. _mav_put_float(buf, 40, delta_yaw);
  155. _mav_put_float(buf, 44, delta_yaw_velocity);
  156. _mav_put_uint8_t(buf, 48, gimbal_device_id);
  157. _mav_put_float_array(buf, 4, q, 4);
  158. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  159. #else
  160. mavlink_gimbal_device_attitude_status_t packet;
  161. packet.time_boot_ms = time_boot_ms;
  162. packet.angular_velocity_x = angular_velocity_x;
  163. packet.angular_velocity_y = angular_velocity_y;
  164. packet.angular_velocity_z = angular_velocity_z;
  165. packet.failure_flags = failure_flags;
  166. packet.flags = flags;
  167. packet.target_system = target_system;
  168. packet.target_component = target_component;
  169. packet.delta_yaw = delta_yaw;
  170. packet.delta_yaw_velocity = delta_yaw_velocity;
  171. packet.gimbal_device_id = gimbal_device_id;
  172. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  173. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  174. #endif
  175. msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS;
  176. #if MAVLINK_CRC_EXTRA
  177. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  178. #else
  179. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  180. #endif
  181. }
  182. /**
  183. * @brief Pack a gimbal_device_attitude_status message on a channel
  184. * @param system_id ID of this system
  185. * @param component_id ID of this component (e.g. 200 for IMU)
  186. * @param chan The MAVLink channel this message will be sent over
  187. * @param msg The MAVLink message to compress the data into
  188. * @param target_system System ID
  189. * @param target_component Component ID
  190. * @param time_boot_ms [ms] Timestamp (time since system boot).
  191. * @param flags Current gimbal flags set.
  192. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
  193. * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
  194. * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
  195. * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
  196. * @param failure_flags Failure flags (0 for no failure)
  197. * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
  198. * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
  199. * @param gimbal_device_id 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.
  200. * @return length of the message in bytes (excluding serial stream start sign)
  201. */
  202. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  203. mavlink_message_t* msg,
  204. uint8_t target_system,uint8_t target_component,uint32_t time_boot_ms,uint16_t flags,const float *q,float angular_velocity_x,float angular_velocity_y,float angular_velocity_z,uint32_t failure_flags,float delta_yaw,float delta_yaw_velocity,uint8_t gimbal_device_id)
  205. {
  206. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  207. char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN];
  208. _mav_put_uint32_t(buf, 0, time_boot_ms);
  209. _mav_put_float(buf, 20, angular_velocity_x);
  210. _mav_put_float(buf, 24, angular_velocity_y);
  211. _mav_put_float(buf, 28, angular_velocity_z);
  212. _mav_put_uint32_t(buf, 32, failure_flags);
  213. _mav_put_uint16_t(buf, 36, flags);
  214. _mav_put_uint8_t(buf, 38, target_system);
  215. _mav_put_uint8_t(buf, 39, target_component);
  216. _mav_put_float(buf, 40, delta_yaw);
  217. _mav_put_float(buf, 44, delta_yaw_velocity);
  218. _mav_put_uint8_t(buf, 48, gimbal_device_id);
  219. _mav_put_float_array(buf, 4, q, 4);
  220. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  221. #else
  222. mavlink_gimbal_device_attitude_status_t packet;
  223. packet.time_boot_ms = time_boot_ms;
  224. packet.angular_velocity_x = angular_velocity_x;
  225. packet.angular_velocity_y = angular_velocity_y;
  226. packet.angular_velocity_z = angular_velocity_z;
  227. packet.failure_flags = failure_flags;
  228. packet.flags = flags;
  229. packet.target_system = target_system;
  230. packet.target_component = target_component;
  231. packet.delta_yaw = delta_yaw;
  232. packet.delta_yaw_velocity = delta_yaw_velocity;
  233. packet.gimbal_device_id = gimbal_device_id;
  234. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  235. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  236. #endif
  237. msg->msgid = MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS;
  238. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  239. }
  240. /**
  241. * @brief Encode a gimbal_device_attitude_status struct
  242. *
  243. * @param system_id ID of this system
  244. * @param component_id ID of this component (e.g. 200 for IMU)
  245. * @param msg The MAVLink message to compress the data into
  246. * @param gimbal_device_attitude_status C-struct to read the message contents from
  247. */
  248. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
  249. {
  250. return mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
  251. }
  252. /**
  253. * @brief Encode a gimbal_device_attitude_status struct on a channel
  254. *
  255. * @param system_id ID of this system
  256. * @param component_id ID of this component (e.g. 200 for IMU)
  257. * @param chan The MAVLink channel this message will be sent over
  258. * @param msg The MAVLink message to compress the data into
  259. * @param gimbal_device_attitude_status C-struct to read the message contents from
  260. */
  261. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
  262. {
  263. return mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, chan, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
  264. }
  265. /**
  266. * @brief Encode a gimbal_device_attitude_status struct with provided status structure
  267. *
  268. * @param system_id ID of this system
  269. * @param component_id ID of this component (e.g. 200 for IMU)
  270. * @param status MAVLink status structure
  271. * @param msg The MAVLink message to compress the data into
  272. * @param gimbal_device_attitude_status C-struct to read the message contents from
  273. */
  274. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
  275. {
  276. return mavlink_msg_gimbal_device_attitude_status_pack_status(system_id, component_id, _status, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
  277. }
  278. /**
  279. * @brief Send a gimbal_device_attitude_status message
  280. * @param chan MAVLink channel to send the message
  281. *
  282. * @param target_system System ID
  283. * @param target_component Component ID
  284. * @param time_boot_ms [ms] Timestamp (time since system boot).
  285. * @param flags Current gimbal flags set.
  286. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
  287. * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
  288. * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
  289. * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
  290. * @param failure_flags Failure flags (0 for no failure)
  291. * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
  292. * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
  293. * @param gimbal_device_id 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.
  294. */
  295. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  296. static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
  297. {
  298. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  299. char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN];
  300. _mav_put_uint32_t(buf, 0, time_boot_ms);
  301. _mav_put_float(buf, 20, angular_velocity_x);
  302. _mav_put_float(buf, 24, angular_velocity_y);
  303. _mav_put_float(buf, 28, angular_velocity_z);
  304. _mav_put_uint32_t(buf, 32, failure_flags);
  305. _mav_put_uint16_t(buf, 36, flags);
  306. _mav_put_uint8_t(buf, 38, target_system);
  307. _mav_put_uint8_t(buf, 39, target_component);
  308. _mav_put_float(buf, 40, delta_yaw);
  309. _mav_put_float(buf, 44, delta_yaw_velocity);
  310. _mav_put_uint8_t(buf, 48, gimbal_device_id);
  311. _mav_put_float_array(buf, 4, q, 4);
  312. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  313. #else
  314. mavlink_gimbal_device_attitude_status_t packet;
  315. packet.time_boot_ms = time_boot_ms;
  316. packet.angular_velocity_x = angular_velocity_x;
  317. packet.angular_velocity_y = angular_velocity_y;
  318. packet.angular_velocity_z = angular_velocity_z;
  319. packet.failure_flags = failure_flags;
  320. packet.flags = flags;
  321. packet.target_system = target_system;
  322. packet.target_component = target_component;
  323. packet.delta_yaw = delta_yaw;
  324. packet.delta_yaw_velocity = delta_yaw_velocity;
  325. packet.gimbal_device_id = gimbal_device_id;
  326. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  327. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  328. #endif
  329. }
  330. /**
  331. * @brief Send a gimbal_device_attitude_status message
  332. * @param chan MAVLink channel to send the message
  333. * @param struct The MAVLink struct to serialize
  334. */
  335. static inline void mavlink_msg_gimbal_device_attitude_status_send_struct(mavlink_channel_t chan, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
  336. {
  337. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  338. mavlink_msg_gimbal_device_attitude_status_send(chan, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
  339. #else
  340. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)gimbal_device_attitude_status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  341. #endif
  342. }
  343. #if MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  344. /*
  345. This variant of _send() can be used to save stack space by re-using
  346. memory from the receive buffer. The caller provides a
  347. mavlink_message_t which is the size of a full mavlink message. This
  348. is usually the receive buffer for the channel, and allows a reply to an
  349. incoming message with minimum stack space usage.
  350. */
  351. static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
  352. {
  353. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  354. char *buf = (char *)msgbuf;
  355. _mav_put_uint32_t(buf, 0, time_boot_ms);
  356. _mav_put_float(buf, 20, angular_velocity_x);
  357. _mav_put_float(buf, 24, angular_velocity_y);
  358. _mav_put_float(buf, 28, angular_velocity_z);
  359. _mav_put_uint32_t(buf, 32, failure_flags);
  360. _mav_put_uint16_t(buf, 36, flags);
  361. _mav_put_uint8_t(buf, 38, target_system);
  362. _mav_put_uint8_t(buf, 39, target_component);
  363. _mav_put_float(buf, 40, delta_yaw);
  364. _mav_put_float(buf, 44, delta_yaw_velocity);
  365. _mav_put_uint8_t(buf, 48, gimbal_device_id);
  366. _mav_put_float_array(buf, 4, q, 4);
  367. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  368. #else
  369. mavlink_gimbal_device_attitude_status_t *packet = (mavlink_gimbal_device_attitude_status_t *)msgbuf;
  370. packet->time_boot_ms = time_boot_ms;
  371. packet->angular_velocity_x = angular_velocity_x;
  372. packet->angular_velocity_y = angular_velocity_y;
  373. packet->angular_velocity_z = angular_velocity_z;
  374. packet->failure_flags = failure_flags;
  375. packet->flags = flags;
  376. packet->target_system = target_system;
  377. packet->target_component = target_component;
  378. packet->delta_yaw = delta_yaw;
  379. packet->delta_yaw_velocity = delta_yaw_velocity;
  380. packet->gimbal_device_id = gimbal_device_id;
  381. mav_array_memcpy(packet->q, q, sizeof(float)*4);
  382. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
  383. #endif
  384. }
  385. #endif
  386. #endif
  387. // MESSAGE GIMBAL_DEVICE_ATTITUDE_STATUS UNPACKING
  388. /**
  389. * @brief Get field target_system from gimbal_device_attitude_status message
  390. *
  391. * @return System ID
  392. */
  393. static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_target_system(const mavlink_message_t* msg)
  394. {
  395. return _MAV_RETURN_uint8_t(msg, 38);
  396. }
  397. /**
  398. * @brief Get field target_component from gimbal_device_attitude_status message
  399. *
  400. * @return Component ID
  401. */
  402. static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_target_component(const mavlink_message_t* msg)
  403. {
  404. return _MAV_RETURN_uint8_t(msg, 39);
  405. }
  406. /**
  407. * @brief Get field time_boot_ms from gimbal_device_attitude_status message
  408. *
  409. * @return [ms] Timestamp (time since system boot).
  410. */
  411. static inline uint32_t mavlink_msg_gimbal_device_attitude_status_get_time_boot_ms(const mavlink_message_t* msg)
  412. {
  413. return _MAV_RETURN_uint32_t(msg, 0);
  414. }
  415. /**
  416. * @brief Get field flags from gimbal_device_attitude_status message
  417. *
  418. * @return Current gimbal flags set.
  419. */
  420. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_flags(const mavlink_message_t* msg)
  421. {
  422. return _MAV_RETURN_uint16_t(msg, 36);
  423. }
  424. /**
  425. * @brief Get field q from gimbal_device_attitude_status message
  426. *
  427. * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
  428. */
  429. static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_q(const mavlink_message_t* msg, float *q)
  430. {
  431. return _MAV_RETURN_float_array(msg, q, 4, 4);
  432. }
  433. /**
  434. * @brief Get field angular_velocity_x from gimbal_device_attitude_status message
  435. *
  436. * @return [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
  437. */
  438. static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_x(const mavlink_message_t* msg)
  439. {
  440. return _MAV_RETURN_float(msg, 20);
  441. }
  442. /**
  443. * @brief Get field angular_velocity_y from gimbal_device_attitude_status message
  444. *
  445. * @return [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
  446. */
  447. static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_y(const mavlink_message_t* msg)
  448. {
  449. return _MAV_RETURN_float(msg, 24);
  450. }
  451. /**
  452. * @brief Get field angular_velocity_z from gimbal_device_attitude_status message
  453. *
  454. * @return [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
  455. */
  456. static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_z(const mavlink_message_t* msg)
  457. {
  458. return _MAV_RETURN_float(msg, 28);
  459. }
  460. /**
  461. * @brief Get field failure_flags from gimbal_device_attitude_status message
  462. *
  463. * @return Failure flags (0 for no failure)
  464. */
  465. static inline uint32_t mavlink_msg_gimbal_device_attitude_status_get_failure_flags(const mavlink_message_t* msg)
  466. {
  467. return _MAV_RETURN_uint32_t(msg, 32);
  468. }
  469. /**
  470. * @brief Get field delta_yaw from gimbal_device_attitude_status message
  471. *
  472. * @return [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
  473. */
  474. static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(const mavlink_message_t* msg)
  475. {
  476. return _MAV_RETURN_float(msg, 40);
  477. }
  478. /**
  479. * @brief Get field delta_yaw_velocity from gimbal_device_attitude_status message
  480. *
  481. * @return [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
  482. */
  483. static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(const mavlink_message_t* msg)
  484. {
  485. return _MAV_RETURN_float(msg, 44);
  486. }
  487. /**
  488. * @brief Get field gimbal_device_id from gimbal_device_attitude_status message
  489. *
  490. * @return 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.
  491. */
  492. static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(const mavlink_message_t* msg)
  493. {
  494. return _MAV_RETURN_uint8_t(msg, 48);
  495. }
  496. /**
  497. * @brief Decode a gimbal_device_attitude_status message into a struct
  498. *
  499. * @param msg The message to decode
  500. * @param gimbal_device_attitude_status C-struct to decode the message contents into
  501. */
  502. static inline void mavlink_msg_gimbal_device_attitude_status_decode(const mavlink_message_t* msg, mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
  503. {
  504. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  505. gimbal_device_attitude_status->time_boot_ms = mavlink_msg_gimbal_device_attitude_status_get_time_boot_ms(msg);
  506. mavlink_msg_gimbal_device_attitude_status_get_q(msg, gimbal_device_attitude_status->q);
  507. gimbal_device_attitude_status->angular_velocity_x = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_x(msg);
  508. gimbal_device_attitude_status->angular_velocity_y = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_y(msg);
  509. gimbal_device_attitude_status->angular_velocity_z = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_z(msg);
  510. gimbal_device_attitude_status->failure_flags = mavlink_msg_gimbal_device_attitude_status_get_failure_flags(msg);
  511. gimbal_device_attitude_status->flags = mavlink_msg_gimbal_device_attitude_status_get_flags(msg);
  512. gimbal_device_attitude_status->target_system = mavlink_msg_gimbal_device_attitude_status_get_target_system(msg);
  513. gimbal_device_attitude_status->target_component = mavlink_msg_gimbal_device_attitude_status_get_target_component(msg);
  514. gimbal_device_attitude_status->delta_yaw = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(msg);
  515. gimbal_device_attitude_status->delta_yaw_velocity = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(msg);
  516. gimbal_device_attitude_status->gimbal_device_id = mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(msg);
  517. #else
  518. uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN;
  519. memset(gimbal_device_attitude_status, 0, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
  520. memcpy(gimbal_device_attitude_status, _MAV_PAYLOAD(msg), len);
  521. #endif
  522. }