mavlink_msg_global_position_int_cov.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. #pragma once
  2. // MESSAGE GLOBAL_POSITION_INT_COV PACKING
  3. #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV 63
  4. typedef struct __mavlink_global_position_int_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. int32_t lat; /*< [degE7] Latitude*/
  7. int32_t lon; /*< [degE7] Longitude*/
  8. int32_t alt; /*< [mm] Altitude in meters above MSL*/
  9. int32_t relative_alt; /*< [mm] Altitude above ground*/
  10. float vx; /*< [m/s] Ground X Speed (Latitude)*/
  11. float vy; /*< [m/s] Ground Y Speed (Longitude)*/
  12. float vz; /*< [m/s] Ground Z Speed (Altitude)*/
  13. float covariance[36]; /*< Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.*/
  14. uint8_t estimator_type; /*< Class id of the estimator this estimate originated from.*/
  15. } mavlink_global_position_int_cov_t;
  16. #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN 181
  17. #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN 181
  18. #define MAVLINK_MSG_ID_63_LEN 181
  19. #define MAVLINK_MSG_ID_63_MIN_LEN 181
  20. #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC 119
  21. #define MAVLINK_MSG_ID_63_CRC 119
  22. #define MAVLINK_MSG_GLOBAL_POSITION_INT_COV_FIELD_COVARIANCE_LEN 36
  23. #if MAVLINK_COMMAND_24BIT
  24. #define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV { \
  25. 63, \
  26. "GLOBAL_POSITION_INT_COV", \
  27. 10, \
  28. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_int_cov_t, time_usec) }, \
  29. { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 180, offsetof(mavlink_global_position_int_cov_t, estimator_type) }, \
  30. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_cov_t, lat) }, \
  31. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_cov_t, lon) }, \
  32. { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_cov_t, alt) }, \
  33. { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_global_position_int_cov_t, relative_alt) }, \
  34. { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_int_cov_t, vx) }, \
  35. { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_int_cov_t, vy) }, \
  36. { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_int_cov_t, vz) }, \
  37. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 36, 36, offsetof(mavlink_global_position_int_cov_t, covariance) }, \
  38. } \
  39. }
  40. #else
  41. #define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV { \
  42. "GLOBAL_POSITION_INT_COV", \
  43. 10, \
  44. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_int_cov_t, time_usec) }, \
  45. { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 180, offsetof(mavlink_global_position_int_cov_t, estimator_type) }, \
  46. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_cov_t, lat) }, \
  47. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_cov_t, lon) }, \
  48. { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_cov_t, alt) }, \
  49. { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_global_position_int_cov_t, relative_alt) }, \
  50. { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_int_cov_t, vx) }, \
  51. { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_int_cov_t, vy) }, \
  52. { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_int_cov_t, vz) }, \
  53. { "covariance", NULL, MAVLINK_TYPE_FLOAT, 36, 36, offsetof(mavlink_global_position_int_cov_t, covariance) }, \
  54. } \
  55. }
  56. #endif
  57. /**
  58. * @brief Pack a global_position_int_cov message
  59. * @param system_id ID of this system
  60. * @param component_id ID of this component (e.g. 200 for IMU)
  61. * @param msg The MAVLink message to compress the data into
  62. *
  63. * @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.
  64. * @param estimator_type Class id of the estimator this estimate originated from.
  65. * @param lat [degE7] Latitude
  66. * @param lon [degE7] Longitude
  67. * @param alt [mm] Altitude in meters above MSL
  68. * @param relative_alt [mm] Altitude above ground
  69. * @param vx [m/s] Ground X Speed (Latitude)
  70. * @param vy [m/s] Ground Y Speed (Longitude)
  71. * @param vz [m/s] Ground Z Speed (Altitude)
  72. * @param covariance Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  73. * @return length of the message in bytes (excluding serial stream start sign)
  74. */
  75. static inline uint16_t mavlink_msg_global_position_int_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  76. uint64_t time_usec, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
  77. {
  78. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  79. char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
  80. _mav_put_uint64_t(buf, 0, time_usec);
  81. _mav_put_int32_t(buf, 8, lat);
  82. _mav_put_int32_t(buf, 12, lon);
  83. _mav_put_int32_t(buf, 16, alt);
  84. _mav_put_int32_t(buf, 20, relative_alt);
  85. _mav_put_float(buf, 24, vx);
  86. _mav_put_float(buf, 28, vy);
  87. _mav_put_float(buf, 32, vz);
  88. _mav_put_uint8_t(buf, 180, estimator_type);
  89. _mav_put_float_array(buf, 36, covariance, 36);
  90. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  91. #else
  92. mavlink_global_position_int_cov_t packet;
  93. packet.time_usec = time_usec;
  94. packet.lat = lat;
  95. packet.lon = lon;
  96. packet.alt = alt;
  97. packet.relative_alt = relative_alt;
  98. packet.vx = vx;
  99. packet.vy = vy;
  100. packet.vz = vz;
  101. packet.estimator_type = estimator_type;
  102. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
  103. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  104. #endif
  105. msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
  106. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  107. }
  108. /**
  109. * @brief Pack a global_position_int_cov message
  110. * @param system_id ID of this system
  111. * @param component_id ID of this component (e.g. 200 for IMU)
  112. * @param status MAVLink status structure
  113. * @param msg The MAVLink message to compress the data into
  114. *
  115. * @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.
  116. * @param estimator_type Class id of the estimator this estimate originated from.
  117. * @param lat [degE7] Latitude
  118. * @param lon [degE7] Longitude
  119. * @param alt [mm] Altitude in meters above MSL
  120. * @param relative_alt [mm] Altitude above ground
  121. * @param vx [m/s] Ground X Speed (Latitude)
  122. * @param vy [m/s] Ground Y Speed (Longitude)
  123. * @param vz [m/s] Ground Z Speed (Altitude)
  124. * @param covariance Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  125. * @return length of the message in bytes (excluding serial stream start sign)
  126. */
  127. static inline uint16_t mavlink_msg_global_position_int_cov_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  128. uint64_t time_usec, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
  129. {
  130. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  131. char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
  132. _mav_put_uint64_t(buf, 0, time_usec);
  133. _mav_put_int32_t(buf, 8, lat);
  134. _mav_put_int32_t(buf, 12, lon);
  135. _mav_put_int32_t(buf, 16, alt);
  136. _mav_put_int32_t(buf, 20, relative_alt);
  137. _mav_put_float(buf, 24, vx);
  138. _mav_put_float(buf, 28, vy);
  139. _mav_put_float(buf, 32, vz);
  140. _mav_put_uint8_t(buf, 180, estimator_type);
  141. _mav_put_float_array(buf, 36, covariance, 36);
  142. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  143. #else
  144. mavlink_global_position_int_cov_t packet;
  145. packet.time_usec = time_usec;
  146. packet.lat = lat;
  147. packet.lon = lon;
  148. packet.alt = alt;
  149. packet.relative_alt = relative_alt;
  150. packet.vx = vx;
  151. packet.vy = vy;
  152. packet.vz = vz;
  153. packet.estimator_type = estimator_type;
  154. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
  155. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  156. #endif
  157. msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
  158. #if MAVLINK_CRC_EXTRA
  159. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  160. #else
  161. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  162. #endif
  163. }
  164. /**
  165. * @brief Pack a global_position_int_cov message on a channel
  166. * @param system_id ID of this system
  167. * @param component_id ID of this component (e.g. 200 for IMU)
  168. * @param chan The MAVLink channel this message will be sent over
  169. * @param msg The MAVLink message to compress the data into
  170. * @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.
  171. * @param estimator_type Class id of the estimator this estimate originated from.
  172. * @param lat [degE7] Latitude
  173. * @param lon [degE7] Longitude
  174. * @param alt [mm] Altitude in meters above MSL
  175. * @param relative_alt [mm] Altitude above ground
  176. * @param vx [m/s] Ground X Speed (Latitude)
  177. * @param vy [m/s] Ground Y Speed (Longitude)
  178. * @param vz [m/s] Ground Z Speed (Altitude)
  179. * @param covariance Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  180. * @return length of the message in bytes (excluding serial stream start sign)
  181. */
  182. static inline uint16_t mavlink_msg_global_position_int_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  183. mavlink_message_t* msg,
  184. uint64_t time_usec,uint8_t estimator_type,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,float vx,float vy,float vz,const float *covariance)
  185. {
  186. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  187. char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
  188. _mav_put_uint64_t(buf, 0, time_usec);
  189. _mav_put_int32_t(buf, 8, lat);
  190. _mav_put_int32_t(buf, 12, lon);
  191. _mav_put_int32_t(buf, 16, alt);
  192. _mav_put_int32_t(buf, 20, relative_alt);
  193. _mav_put_float(buf, 24, vx);
  194. _mav_put_float(buf, 28, vy);
  195. _mav_put_float(buf, 32, vz);
  196. _mav_put_uint8_t(buf, 180, estimator_type);
  197. _mav_put_float_array(buf, 36, covariance, 36);
  198. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  199. #else
  200. mavlink_global_position_int_cov_t packet;
  201. packet.time_usec = time_usec;
  202. packet.lat = lat;
  203. packet.lon = lon;
  204. packet.alt = alt;
  205. packet.relative_alt = relative_alt;
  206. packet.vx = vx;
  207. packet.vy = vy;
  208. packet.vz = vz;
  209. packet.estimator_type = estimator_type;
  210. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
  211. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  212. #endif
  213. msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
  214. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  215. }
  216. /**
  217. * @brief Encode a global_position_int_cov struct
  218. *
  219. * @param system_id ID of this system
  220. * @param component_id ID of this component (e.g. 200 for IMU)
  221. * @param msg The MAVLink message to compress the data into
  222. * @param global_position_int_cov C-struct to read the message contents from
  223. */
  224. static inline uint16_t mavlink_msg_global_position_int_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
  225. {
  226. return mavlink_msg_global_position_int_cov_pack(system_id, component_id, msg, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
  227. }
  228. /**
  229. * @brief Encode a global_position_int_cov struct on a channel
  230. *
  231. * @param system_id ID of this system
  232. * @param component_id ID of this component (e.g. 200 for IMU)
  233. * @param chan The MAVLink channel this message will be sent over
  234. * @param msg The MAVLink message to compress the data into
  235. * @param global_position_int_cov C-struct to read the message contents from
  236. */
  237. static inline uint16_t mavlink_msg_global_position_int_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
  238. {
  239. return mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, chan, msg, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
  240. }
  241. /**
  242. * @brief Encode a global_position_int_cov struct with provided status structure
  243. *
  244. * @param system_id ID of this system
  245. * @param component_id ID of this component (e.g. 200 for IMU)
  246. * @param status MAVLink status structure
  247. * @param msg The MAVLink message to compress the data into
  248. * @param global_position_int_cov C-struct to read the message contents from
  249. */
  250. static inline uint16_t mavlink_msg_global_position_int_cov_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
  251. {
  252. return mavlink_msg_global_position_int_cov_pack_status(system_id, component_id, _status, msg, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
  253. }
  254. /**
  255. * @brief Send a global_position_int_cov message
  256. * @param chan MAVLink channel to send the message
  257. *
  258. * @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.
  259. * @param estimator_type Class id of the estimator this estimate originated from.
  260. * @param lat [degE7] Latitude
  261. * @param lon [degE7] Longitude
  262. * @param alt [mm] Altitude in meters above MSL
  263. * @param relative_alt [mm] Altitude above ground
  264. * @param vx [m/s] Ground X Speed (Latitude)
  265. * @param vy [m/s] Ground Y Speed (Longitude)
  266. * @param vz [m/s] Ground Z Speed (Altitude)
  267. * @param covariance Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  268. */
  269. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  270. static inline void mavlink_msg_global_position_int_cov_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
  271. {
  272. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  273. char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
  274. _mav_put_uint64_t(buf, 0, time_usec);
  275. _mav_put_int32_t(buf, 8, lat);
  276. _mav_put_int32_t(buf, 12, lon);
  277. _mav_put_int32_t(buf, 16, alt);
  278. _mav_put_int32_t(buf, 20, relative_alt);
  279. _mav_put_float(buf, 24, vx);
  280. _mav_put_float(buf, 28, vy);
  281. _mav_put_float(buf, 32, vz);
  282. _mav_put_uint8_t(buf, 180, estimator_type);
  283. _mav_put_float_array(buf, 36, covariance, 36);
  284. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  285. #else
  286. mavlink_global_position_int_cov_t packet;
  287. packet.time_usec = time_usec;
  288. packet.lat = lat;
  289. packet.lon = lon;
  290. packet.alt = alt;
  291. packet.relative_alt = relative_alt;
  292. packet.vx = vx;
  293. packet.vy = vy;
  294. packet.vz = vz;
  295. packet.estimator_type = estimator_type;
  296. mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
  297. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  298. #endif
  299. }
  300. /**
  301. * @brief Send a global_position_int_cov message
  302. * @param chan MAVLink channel to send the message
  303. * @param struct The MAVLink struct to serialize
  304. */
  305. static inline void mavlink_msg_global_position_int_cov_send_struct(mavlink_channel_t chan, const mavlink_global_position_int_cov_t* global_position_int_cov)
  306. {
  307. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  308. mavlink_msg_global_position_int_cov_send(chan, global_position_int_cov->time_usec, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
  309. #else
  310. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)global_position_int_cov, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  311. #endif
  312. }
  313. #if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  314. /*
  315. This variant of _send() can be used to save stack space by re-using
  316. memory from the receive buffer. The caller provides a
  317. mavlink_message_t which is the size of a full mavlink message. This
  318. is usually the receive buffer for the channel, and allows a reply to an
  319. incoming message with minimum stack space usage.
  320. */
  321. static inline void mavlink_msg_global_position_int_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
  322. {
  323. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  324. char *buf = (char *)msgbuf;
  325. _mav_put_uint64_t(buf, 0, time_usec);
  326. _mav_put_int32_t(buf, 8, lat);
  327. _mav_put_int32_t(buf, 12, lon);
  328. _mav_put_int32_t(buf, 16, alt);
  329. _mav_put_int32_t(buf, 20, relative_alt);
  330. _mav_put_float(buf, 24, vx);
  331. _mav_put_float(buf, 28, vy);
  332. _mav_put_float(buf, 32, vz);
  333. _mav_put_uint8_t(buf, 180, estimator_type);
  334. _mav_put_float_array(buf, 36, covariance, 36);
  335. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  336. #else
  337. mavlink_global_position_int_cov_t *packet = (mavlink_global_position_int_cov_t *)msgbuf;
  338. packet->time_usec = time_usec;
  339. packet->lat = lat;
  340. packet->lon = lon;
  341. packet->alt = alt;
  342. packet->relative_alt = relative_alt;
  343. packet->vx = vx;
  344. packet->vy = vy;
  345. packet->vz = vz;
  346. packet->estimator_type = estimator_type;
  347. mav_array_memcpy(packet->covariance, covariance, sizeof(float)*36);
  348. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
  349. #endif
  350. }
  351. #endif
  352. #endif
  353. // MESSAGE GLOBAL_POSITION_INT_COV UNPACKING
  354. /**
  355. * @brief Get field time_usec from global_position_int_cov message
  356. *
  357. * @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.
  358. */
  359. static inline uint64_t mavlink_msg_global_position_int_cov_get_time_usec(const mavlink_message_t* msg)
  360. {
  361. return _MAV_RETURN_uint64_t(msg, 0);
  362. }
  363. /**
  364. * @brief Get field estimator_type from global_position_int_cov message
  365. *
  366. * @return Class id of the estimator this estimate originated from.
  367. */
  368. static inline uint8_t mavlink_msg_global_position_int_cov_get_estimator_type(const mavlink_message_t* msg)
  369. {
  370. return _MAV_RETURN_uint8_t(msg, 180);
  371. }
  372. /**
  373. * @brief Get field lat from global_position_int_cov message
  374. *
  375. * @return [degE7] Latitude
  376. */
  377. static inline int32_t mavlink_msg_global_position_int_cov_get_lat(const mavlink_message_t* msg)
  378. {
  379. return _MAV_RETURN_int32_t(msg, 8);
  380. }
  381. /**
  382. * @brief Get field lon from global_position_int_cov message
  383. *
  384. * @return [degE7] Longitude
  385. */
  386. static inline int32_t mavlink_msg_global_position_int_cov_get_lon(const mavlink_message_t* msg)
  387. {
  388. return _MAV_RETURN_int32_t(msg, 12);
  389. }
  390. /**
  391. * @brief Get field alt from global_position_int_cov message
  392. *
  393. * @return [mm] Altitude in meters above MSL
  394. */
  395. static inline int32_t mavlink_msg_global_position_int_cov_get_alt(const mavlink_message_t* msg)
  396. {
  397. return _MAV_RETURN_int32_t(msg, 16);
  398. }
  399. /**
  400. * @brief Get field relative_alt from global_position_int_cov message
  401. *
  402. * @return [mm] Altitude above ground
  403. */
  404. static inline int32_t mavlink_msg_global_position_int_cov_get_relative_alt(const mavlink_message_t* msg)
  405. {
  406. return _MAV_RETURN_int32_t(msg, 20);
  407. }
  408. /**
  409. * @brief Get field vx from global_position_int_cov message
  410. *
  411. * @return [m/s] Ground X Speed (Latitude)
  412. */
  413. static inline float mavlink_msg_global_position_int_cov_get_vx(const mavlink_message_t* msg)
  414. {
  415. return _MAV_RETURN_float(msg, 24);
  416. }
  417. /**
  418. * @brief Get field vy from global_position_int_cov message
  419. *
  420. * @return [m/s] Ground Y Speed (Longitude)
  421. */
  422. static inline float mavlink_msg_global_position_int_cov_get_vy(const mavlink_message_t* msg)
  423. {
  424. return _MAV_RETURN_float(msg, 28);
  425. }
  426. /**
  427. * @brief Get field vz from global_position_int_cov message
  428. *
  429. * @return [m/s] Ground Z Speed (Altitude)
  430. */
  431. static inline float mavlink_msg_global_position_int_cov_get_vz(const mavlink_message_t* msg)
  432. {
  433. return _MAV_RETURN_float(msg, 32);
  434. }
  435. /**
  436. * @brief Get field covariance from global_position_int_cov message
  437. *
  438. * @return Row-major representation of a 6x6 position and velocity 6x6 cross-covariance matrix (states: lat, lon, alt, vx, vy, vz; first six entries are the first ROW, next six entries are the second row, etc.). If unknown, assign NaN value to first element in the array.
  439. */
  440. static inline uint16_t mavlink_msg_global_position_int_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
  441. {
  442. return _MAV_RETURN_float_array(msg, covariance, 36, 36);
  443. }
  444. /**
  445. * @brief Decode a global_position_int_cov message into a struct
  446. *
  447. * @param msg The message to decode
  448. * @param global_position_int_cov C-struct to decode the message contents into
  449. */
  450. static inline void mavlink_msg_global_position_int_cov_decode(const mavlink_message_t* msg, mavlink_global_position_int_cov_t* global_position_int_cov)
  451. {
  452. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  453. global_position_int_cov->time_usec = mavlink_msg_global_position_int_cov_get_time_usec(msg);
  454. global_position_int_cov->lat = mavlink_msg_global_position_int_cov_get_lat(msg);
  455. global_position_int_cov->lon = mavlink_msg_global_position_int_cov_get_lon(msg);
  456. global_position_int_cov->alt = mavlink_msg_global_position_int_cov_get_alt(msg);
  457. global_position_int_cov->relative_alt = mavlink_msg_global_position_int_cov_get_relative_alt(msg);
  458. global_position_int_cov->vx = mavlink_msg_global_position_int_cov_get_vx(msg);
  459. global_position_int_cov->vy = mavlink_msg_global_position_int_cov_get_vy(msg);
  460. global_position_int_cov->vz = mavlink_msg_global_position_int_cov_get_vz(msg);
  461. mavlink_msg_global_position_int_cov_get_covariance(msg, global_position_int_cov->covariance);
  462. global_position_int_cov->estimator_type = mavlink_msg_global_position_int_cov_get_estimator_type(msg);
  463. #else
  464. uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN;
  465. memset(global_position_int_cov, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
  466. memcpy(global_position_int_cov, _MAV_PAYLOAD(msg), len);
  467. #endif
  468. }