mavlink_msg_attitude_quaternion_cov.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. #pragma once
  2. // MESSAGE ATTITUDE_QUATERNION_COV PACKING
  3. #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV 61
  4. typedef struct __mavlink_attitude_quaternion_cov_t {
  5. uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
  6. float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)*/
  7. float rollspeed; /*< [rad/s] Roll angular speed*/
  8. float pitchspeed; /*< [rad/s] Pitch angular speed*/
  9. float yawspeed; /*< [rad/s] Yaw angular speed*/
  10. float covariance[9]; /*< Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.*/
  11. } mavlink_attitude_quaternion_cov_t;
  12. #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN 72
  13. #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN 72
  14. #define MAVLINK_MSG_ID_61_LEN 72
  15. #define MAVLINK_MSG_ID_61_MIN_LEN 72
  16. #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC 167
  17. #define MAVLINK_MSG_ID_61_CRC 167
  18. #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_Q_LEN 4
  19. #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_COVARIANCE_LEN 9
  20. #if MAVLINK_COMMAND_24BIT
  21. #define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
  22. 61, \
  23. "ATTITUDE_QUATERNION_COV", \
  24. 6, \
  25. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_usec) }, \
  26. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
  27. { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
  28. { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
  29. { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
  30. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 36, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
  31. } \
  32. }
  33. #else
  34. #define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
  35. "ATTITUDE_QUATERNION_COV", \
  36. 6, \
  37. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_usec) }, \
  38. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
  39. { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
  40. { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
  41. { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
  42. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 36, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
  43. } \
  44. }
  45. #endif
  46. /**
  47. * @brief Pack a attitude_quaternion_cov message
  48. * @param system_id ID of this system
  49. * @param component_id ID of this component (e.g. 200 for IMU)
  50. * @param msg The MAVLink message to compress the data into
  51. *
  52. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  53. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
  54. * @param rollspeed [rad/s] Roll angular speed
  55. * @param pitchspeed [rad/s] Pitch angular speed
  56. * @param yawspeed [rad/s] Yaw angular speed
  57. * @param covariance Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  58. * @return length of the message in bytes (excluding serial stream start sign)
  59. */
  60. static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  61. uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
  62. {
  63. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  64. char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
  65. _mav_put_uint64_t(buf, 0, time_usec);
  66. _mav_put_float(buf, 24, rollspeed);
  67. _mav_put_float(buf, 28, pitchspeed);
  68. _mav_put_float(buf, 32, yawspeed);
  69. _mav_put_float_array(buf, 8, q, 4);
  70. _mav_put_float_array(buf, 36, covariance, 9);
  71. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  72. #else
  73. mavlink_attitude_quaternion_cov_t packet;
  74. packet.time_usec = time_usec;
  75. packet.rollspeed = rollspeed;
  76. packet.pitchspeed = pitchspeed;
  77. packet.yawspeed = yawspeed;
  78. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  79. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
  80. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  81. #endif
  82. msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
  83. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  84. }
  85. /**
  86. * @brief Pack a attitude_quaternion_cov message
  87. * @param system_id ID of this system
  88. * @param component_id ID of this component (e.g. 200 for IMU)
  89. * @param status MAVLink status structure
  90. * @param msg The MAVLink message to compress the data into
  91. *
  92. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  93. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
  94. * @param rollspeed [rad/s] Roll angular speed
  95. * @param pitchspeed [rad/s] Pitch angular speed
  96. * @param yawspeed [rad/s] Yaw angular speed
  97. * @param covariance Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  98. * @return length of the message in bytes (excluding serial stream start sign)
  99. */
  100. static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  101. uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
  102. {
  103. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  104. char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
  105. _mav_put_uint64_t(buf, 0, time_usec);
  106. _mav_put_float(buf, 24, rollspeed);
  107. _mav_put_float(buf, 28, pitchspeed);
  108. _mav_put_float(buf, 32, yawspeed);
  109. _mav_put_float_array(buf, 8, q, 4);
  110. _mav_put_float_array(buf, 36, covariance, 9);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  112. #else
  113. mavlink_attitude_quaternion_cov_t packet;
  114. packet.time_usec = time_usec;
  115. packet.rollspeed = rollspeed;
  116. packet.pitchspeed = pitchspeed;
  117. packet.yawspeed = yawspeed;
  118. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  119. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  121. #endif
  122. msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
  123. #if MAVLINK_CRC_EXTRA
  124. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  125. #else
  126. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  127. #endif
  128. }
  129. /**
  130. * @brief Pack a attitude_quaternion_cov message on a channel
  131. * @param system_id ID of this system
  132. * @param component_id ID of this component (e.g. 200 for IMU)
  133. * @param chan The MAVLink channel this message will be sent over
  134. * @param msg The MAVLink message to compress the data into
  135. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  136. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
  137. * @param rollspeed [rad/s] Roll angular speed
  138. * @param pitchspeed [rad/s] Pitch angular speed
  139. * @param yawspeed [rad/s] Yaw angular speed
  140. * @param covariance Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  141. * @return length of the message in bytes (excluding serial stream start sign)
  142. */
  143. static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  144. mavlink_message_t* msg,
  145. uint64_t time_usec,const float *q,float rollspeed,float pitchspeed,float yawspeed,const float *covariance)
  146. {
  147. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  148. char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
  149. _mav_put_uint64_t(buf, 0, time_usec);
  150. _mav_put_float(buf, 24, rollspeed);
  151. _mav_put_float(buf, 28, pitchspeed);
  152. _mav_put_float(buf, 32, yawspeed);
  153. _mav_put_float_array(buf, 8, q, 4);
  154. _mav_put_float_array(buf, 36, covariance, 9);
  155. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  156. #else
  157. mavlink_attitude_quaternion_cov_t packet;
  158. packet.time_usec = time_usec;
  159. packet.rollspeed = rollspeed;
  160. packet.pitchspeed = pitchspeed;
  161. packet.yawspeed = yawspeed;
  162. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  163. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
  164. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  165. #endif
  166. msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
  167. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  168. }
  169. /**
  170. * @brief Encode a attitude_quaternion_cov struct
  171. *
  172. * @param system_id ID of this system
  173. * @param component_id ID of this component (e.g. 200 for IMU)
  174. * @param msg The MAVLink message to compress the data into
  175. * @param attitude_quaternion_cov C-struct to read the message contents from
  176. */
  177. static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
  178. {
  179. return mavlink_msg_attitude_quaternion_cov_pack(system_id, component_id, msg, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
  180. }
  181. /**
  182. * @brief Encode a attitude_quaternion_cov struct on a channel
  183. *
  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 attitude_quaternion_cov C-struct to read the message contents from
  189. */
  190. static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
  191. {
  192. return mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, chan, msg, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
  193. }
  194. /**
  195. * @brief Encode a attitude_quaternion_cov struct with provided status structure
  196. *
  197. * @param system_id ID of this system
  198. * @param component_id ID of this component (e.g. 200 for IMU)
  199. * @param status MAVLink status structure
  200. * @param msg The MAVLink message to compress the data into
  201. * @param attitude_quaternion_cov C-struct to read the message contents from
  202. */
  203. static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
  204. {
  205. return mavlink_msg_attitude_quaternion_cov_pack_status(system_id, component_id, _status, msg, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
  206. }
  207. /**
  208. * @brief Send a attitude_quaternion_cov message
  209. * @param chan MAVLink channel to send the message
  210. *
  211. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  212. * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
  213. * @param rollspeed [rad/s] Roll angular speed
  214. * @param pitchspeed [rad/s] Pitch angular speed
  215. * @param yawspeed [rad/s] Yaw angular speed
  216. * @param covariance Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  217. */
  218. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  219. static inline void mavlink_msg_attitude_quaternion_cov_send(mavlink_channel_t chan, uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
  220. {
  221. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  222. char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
  223. _mav_put_uint64_t(buf, 0, time_usec);
  224. _mav_put_float(buf, 24, rollspeed);
  225. _mav_put_float(buf, 28, pitchspeed);
  226. _mav_put_float(buf, 32, yawspeed);
  227. _mav_put_float_array(buf, 8, q, 4);
  228. _mav_put_float_array(buf, 36, covariance, 9);
  229. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  230. #else
  231. mavlink_attitude_quaternion_cov_t packet;
  232. packet.time_usec = time_usec;
  233. packet.rollspeed = rollspeed;
  234. packet.pitchspeed = pitchspeed;
  235. packet.yawspeed = yawspeed;
  236. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  237. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
  238. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  239. #endif
  240. }
  241. /**
  242. * @brief Send a attitude_quaternion_cov message
  243. * @param chan MAVLink channel to send the message
  244. * @param struct The MAVLink struct to serialize
  245. */
  246. static inline void mavlink_msg_attitude_quaternion_cov_send_struct(mavlink_channel_t chan, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
  247. {
  248. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  249. mavlink_msg_attitude_quaternion_cov_send(chan, attitude_quaternion_cov->time_usec, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
  250. #else
  251. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)attitude_quaternion_cov, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  252. #endif
  253. }
  254. #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  255. /*
  256. This variant of _send() can be used to save stack space by re-using
  257. memory from the receive buffer. The caller provides a
  258. mavlink_message_t which is the size of a full mavlink message. This
  259. is usually the receive buffer for the channel, and allows a reply to an
  260. incoming message with minimum stack space usage.
  261. */
  262. static inline void mavlink_msg_attitude_quaternion_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
  263. {
  264. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  265. char *buf = (char *)msgbuf;
  266. _mav_put_uint64_t(buf, 0, time_usec);
  267. _mav_put_float(buf, 24, rollspeed);
  268. _mav_put_float(buf, 28, pitchspeed);
  269. _mav_put_float(buf, 32, yawspeed);
  270. _mav_put_float_array(buf, 8, q, 4);
  271. _mav_put_float_array(buf, 36, covariance, 9);
  272. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  273. #else
  274. mavlink_attitude_quaternion_cov_t *packet = (mavlink_attitude_quaternion_cov_t *)msgbuf;
  275. packet->time_usec = time_usec;
  276. packet->rollspeed = rollspeed;
  277. packet->pitchspeed = pitchspeed;
  278. packet->yawspeed = yawspeed;
  279. mav_array_memcpy(packet->q, q, sizeof(float)*4);
  280. mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9);
  281. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
  282. #endif
  283. }
  284. #endif
  285. #endif
  286. // MESSAGE ATTITUDE_QUATERNION_COV UNPACKING
  287. /**
  288. * @brief Get field time_usec from attitude_quaternion_cov message
  289. *
  290. * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  291. */
  292. static inline uint64_t mavlink_msg_attitude_quaternion_cov_get_time_usec(const mavlink_message_t* msg)
  293. {
  294. return _MAV_RETURN_uint64_t(msg, 0);
  295. }
  296. /**
  297. * @brief Get field q from attitude_quaternion_cov message
  298. *
  299. * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
  300. */
  301. static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_q(const mavlink_message_t* msg, float *q)
  302. {
  303. return _MAV_RETURN_float_array(msg, q, 4, 8);
  304. }
  305. /**
  306. * @brief Get field rollspeed from attitude_quaternion_cov message
  307. *
  308. * @return [rad/s] Roll angular speed
  309. */
  310. static inline float mavlink_msg_attitude_quaternion_cov_get_rollspeed(const mavlink_message_t* msg)
  311. {
  312. return _MAV_RETURN_float(msg, 24);
  313. }
  314. /**
  315. * @brief Get field pitchspeed from attitude_quaternion_cov message
  316. *
  317. * @return [rad/s] Pitch angular speed
  318. */
  319. static inline float mavlink_msg_attitude_quaternion_cov_get_pitchspeed(const mavlink_message_t* msg)
  320. {
  321. return _MAV_RETURN_float(msg, 28);
  322. }
  323. /**
  324. * @brief Get field yawspeed from attitude_quaternion_cov message
  325. *
  326. * @return [rad/s] Yaw angular speed
  327. */
  328. static inline float mavlink_msg_attitude_quaternion_cov_get_yawspeed(const mavlink_message_t* msg)
  329. {
  330. return _MAV_RETURN_float(msg, 32);
  331. }
  332. /**
  333. * @brief Get field covariance from attitude_quaternion_cov message
  334. *
  335. * @return Row-major representation of a 3x3 attitude covariance matrix (states: roll, pitch, yaw; first three entries are the first ROW, next three entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  336. */
  337. static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
  338. {
  339. return _MAV_RETURN_float_array(msg, covariance, 9, 36);
  340. }
  341. /**
  342. * @brief Decode a attitude_quaternion_cov message into a struct
  343. *
  344. * @param msg The message to decode
  345. * @param attitude_quaternion_cov C-struct to decode the message contents into
  346. */
  347. static inline void mavlink_msg_attitude_quaternion_cov_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
  348. {
  349. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  350. attitude_quaternion_cov->time_usec = mavlink_msg_attitude_quaternion_cov_get_time_usec(msg);
  351. mavlink_msg_attitude_quaternion_cov_get_q(msg, attitude_quaternion_cov->q);
  352. attitude_quaternion_cov->rollspeed = mavlink_msg_attitude_quaternion_cov_get_rollspeed(msg);
  353. attitude_quaternion_cov->pitchspeed = mavlink_msg_attitude_quaternion_cov_get_pitchspeed(msg);
  354. attitude_quaternion_cov->yawspeed = mavlink_msg_attitude_quaternion_cov_get_yawspeed(msg);
  355. mavlink_msg_attitude_quaternion_cov_get_covariance(msg, attitude_quaternion_cov->covariance);
  356. #else
  357. uint8_t len = msg->len < MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN? msg->len : MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN;
  358. memset(attitude_quaternion_cov, 0, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
  359. memcpy(attitude_quaternion_cov, _MAV_PAYLOAD(msg), len);
  360. #endif
  361. }