mavlink_msg_follow_target.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. #pragma once
  2. // MESSAGE FOLLOW_TARGET PACKING
  3. #define MAVLINK_MSG_ID_FOLLOW_TARGET 144
  4. typedef struct __mavlink_follow_target_t {
  5. uint64_t timestamp; /*< [ms] Timestamp (time since system boot).*/
  6. uint64_t custom_state; /*< button states or switches of a tracker device*/
  7. int32_t lat; /*< [degE7] Latitude (WGS84)*/
  8. int32_t lon; /*< [degE7] Longitude (WGS84)*/
  9. float alt; /*< [m] Altitude (MSL)*/
  10. float vel[3]; /*< [m/s] target velocity (0,0,0) for unknown*/
  11. float acc[3]; /*< [m/s/s] linear target acceleration (0,0,0) for unknown*/
  12. float attitude_q[4]; /*< (0 0 0 0 for unknown)*/
  13. float rates[3]; /*< (0 0 0 for unknown)*/
  14. float position_cov[3]; /*< eph epv*/
  15. uint8_t est_capabilities; /*< bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)*/
  16. } mavlink_follow_target_t;
  17. #define MAVLINK_MSG_ID_FOLLOW_TARGET_LEN 93
  18. #define MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN 93
  19. #define MAVLINK_MSG_ID_144_LEN 93
  20. #define MAVLINK_MSG_ID_144_MIN_LEN 93
  21. #define MAVLINK_MSG_ID_FOLLOW_TARGET_CRC 127
  22. #define MAVLINK_MSG_ID_144_CRC 127
  23. #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_VEL_LEN 3
  24. #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ACC_LEN 3
  25. #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ATTITUDE_Q_LEN 4
  26. #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_RATES_LEN 3
  27. #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_POSITION_COV_LEN 3
  28. #if MAVLINK_COMMAND_24BIT
  29. #define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET { \
  30. 144, \
  31. "FOLLOW_TARGET", \
  32. 11, \
  33. { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) }, \
  34. { "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) }, \
  35. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) }, \
  36. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) }, \
  37. { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) }, \
  38. { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) }, \
  39. { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) }, \
  40. { "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) }, \
  41. { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) }, \
  42. { "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) }, \
  43. { "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) }, \
  44. } \
  45. }
  46. #else
  47. #define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET { \
  48. "FOLLOW_TARGET", \
  49. 11, \
  50. { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) }, \
  51. { "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) }, \
  52. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) }, \
  53. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) }, \
  54. { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) }, \
  55. { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) }, \
  56. { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) }, \
  57. { "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) }, \
  58. { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) }, \
  59. { "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) }, \
  60. { "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) }, \
  61. } \
  62. }
  63. #endif
  64. /**
  65. * @brief Pack a follow_target message
  66. * @param system_id ID of this system
  67. * @param component_id ID of this component (e.g. 200 for IMU)
  68. * @param msg The MAVLink message to compress the data into
  69. *
  70. * @param timestamp [ms] Timestamp (time since system boot).
  71. * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
  72. * @param lat [degE7] Latitude (WGS84)
  73. * @param lon [degE7] Longitude (WGS84)
  74. * @param alt [m] Altitude (MSL)
  75. * @param vel [m/s] target velocity (0,0,0) for unknown
  76. * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
  77. * @param attitude_q (0 0 0 0 for unknown)
  78. * @param rates (0 0 0 for unknown)
  79. * @param position_cov eph epv
  80. * @param custom_state button states or switches of a tracker device
  81. * @return length of the message in bytes (excluding serial stream start sign)
  82. */
  83. static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  84. uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
  85. {
  86. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  87. char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
  88. _mav_put_uint64_t(buf, 0, timestamp);
  89. _mav_put_uint64_t(buf, 8, custom_state);
  90. _mav_put_int32_t(buf, 16, lat);
  91. _mav_put_int32_t(buf, 20, lon);
  92. _mav_put_float(buf, 24, alt);
  93. _mav_put_uint8_t(buf, 92, est_capabilities);
  94. _mav_put_float_array(buf, 28, vel, 3);
  95. _mav_put_float_array(buf, 40, acc, 3);
  96. _mav_put_float_array(buf, 52, attitude_q, 4);
  97. _mav_put_float_array(buf, 68, rates, 3);
  98. _mav_put_float_array(buf, 80, position_cov, 3);
  99. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
  100. #else
  101. mavlink_follow_target_t packet;
  102. packet.timestamp = timestamp;
  103. packet.custom_state = custom_state;
  104. packet.lat = lat;
  105. packet.lon = lon;
  106. packet.alt = alt;
  107. packet.est_capabilities = est_capabilities;
  108. mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
  109. mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
  110. mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
  111. mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
  112. mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
  113. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
  114. #endif
  115. msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
  116. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  117. }
  118. /**
  119. * @brief Pack a follow_target message on a channel
  120. * @param system_id ID of this system
  121. * @param component_id ID of this component (e.g. 200 for IMU)
  122. * @param chan The MAVLink channel this message will be sent over
  123. * @param msg The MAVLink message to compress the data into
  124. * @param timestamp [ms] Timestamp (time since system boot).
  125. * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
  126. * @param lat [degE7] Latitude (WGS84)
  127. * @param lon [degE7] Longitude (WGS84)
  128. * @param alt [m] Altitude (MSL)
  129. * @param vel [m/s] target velocity (0,0,0) for unknown
  130. * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
  131. * @param attitude_q (0 0 0 0 for unknown)
  132. * @param rates (0 0 0 for unknown)
  133. * @param position_cov eph epv
  134. * @param custom_state button states or switches of a tracker device
  135. * @return length of the message in bytes (excluding serial stream start sign)
  136. */
  137. static inline uint16_t mavlink_msg_follow_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  138. mavlink_message_t* msg,
  139. uint64_t timestamp,uint8_t est_capabilities,int32_t lat,int32_t lon,float alt,const float *vel,const float *acc,const float *attitude_q,const float *rates,const float *position_cov,uint64_t custom_state)
  140. {
  141. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  142. char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
  143. _mav_put_uint64_t(buf, 0, timestamp);
  144. _mav_put_uint64_t(buf, 8, custom_state);
  145. _mav_put_int32_t(buf, 16, lat);
  146. _mav_put_int32_t(buf, 20, lon);
  147. _mav_put_float(buf, 24, alt);
  148. _mav_put_uint8_t(buf, 92, est_capabilities);
  149. _mav_put_float_array(buf, 28, vel, 3);
  150. _mav_put_float_array(buf, 40, acc, 3);
  151. _mav_put_float_array(buf, 52, attitude_q, 4);
  152. _mav_put_float_array(buf, 68, rates, 3);
  153. _mav_put_float_array(buf, 80, position_cov, 3);
  154. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
  155. #else
  156. mavlink_follow_target_t packet;
  157. packet.timestamp = timestamp;
  158. packet.custom_state = custom_state;
  159. packet.lat = lat;
  160. packet.lon = lon;
  161. packet.alt = alt;
  162. packet.est_capabilities = est_capabilities;
  163. mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
  164. mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
  165. mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
  166. mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
  167. mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
  168. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
  169. #endif
  170. msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
  171. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  172. }
  173. /**
  174. * @brief Encode a follow_target struct
  175. *
  176. * @param system_id ID of this system
  177. * @param component_id ID of this component (e.g. 200 for IMU)
  178. * @param msg The MAVLink message to compress the data into
  179. * @param follow_target C-struct to read the message contents from
  180. */
  181. static inline uint16_t mavlink_msg_follow_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
  182. {
  183. return mavlink_msg_follow_target_pack(system_id, component_id, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
  184. }
  185. /**
  186. * @brief Encode a follow_target struct on a channel
  187. *
  188. * @param system_id ID of this system
  189. * @param component_id ID of this component (e.g. 200 for IMU)
  190. * @param chan The MAVLink channel this message will be sent over
  191. * @param msg The MAVLink message to compress the data into
  192. * @param follow_target C-struct to read the message contents from
  193. */
  194. static inline uint16_t mavlink_msg_follow_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
  195. {
  196. return mavlink_msg_follow_target_pack_chan(system_id, component_id, chan, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
  197. }
  198. /**
  199. * @brief Send a follow_target message
  200. * @param chan MAVLink channel to send the message
  201. *
  202. * @param timestamp [ms] Timestamp (time since system boot).
  203. * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
  204. * @param lat [degE7] Latitude (WGS84)
  205. * @param lon [degE7] Longitude (WGS84)
  206. * @param alt [m] Altitude (MSL)
  207. * @param vel [m/s] target velocity (0,0,0) for unknown
  208. * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
  209. * @param attitude_q (0 0 0 0 for unknown)
  210. * @param rates (0 0 0 for unknown)
  211. * @param position_cov eph epv
  212. * @param custom_state button states or switches of a tracker device
  213. */
  214. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  215. static inline void mavlink_msg_follow_target_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
  216. {
  217. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  218. char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
  219. _mav_put_uint64_t(buf, 0, timestamp);
  220. _mav_put_uint64_t(buf, 8, custom_state);
  221. _mav_put_int32_t(buf, 16, lat);
  222. _mav_put_int32_t(buf, 20, lon);
  223. _mav_put_float(buf, 24, alt);
  224. _mav_put_uint8_t(buf, 92, est_capabilities);
  225. _mav_put_float_array(buf, 28, vel, 3);
  226. _mav_put_float_array(buf, 40, acc, 3);
  227. _mav_put_float_array(buf, 52, attitude_q, 4);
  228. _mav_put_float_array(buf, 68, rates, 3);
  229. _mav_put_float_array(buf, 80, position_cov, 3);
  230. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  231. #else
  232. mavlink_follow_target_t packet;
  233. packet.timestamp = timestamp;
  234. packet.custom_state = custom_state;
  235. packet.lat = lat;
  236. packet.lon = lon;
  237. packet.alt = alt;
  238. packet.est_capabilities = est_capabilities;
  239. mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
  240. mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
  241. mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
  242. mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
  243. mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
  244. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  245. #endif
  246. }
  247. /**
  248. * @brief Send a follow_target message
  249. * @param chan MAVLink channel to send the message
  250. * @param struct The MAVLink struct to serialize
  251. */
  252. static inline void mavlink_msg_follow_target_send_struct(mavlink_channel_t chan, const mavlink_follow_target_t* follow_target)
  253. {
  254. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  255. mavlink_msg_follow_target_send(chan, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
  256. #else
  257. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)follow_target, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  258. #endif
  259. }
  260. #if MAVLINK_MSG_ID_FOLLOW_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  261. /*
  262. This variant of _send() can be used to save stack space by re-using
  263. memory from the receive buffer. The caller provides a
  264. mavlink_message_t which is the size of a full mavlink message. This
  265. is usually the receive buffer for the channel, and allows a reply to an
  266. incoming message with minimum stack space usage.
  267. */
  268. static inline void mavlink_msg_follow_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
  269. {
  270. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  271. char *buf = (char *)msgbuf;
  272. _mav_put_uint64_t(buf, 0, timestamp);
  273. _mav_put_uint64_t(buf, 8, custom_state);
  274. _mav_put_int32_t(buf, 16, lat);
  275. _mav_put_int32_t(buf, 20, lon);
  276. _mav_put_float(buf, 24, alt);
  277. _mav_put_uint8_t(buf, 92, est_capabilities);
  278. _mav_put_float_array(buf, 28, vel, 3);
  279. _mav_put_float_array(buf, 40, acc, 3);
  280. _mav_put_float_array(buf, 52, attitude_q, 4);
  281. _mav_put_float_array(buf, 68, rates, 3);
  282. _mav_put_float_array(buf, 80, position_cov, 3);
  283. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  284. #else
  285. mavlink_follow_target_t *packet = (mavlink_follow_target_t *)msgbuf;
  286. packet->timestamp = timestamp;
  287. packet->custom_state = custom_state;
  288. packet->lat = lat;
  289. packet->lon = lon;
  290. packet->alt = alt;
  291. packet->est_capabilities = est_capabilities;
  292. mav_array_memcpy(packet->vel, vel, sizeof(float)*3);
  293. mav_array_memcpy(packet->acc, acc, sizeof(float)*3);
  294. mav_array_memcpy(packet->attitude_q, attitude_q, sizeof(float)*4);
  295. mav_array_memcpy(packet->rates, rates, sizeof(float)*3);
  296. mav_array_memcpy(packet->position_cov, position_cov, sizeof(float)*3);
  297. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
  298. #endif
  299. }
  300. #endif
  301. #endif
  302. // MESSAGE FOLLOW_TARGET UNPACKING
  303. /**
  304. * @brief Get field timestamp from follow_target message
  305. *
  306. * @return [ms] Timestamp (time since system boot).
  307. */
  308. static inline uint64_t mavlink_msg_follow_target_get_timestamp(const mavlink_message_t* msg)
  309. {
  310. return _MAV_RETURN_uint64_t(msg, 0);
  311. }
  312. /**
  313. * @brief Get field est_capabilities from follow_target message
  314. *
  315. * @return bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
  316. */
  317. static inline uint8_t mavlink_msg_follow_target_get_est_capabilities(const mavlink_message_t* msg)
  318. {
  319. return _MAV_RETURN_uint8_t(msg, 92);
  320. }
  321. /**
  322. * @brief Get field lat from follow_target message
  323. *
  324. * @return [degE7] Latitude (WGS84)
  325. */
  326. static inline int32_t mavlink_msg_follow_target_get_lat(const mavlink_message_t* msg)
  327. {
  328. return _MAV_RETURN_int32_t(msg, 16);
  329. }
  330. /**
  331. * @brief Get field lon from follow_target message
  332. *
  333. * @return [degE7] Longitude (WGS84)
  334. */
  335. static inline int32_t mavlink_msg_follow_target_get_lon(const mavlink_message_t* msg)
  336. {
  337. return _MAV_RETURN_int32_t(msg, 20);
  338. }
  339. /**
  340. * @brief Get field alt from follow_target message
  341. *
  342. * @return [m] Altitude (MSL)
  343. */
  344. static inline float mavlink_msg_follow_target_get_alt(const mavlink_message_t* msg)
  345. {
  346. return _MAV_RETURN_float(msg, 24);
  347. }
  348. /**
  349. * @brief Get field vel from follow_target message
  350. *
  351. * @return [m/s] target velocity (0,0,0) for unknown
  352. */
  353. static inline uint16_t mavlink_msg_follow_target_get_vel(const mavlink_message_t* msg, float *vel)
  354. {
  355. return _MAV_RETURN_float_array(msg, vel, 3, 28);
  356. }
  357. /**
  358. * @brief Get field acc from follow_target message
  359. *
  360. * @return [m/s/s] linear target acceleration (0,0,0) for unknown
  361. */
  362. static inline uint16_t mavlink_msg_follow_target_get_acc(const mavlink_message_t* msg, float *acc)
  363. {
  364. return _MAV_RETURN_float_array(msg, acc, 3, 40);
  365. }
  366. /**
  367. * @brief Get field attitude_q from follow_target message
  368. *
  369. * @return (0 0 0 0 for unknown)
  370. */
  371. static inline uint16_t mavlink_msg_follow_target_get_attitude_q(const mavlink_message_t* msg, float *attitude_q)
  372. {
  373. return _MAV_RETURN_float_array(msg, attitude_q, 4, 52);
  374. }
  375. /**
  376. * @brief Get field rates from follow_target message
  377. *
  378. * @return (0 0 0 for unknown)
  379. */
  380. static inline uint16_t mavlink_msg_follow_target_get_rates(const mavlink_message_t* msg, float *rates)
  381. {
  382. return _MAV_RETURN_float_array(msg, rates, 3, 68);
  383. }
  384. /**
  385. * @brief Get field position_cov from follow_target message
  386. *
  387. * @return eph epv
  388. */
  389. static inline uint16_t mavlink_msg_follow_target_get_position_cov(const mavlink_message_t* msg, float *position_cov)
  390. {
  391. return _MAV_RETURN_float_array(msg, position_cov, 3, 80);
  392. }
  393. /**
  394. * @brief Get field custom_state from follow_target message
  395. *
  396. * @return button states or switches of a tracker device
  397. */
  398. static inline uint64_t mavlink_msg_follow_target_get_custom_state(const mavlink_message_t* msg)
  399. {
  400. return _MAV_RETURN_uint64_t(msg, 8);
  401. }
  402. /**
  403. * @brief Decode a follow_target message into a struct
  404. *
  405. * @param msg The message to decode
  406. * @param follow_target C-struct to decode the message contents into
  407. */
  408. static inline void mavlink_msg_follow_target_decode(const mavlink_message_t* msg, mavlink_follow_target_t* follow_target)
  409. {
  410. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  411. follow_target->timestamp = mavlink_msg_follow_target_get_timestamp(msg);
  412. follow_target->custom_state = mavlink_msg_follow_target_get_custom_state(msg);
  413. follow_target->lat = mavlink_msg_follow_target_get_lat(msg);
  414. follow_target->lon = mavlink_msg_follow_target_get_lon(msg);
  415. follow_target->alt = mavlink_msg_follow_target_get_alt(msg);
  416. mavlink_msg_follow_target_get_vel(msg, follow_target->vel);
  417. mavlink_msg_follow_target_get_acc(msg, follow_target->acc);
  418. mavlink_msg_follow_target_get_attitude_q(msg, follow_target->attitude_q);
  419. mavlink_msg_follow_target_get_rates(msg, follow_target->rates);
  420. mavlink_msg_follow_target_get_position_cov(msg, follow_target->position_cov);
  421. follow_target->est_capabilities = mavlink_msg_follow_target_get_est_capabilities(msg);
  422. #else
  423. uint8_t len = msg->len < MAVLINK_MSG_ID_FOLLOW_TARGET_LEN? msg->len : MAVLINK_MSG_ID_FOLLOW_TARGET_LEN;
  424. memset(follow_target, 0, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
  425. memcpy(follow_target, _MAV_PAYLOAD(msg), len);
  426. #endif
  427. }