You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

459 lines
21 KiB

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