mavlink_msg_att_pos_mocap.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. #pragma once
  2. // MESSAGE ATT_POS_MOCAP PACKING
  3. #define MAVLINK_MSG_ID_ATT_POS_MOCAP 138
  4. typedef struct __mavlink_att_pos_mocap_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]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
  7. float x; /*< [m] X position (NED)*/
  8. float y; /*< [m] Y position (NED)*/
  9. float z; /*< [m] Z position (NED)*/
  10. float covariance[21]; /*< Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.*/
  11. } mavlink_att_pos_mocap_t;
  12. #define MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN 120
  13. #define MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN 36
  14. #define MAVLINK_MSG_ID_138_LEN 120
  15. #define MAVLINK_MSG_ID_138_MIN_LEN 36
  16. #define MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC 109
  17. #define MAVLINK_MSG_ID_138_CRC 109
  18. #define MAVLINK_MSG_ATT_POS_MOCAP_FIELD_Q_LEN 4
  19. #define MAVLINK_MSG_ATT_POS_MOCAP_FIELD_COVARIANCE_LEN 21
  20. #if MAVLINK_COMMAND_24BIT
  21. #define MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP { \
  22. 138, \
  23. "ATT_POS_MOCAP", \
  24. 6, \
  25. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_att_pos_mocap_t, time_usec) }, \
  26. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_att_pos_mocap_t, q) }, \
  27. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_att_pos_mocap_t, x) }, \
  28. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_att_pos_mocap_t, y) }, \
  29. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_att_pos_mocap_t, z) }, \
  30. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 36, offsetof(mavlink_att_pos_mocap_t, covariance) }, \
  31. } \
  32. }
  33. #else
  34. #define MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP { \
  35. "ATT_POS_MOCAP", \
  36. 6, \
  37. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_att_pos_mocap_t, time_usec) }, \
  38. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_att_pos_mocap_t, q) }, \
  39. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_att_pos_mocap_t, x) }, \
  40. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_att_pos_mocap_t, y) }, \
  41. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_att_pos_mocap_t, z) }, \
  42. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 36, offsetof(mavlink_att_pos_mocap_t, covariance) }, \
  43. } \
  44. }
  45. #endif
  46. /**
  47. * @brief Pack a att_pos_mocap 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 Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  54. * @param x [m] X position (NED)
  55. * @param y [m] Y position (NED)
  56. * @param z [m] Z position (NED)
  57. * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five 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_att_pos_mocap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  61. uint64_t time_usec, const float *q, float x, float y, float z, const float *covariance)
  62. {
  63. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  64. char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
  65. _mav_put_uint64_t(buf, 0, time_usec);
  66. _mav_put_float(buf, 24, x);
  67. _mav_put_float(buf, 28, y);
  68. _mav_put_float(buf, 32, z);
  69. _mav_put_float_array(buf, 8, q, 4);
  70. _mav_put_float_array(buf, 36, covariance, 21);
  71. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  72. #else
  73. mavlink_att_pos_mocap_t packet;
  74. packet.time_usec = time_usec;
  75. packet.x = x;
  76. packet.y = y;
  77. packet.z = z;
  78. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  79. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
  80. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  81. #endif
  82. msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP;
  83. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  84. }
  85. /**
  86. * @brief Pack a att_pos_mocap 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 Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  94. * @param x [m] X position (NED)
  95. * @param y [m] Y position (NED)
  96. * @param z [m] Z position (NED)
  97. * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five 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_att_pos_mocap_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 x, float y, float z, const float *covariance)
  102. {
  103. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  104. char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
  105. _mav_put_uint64_t(buf, 0, time_usec);
  106. _mav_put_float(buf, 24, x);
  107. _mav_put_float(buf, 28, y);
  108. _mav_put_float(buf, 32, z);
  109. _mav_put_float_array(buf, 8, q, 4);
  110. _mav_put_float_array(buf, 36, covariance, 21);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  112. #else
  113. mavlink_att_pos_mocap_t packet;
  114. packet.time_usec = time_usec;
  115. packet.x = x;
  116. packet.y = y;
  117. packet.z = z;
  118. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  119. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  121. #endif
  122. msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP;
  123. #if MAVLINK_CRC_EXTRA
  124. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  125. #else
  126. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  127. #endif
  128. }
  129. /**
  130. * @brief Pack a att_pos_mocap 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 Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  137. * @param x [m] X position (NED)
  138. * @param y [m] Y position (NED)
  139. * @param z [m] Z position (NED)
  140. * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five 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_att_pos_mocap_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 x,float y,float z,const float *covariance)
  146. {
  147. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  148. char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
  149. _mav_put_uint64_t(buf, 0, time_usec);
  150. _mav_put_float(buf, 24, x);
  151. _mav_put_float(buf, 28, y);
  152. _mav_put_float(buf, 32, z);
  153. _mav_put_float_array(buf, 8, q, 4);
  154. _mav_put_float_array(buf, 36, covariance, 21);
  155. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  156. #else
  157. mavlink_att_pos_mocap_t packet;
  158. packet.time_usec = time_usec;
  159. packet.x = x;
  160. packet.y = y;
  161. packet.z = z;
  162. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  163. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
  164. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  165. #endif
  166. msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP;
  167. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  168. }
  169. /**
  170. * @brief Encode a att_pos_mocap 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 att_pos_mocap C-struct to read the message contents from
  176. */
  177. static inline uint16_t mavlink_msg_att_pos_mocap_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap)
  178. {
  179. return mavlink_msg_att_pos_mocap_pack(system_id, component_id, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance);
  180. }
  181. /**
  182. * @brief Encode a att_pos_mocap 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 att_pos_mocap C-struct to read the message contents from
  189. */
  190. static inline uint16_t mavlink_msg_att_pos_mocap_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap)
  191. {
  192. return mavlink_msg_att_pos_mocap_pack_chan(system_id, component_id, chan, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance);
  193. }
  194. /**
  195. * @brief Encode a att_pos_mocap 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 att_pos_mocap C-struct to read the message contents from
  202. */
  203. static inline uint16_t mavlink_msg_att_pos_mocap_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap)
  204. {
  205. return mavlink_msg_att_pos_mocap_pack_status(system_id, component_id, _status, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance);
  206. }
  207. /**
  208. * @brief Send a att_pos_mocap 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 Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  213. * @param x [m] X position (NED)
  214. * @param y [m] Y position (NED)
  215. * @param z [m] Z position (NED)
  216. * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five 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_att_pos_mocap_send(mavlink_channel_t chan, uint64_t time_usec, const float *q, float x, float y, float z, const float *covariance)
  220. {
  221. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  222. char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
  223. _mav_put_uint64_t(buf, 0, time_usec);
  224. _mav_put_float(buf, 24, x);
  225. _mav_put_float(buf, 28, y);
  226. _mav_put_float(buf, 32, z);
  227. _mav_put_float_array(buf, 8, q, 4);
  228. _mav_put_float_array(buf, 36, covariance, 21);
  229. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  230. #else
  231. mavlink_att_pos_mocap_t packet;
  232. packet.time_usec = time_usec;
  233. packet.x = x;
  234. packet.y = y;
  235. packet.z = z;
  236. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  237. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
  238. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)&packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  239. #endif
  240. }
  241. /**
  242. * @brief Send a att_pos_mocap 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_att_pos_mocap_send_struct(mavlink_channel_t chan, const mavlink_att_pos_mocap_t* att_pos_mocap)
  247. {
  248. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  249. mavlink_msg_att_pos_mocap_send(chan, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z, att_pos_mocap->covariance);
  250. #else
  251. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)att_pos_mocap, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  252. #endif
  253. }
  254. #if MAVLINK_MSG_ID_ATT_POS_MOCAP_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_att_pos_mocap_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const float *q, float x, float y, float z, 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, x);
  268. _mav_put_float(buf, 28, y);
  269. _mav_put_float(buf, 32, z);
  270. _mav_put_float_array(buf, 8, q, 4);
  271. _mav_put_float_array(buf, 36, covariance, 21);
  272. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  273. #else
  274. mavlink_att_pos_mocap_t *packet = (mavlink_att_pos_mocap_t *)msgbuf;
  275. packet->time_usec = time_usec;
  276. packet->x = x;
  277. packet->y = y;
  278. packet->z = z;
  279. mav_array_memcpy(packet->q, q, sizeof(float)*4);
  280. mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21);
  281. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
  282. #endif
  283. }
  284. #endif
  285. #endif
  286. // MESSAGE ATT_POS_MOCAP UNPACKING
  287. /**
  288. * @brief Get field time_usec from att_pos_mocap 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_att_pos_mocap_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 att_pos_mocap message
  298. *
  299. * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  300. */
  301. static inline uint16_t mavlink_msg_att_pos_mocap_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 x from att_pos_mocap message
  307. *
  308. * @return [m] X position (NED)
  309. */
  310. static inline float mavlink_msg_att_pos_mocap_get_x(const mavlink_message_t* msg)
  311. {
  312. return _MAV_RETURN_float(msg, 24);
  313. }
  314. /**
  315. * @brief Get field y from att_pos_mocap message
  316. *
  317. * @return [m] Y position (NED)
  318. */
  319. static inline float mavlink_msg_att_pos_mocap_get_y(const mavlink_message_t* msg)
  320. {
  321. return _MAV_RETURN_float(msg, 28);
  322. }
  323. /**
  324. * @brief Get field z from att_pos_mocap message
  325. *
  326. * @return [m] Z position (NED)
  327. */
  328. static inline float mavlink_msg_att_pos_mocap_get_z(const mavlink_message_t* msg)
  329. {
  330. return _MAV_RETURN_float(msg, 32);
  331. }
  332. /**
  333. * @brief Get field covariance from att_pos_mocap message
  334. *
  335. * @return Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five 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_att_pos_mocap_get_covariance(const mavlink_message_t* msg, float *covariance)
  338. {
  339. return _MAV_RETURN_float_array(msg, covariance, 21, 36);
  340. }
  341. /**
  342. * @brief Decode a att_pos_mocap message into a struct
  343. *
  344. * @param msg The message to decode
  345. * @param att_pos_mocap C-struct to decode the message contents into
  346. */
  347. static inline void mavlink_msg_att_pos_mocap_decode(const mavlink_message_t* msg, mavlink_att_pos_mocap_t* att_pos_mocap)
  348. {
  349. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  350. att_pos_mocap->time_usec = mavlink_msg_att_pos_mocap_get_time_usec(msg);
  351. mavlink_msg_att_pos_mocap_get_q(msg, att_pos_mocap->q);
  352. att_pos_mocap->x = mavlink_msg_att_pos_mocap_get_x(msg);
  353. att_pos_mocap->y = mavlink_msg_att_pos_mocap_get_y(msg);
  354. att_pos_mocap->z = mavlink_msg_att_pos_mocap_get_z(msg);
  355. mavlink_msg_att_pos_mocap_get_covariance(msg, att_pos_mocap->covariance);
  356. #else
  357. uint8_t len = msg->len < MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN? msg->len : MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN;
  358. memset(att_pos_mocap, 0, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
  359. memcpy(att_pos_mocap, _MAV_PAYLOAD(msg), len);
  360. #endif
  361. }