mavlink_msg_vk_formation_leader.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. #pragma once
  2. // MESSAGE VK_FORMATION_LEADER PACKING
  3. #define MAVLINK_MSG_ID_VK_FORMATION_LEADER 53004
  4. MAVPACKED(
  5. typedef struct __mavlink_vk_formation_leader_t {
  6. uint32_t timestamp; /*< [ms] Timestamp in ms from system boot.*/
  7. uint32_t state; /*< formation leader drone state bitmap*/
  8. int32_t lat; /*< [degE7] formation leader latitude in 1e-7deg */
  9. int32_t lon; /*< [degE7] formation leader longitude in 1e-7deg*/
  10. float msl; /*< [m] formation leader msl altitude in meter*/
  11. float ve; /*< [m/s] formation leader east speed*/
  12. float vn; /*< [m/s] formation leader north speed*/
  13. float vu; /*< [m/s] formation leader up speed*/
  14. float yaw; /*< [deg] formation leader yaw*/
  15. int16_t x_dist; /*< [cm] distance between drones in x axis*/
  16. int16_t y_dist; /*< [cm] distance between drones in y axis*/
  17. int16_t z_dist; /*< [cm] distance between drones in z axis*/
  18. uint16_t rect_col_num; /*< columns number of rectangle formation*/
  19. uint8_t formation_type; /*< formation type*/
  20. float formation_heading; /*< [deg] if nan, use yaw as formation heading*/
  21. float form_head_lock; /*< 0 unlock, 1 lock*/
  22. }) mavlink_vk_formation_leader_t;
  23. #define MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN 53
  24. #define MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN 45
  25. #define MAVLINK_MSG_ID_53004_LEN 53
  26. #define MAVLINK_MSG_ID_53004_MIN_LEN 45
  27. #define MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC 219
  28. #define MAVLINK_MSG_ID_53004_CRC 219
  29. #if MAVLINK_COMMAND_24BIT
  30. #define MAVLINK_MESSAGE_INFO_VK_FORMATION_LEADER { \
  31. 53004, \
  32. "VK_FORMATION_LEADER", \
  33. 16, \
  34. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_formation_leader_t, timestamp) }, \
  35. { "state", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_vk_formation_leader_t, state) }, \
  36. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_vk_formation_leader_t, lat) }, \
  37. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_vk_formation_leader_t, lon) }, \
  38. { "msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vk_formation_leader_t, msl) }, \
  39. { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vk_formation_leader_t, ve) }, \
  40. { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_vk_formation_leader_t, vn) }, \
  41. { "vu", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_vk_formation_leader_t, vu) }, \
  42. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_vk_formation_leader_t, yaw) }, \
  43. { "formation_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_vk_formation_leader_t, formation_type) }, \
  44. { "x_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_vk_formation_leader_t, x_dist) }, \
  45. { "y_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_vk_formation_leader_t, y_dist) }, \
  46. { "z_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_vk_formation_leader_t, z_dist) }, \
  47. { "rect_col_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_vk_formation_leader_t, rect_col_num) }, \
  48. { "formation_heading", NULL, MAVLINK_TYPE_FLOAT, 0, 45, offsetof(mavlink_vk_formation_leader_t, formation_heading) }, \
  49. { "form_head_lock", NULL, MAVLINK_TYPE_FLOAT, 0, 49, offsetof(mavlink_vk_formation_leader_t, form_head_lock) }, \
  50. } \
  51. }
  52. #else
  53. #define MAVLINK_MESSAGE_INFO_VK_FORMATION_LEADER { \
  54. "VK_FORMATION_LEADER", \
  55. 16, \
  56. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_formation_leader_t, timestamp) }, \
  57. { "state", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_vk_formation_leader_t, state) }, \
  58. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_vk_formation_leader_t, lat) }, \
  59. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_vk_formation_leader_t, lon) }, \
  60. { "msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vk_formation_leader_t, msl) }, \
  61. { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vk_formation_leader_t, ve) }, \
  62. { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_vk_formation_leader_t, vn) }, \
  63. { "vu", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_vk_formation_leader_t, vu) }, \
  64. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_vk_formation_leader_t, yaw) }, \
  65. { "formation_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_vk_formation_leader_t, formation_type) }, \
  66. { "x_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_vk_formation_leader_t, x_dist) }, \
  67. { "y_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_vk_formation_leader_t, y_dist) }, \
  68. { "z_dist", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_vk_formation_leader_t, z_dist) }, \
  69. { "rect_col_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_vk_formation_leader_t, rect_col_num) }, \
  70. { "formation_heading", NULL, MAVLINK_TYPE_FLOAT, 0, 45, offsetof(mavlink_vk_formation_leader_t, formation_heading) }, \
  71. { "form_head_lock", NULL, MAVLINK_TYPE_FLOAT, 0, 49, offsetof(mavlink_vk_formation_leader_t, form_head_lock) }, \
  72. } \
  73. }
  74. #endif
  75. /**
  76. * @brief Pack a vk_formation_leader message
  77. * @param system_id ID of this system
  78. * @param component_id ID of this component (e.g. 200 for IMU)
  79. * @param msg The MAVLink message to compress the data into
  80. *
  81. * @param timestamp [ms] Timestamp in ms from system boot.
  82. * @param state formation leader drone state bitmap
  83. * @param lat [degE7] formation leader latitude in 1e-7deg
  84. * @param lon [degE7] formation leader longitude in 1e-7deg
  85. * @param msl [m] formation leader msl altitude in meter
  86. * @param ve [m/s] formation leader east speed
  87. * @param vn [m/s] formation leader north speed
  88. * @param vu [m/s] formation leader up speed
  89. * @param yaw [deg] formation leader yaw
  90. * @param formation_type formation type
  91. * @param x_dist [cm] distance between drones in x axis
  92. * @param y_dist [cm] distance between drones in y axis
  93. * @param z_dist [cm] distance between drones in z axis
  94. * @param rect_col_num columns number of rectangle formation
  95. * @param formation_heading [deg] if nan, use yaw as formation heading
  96. * @param form_head_lock 0 unlock, 1 lock
  97. * @return length of the message in bytes (excluding serial stream start sign)
  98. */
  99. static inline uint16_t mavlink_msg_vk_formation_leader_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  100. uint32_t timestamp, uint32_t state, int32_t lat, int32_t lon, float msl, float ve, float vn, float vu, float yaw, uint8_t formation_type, int16_t x_dist, int16_t y_dist, int16_t z_dist, uint16_t rect_col_num, float formation_heading, float form_head_lock)
  101. {
  102. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  103. char buf[MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN];
  104. _mav_put_uint32_t(buf, 0, timestamp);
  105. _mav_put_uint32_t(buf, 4, state);
  106. _mav_put_int32_t(buf, 8, lat);
  107. _mav_put_int32_t(buf, 12, lon);
  108. _mav_put_float(buf, 16, msl);
  109. _mav_put_float(buf, 20, ve);
  110. _mav_put_float(buf, 24, vn);
  111. _mav_put_float(buf, 28, vu);
  112. _mav_put_float(buf, 32, yaw);
  113. _mav_put_int16_t(buf, 36, x_dist);
  114. _mav_put_int16_t(buf, 38, y_dist);
  115. _mav_put_int16_t(buf, 40, z_dist);
  116. _mav_put_uint16_t(buf, 42, rect_col_num);
  117. _mav_put_uint8_t(buf, 44, formation_type);
  118. _mav_put_float(buf, 45, formation_heading);
  119. _mav_put_float(buf, 49, form_head_lock);
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  121. #else
  122. mavlink_vk_formation_leader_t packet;
  123. packet.timestamp = timestamp;
  124. packet.state = state;
  125. packet.lat = lat;
  126. packet.lon = lon;
  127. packet.msl = msl;
  128. packet.ve = ve;
  129. packet.vn = vn;
  130. packet.vu = vu;
  131. packet.yaw = yaw;
  132. packet.x_dist = x_dist;
  133. packet.y_dist = y_dist;
  134. packet.z_dist = z_dist;
  135. packet.rect_col_num = rect_col_num;
  136. packet.formation_type = formation_type;
  137. packet.formation_heading = formation_heading;
  138. packet.form_head_lock = form_head_lock;
  139. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  140. #endif
  141. msg->msgid = MAVLINK_MSG_ID_VK_FORMATION_LEADER;
  142. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  143. }
  144. /**
  145. * @brief Pack a vk_formation_leader message
  146. * @param system_id ID of this system
  147. * @param component_id ID of this component (e.g. 200 for IMU)
  148. * @param status MAVLink status structure
  149. * @param msg The MAVLink message to compress the data into
  150. *
  151. * @param timestamp [ms] Timestamp in ms from system boot.
  152. * @param state formation leader drone state bitmap
  153. * @param lat [degE7] formation leader latitude in 1e-7deg
  154. * @param lon [degE7] formation leader longitude in 1e-7deg
  155. * @param msl [m] formation leader msl altitude in meter
  156. * @param ve [m/s] formation leader east speed
  157. * @param vn [m/s] formation leader north speed
  158. * @param vu [m/s] formation leader up speed
  159. * @param yaw [deg] formation leader yaw
  160. * @param formation_type formation type
  161. * @param x_dist [cm] distance between drones in x axis
  162. * @param y_dist [cm] distance between drones in y axis
  163. * @param z_dist [cm] distance between drones in z axis
  164. * @param rect_col_num columns number of rectangle formation
  165. * @param formation_heading [deg] if nan, use yaw as formation heading
  166. * @param form_head_lock 0 unlock, 1 lock
  167. * @return length of the message in bytes (excluding serial stream start sign)
  168. */
  169. static inline uint16_t mavlink_msg_vk_formation_leader_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  170. uint32_t timestamp, uint32_t state, int32_t lat, int32_t lon, float msl, float ve, float vn, float vu, float yaw, uint8_t formation_type, int16_t x_dist, int16_t y_dist, int16_t z_dist, uint16_t rect_col_num, float formation_heading, float form_head_lock)
  171. {
  172. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  173. char buf[MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN];
  174. _mav_put_uint32_t(buf, 0, timestamp);
  175. _mav_put_uint32_t(buf, 4, state);
  176. _mav_put_int32_t(buf, 8, lat);
  177. _mav_put_int32_t(buf, 12, lon);
  178. _mav_put_float(buf, 16, msl);
  179. _mav_put_float(buf, 20, ve);
  180. _mav_put_float(buf, 24, vn);
  181. _mav_put_float(buf, 28, vu);
  182. _mav_put_float(buf, 32, yaw);
  183. _mav_put_int16_t(buf, 36, x_dist);
  184. _mav_put_int16_t(buf, 38, y_dist);
  185. _mav_put_int16_t(buf, 40, z_dist);
  186. _mav_put_uint16_t(buf, 42, rect_col_num);
  187. _mav_put_uint8_t(buf, 44, formation_type);
  188. _mav_put_float(buf, 45, formation_heading);
  189. _mav_put_float(buf, 49, form_head_lock);
  190. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  191. #else
  192. mavlink_vk_formation_leader_t packet;
  193. packet.timestamp = timestamp;
  194. packet.state = state;
  195. packet.lat = lat;
  196. packet.lon = lon;
  197. packet.msl = msl;
  198. packet.ve = ve;
  199. packet.vn = vn;
  200. packet.vu = vu;
  201. packet.yaw = yaw;
  202. packet.x_dist = x_dist;
  203. packet.y_dist = y_dist;
  204. packet.z_dist = z_dist;
  205. packet.rect_col_num = rect_col_num;
  206. packet.formation_type = formation_type;
  207. packet.formation_heading = formation_heading;
  208. packet.form_head_lock = form_head_lock;
  209. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  210. #endif
  211. msg->msgid = MAVLINK_MSG_ID_VK_FORMATION_LEADER;
  212. #if MAVLINK_CRC_EXTRA
  213. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  214. #else
  215. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  216. #endif
  217. }
  218. /**
  219. * @brief Pack a vk_formation_leader message on a channel
  220. * @param system_id ID of this system
  221. * @param component_id ID of this component (e.g. 200 for IMU)
  222. * @param chan The MAVLink channel this message will be sent over
  223. * @param msg The MAVLink message to compress the data into
  224. * @param timestamp [ms] Timestamp in ms from system boot.
  225. * @param state formation leader drone state bitmap
  226. * @param lat [degE7] formation leader latitude in 1e-7deg
  227. * @param lon [degE7] formation leader longitude in 1e-7deg
  228. * @param msl [m] formation leader msl altitude in meter
  229. * @param ve [m/s] formation leader east speed
  230. * @param vn [m/s] formation leader north speed
  231. * @param vu [m/s] formation leader up speed
  232. * @param yaw [deg] formation leader yaw
  233. * @param formation_type formation type
  234. * @param x_dist [cm] distance between drones in x axis
  235. * @param y_dist [cm] distance between drones in y axis
  236. * @param z_dist [cm] distance between drones in z axis
  237. * @param rect_col_num columns number of rectangle formation
  238. * @param formation_heading [deg] if nan, use yaw as formation heading
  239. * @param form_head_lock 0 unlock, 1 lock
  240. * @return length of the message in bytes (excluding serial stream start sign)
  241. */
  242. static inline uint16_t mavlink_msg_vk_formation_leader_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  243. mavlink_message_t* msg,
  244. uint32_t timestamp,uint32_t state,int32_t lat,int32_t lon,float msl,float ve,float vn,float vu,float yaw,uint8_t formation_type,int16_t x_dist,int16_t y_dist,int16_t z_dist,uint16_t rect_col_num,float formation_heading,float form_head_lock)
  245. {
  246. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  247. char buf[MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN];
  248. _mav_put_uint32_t(buf, 0, timestamp);
  249. _mav_put_uint32_t(buf, 4, state);
  250. _mav_put_int32_t(buf, 8, lat);
  251. _mav_put_int32_t(buf, 12, lon);
  252. _mav_put_float(buf, 16, msl);
  253. _mav_put_float(buf, 20, ve);
  254. _mav_put_float(buf, 24, vn);
  255. _mav_put_float(buf, 28, vu);
  256. _mav_put_float(buf, 32, yaw);
  257. _mav_put_int16_t(buf, 36, x_dist);
  258. _mav_put_int16_t(buf, 38, y_dist);
  259. _mav_put_int16_t(buf, 40, z_dist);
  260. _mav_put_uint16_t(buf, 42, rect_col_num);
  261. _mav_put_uint8_t(buf, 44, formation_type);
  262. _mav_put_float(buf, 45, formation_heading);
  263. _mav_put_float(buf, 49, form_head_lock);
  264. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  265. #else
  266. mavlink_vk_formation_leader_t packet;
  267. packet.timestamp = timestamp;
  268. packet.state = state;
  269. packet.lat = lat;
  270. packet.lon = lon;
  271. packet.msl = msl;
  272. packet.ve = ve;
  273. packet.vn = vn;
  274. packet.vu = vu;
  275. packet.yaw = yaw;
  276. packet.x_dist = x_dist;
  277. packet.y_dist = y_dist;
  278. packet.z_dist = z_dist;
  279. packet.rect_col_num = rect_col_num;
  280. packet.formation_type = formation_type;
  281. packet.formation_heading = formation_heading;
  282. packet.form_head_lock = form_head_lock;
  283. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  284. #endif
  285. msg->msgid = MAVLINK_MSG_ID_VK_FORMATION_LEADER;
  286. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  287. }
  288. /**
  289. * @brief Encode a vk_formation_leader struct
  290. *
  291. * @param system_id ID of this system
  292. * @param component_id ID of this component (e.g. 200 for IMU)
  293. * @param msg The MAVLink message to compress the data into
  294. * @param vk_formation_leader C-struct to read the message contents from
  295. */
  296. static inline uint16_t mavlink_msg_vk_formation_leader_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_formation_leader_t* vk_formation_leader)
  297. {
  298. return mavlink_msg_vk_formation_leader_pack(system_id, component_id, msg, vk_formation_leader->timestamp, vk_formation_leader->state, vk_formation_leader->lat, vk_formation_leader->lon, vk_formation_leader->msl, vk_formation_leader->ve, vk_formation_leader->vn, vk_formation_leader->vu, vk_formation_leader->yaw, vk_formation_leader->formation_type, vk_formation_leader->x_dist, vk_formation_leader->y_dist, vk_formation_leader->z_dist, vk_formation_leader->rect_col_num, vk_formation_leader->formation_heading, vk_formation_leader->form_head_lock);
  299. }
  300. /**
  301. * @brief Encode a vk_formation_leader struct on a channel
  302. *
  303. * @param system_id ID of this system
  304. * @param component_id ID of this component (e.g. 200 for IMU)
  305. * @param chan The MAVLink channel this message will be sent over
  306. * @param msg The MAVLink message to compress the data into
  307. * @param vk_formation_leader C-struct to read the message contents from
  308. */
  309. static inline uint16_t mavlink_msg_vk_formation_leader_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_formation_leader_t* vk_formation_leader)
  310. {
  311. return mavlink_msg_vk_formation_leader_pack_chan(system_id, component_id, chan, msg, vk_formation_leader->timestamp, vk_formation_leader->state, vk_formation_leader->lat, vk_formation_leader->lon, vk_formation_leader->msl, vk_formation_leader->ve, vk_formation_leader->vn, vk_formation_leader->vu, vk_formation_leader->yaw, vk_formation_leader->formation_type, vk_formation_leader->x_dist, vk_formation_leader->y_dist, vk_formation_leader->z_dist, vk_formation_leader->rect_col_num, vk_formation_leader->formation_heading, vk_formation_leader->form_head_lock);
  312. }
  313. /**
  314. * @brief Encode a vk_formation_leader struct with provided status structure
  315. *
  316. * @param system_id ID of this system
  317. * @param component_id ID of this component (e.g. 200 for IMU)
  318. * @param status MAVLink status structure
  319. * @param msg The MAVLink message to compress the data into
  320. * @param vk_formation_leader C-struct to read the message contents from
  321. */
  322. static inline uint16_t mavlink_msg_vk_formation_leader_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_formation_leader_t* vk_formation_leader)
  323. {
  324. return mavlink_msg_vk_formation_leader_pack_status(system_id, component_id, _status, msg, vk_formation_leader->timestamp, vk_formation_leader->state, vk_formation_leader->lat, vk_formation_leader->lon, vk_formation_leader->msl, vk_formation_leader->ve, vk_formation_leader->vn, vk_formation_leader->vu, vk_formation_leader->yaw, vk_formation_leader->formation_type, vk_formation_leader->x_dist, vk_formation_leader->y_dist, vk_formation_leader->z_dist, vk_formation_leader->rect_col_num, vk_formation_leader->formation_heading, vk_formation_leader->form_head_lock);
  325. }
  326. /**
  327. * @brief Send a vk_formation_leader message
  328. * @param chan MAVLink channel to send the message
  329. *
  330. * @param timestamp [ms] Timestamp in ms from system boot.
  331. * @param state formation leader drone state bitmap
  332. * @param lat [degE7] formation leader latitude in 1e-7deg
  333. * @param lon [degE7] formation leader longitude in 1e-7deg
  334. * @param msl [m] formation leader msl altitude in meter
  335. * @param ve [m/s] formation leader east speed
  336. * @param vn [m/s] formation leader north speed
  337. * @param vu [m/s] formation leader up speed
  338. * @param yaw [deg] formation leader yaw
  339. * @param formation_type formation type
  340. * @param x_dist [cm] distance between drones in x axis
  341. * @param y_dist [cm] distance between drones in y axis
  342. * @param z_dist [cm] distance between drones in z axis
  343. * @param rect_col_num columns number of rectangle formation
  344. * @param formation_heading [deg] if nan, use yaw as formation heading
  345. * @param form_head_lock 0 unlock, 1 lock
  346. */
  347. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  348. static inline void mavlink_msg_vk_formation_leader_send(mavlink_channel_t chan, uint32_t timestamp, uint32_t state, int32_t lat, int32_t lon, float msl, float ve, float vn, float vu, float yaw, uint8_t formation_type, int16_t x_dist, int16_t y_dist, int16_t z_dist, uint16_t rect_col_num, float formation_heading, float form_head_lock)
  349. {
  350. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  351. char buf[MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN];
  352. _mav_put_uint32_t(buf, 0, timestamp);
  353. _mav_put_uint32_t(buf, 4, state);
  354. _mav_put_int32_t(buf, 8, lat);
  355. _mav_put_int32_t(buf, 12, lon);
  356. _mav_put_float(buf, 16, msl);
  357. _mav_put_float(buf, 20, ve);
  358. _mav_put_float(buf, 24, vn);
  359. _mav_put_float(buf, 28, vu);
  360. _mav_put_float(buf, 32, yaw);
  361. _mav_put_int16_t(buf, 36, x_dist);
  362. _mav_put_int16_t(buf, 38, y_dist);
  363. _mav_put_int16_t(buf, 40, z_dist);
  364. _mav_put_uint16_t(buf, 42, rect_col_num);
  365. _mav_put_uint8_t(buf, 44, formation_type);
  366. _mav_put_float(buf, 45, formation_heading);
  367. _mav_put_float(buf, 49, form_head_lock);
  368. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER, buf, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  369. #else
  370. mavlink_vk_formation_leader_t packet;
  371. packet.timestamp = timestamp;
  372. packet.state = state;
  373. packet.lat = lat;
  374. packet.lon = lon;
  375. packet.msl = msl;
  376. packet.ve = ve;
  377. packet.vn = vn;
  378. packet.vu = vu;
  379. packet.yaw = yaw;
  380. packet.x_dist = x_dist;
  381. packet.y_dist = y_dist;
  382. packet.z_dist = z_dist;
  383. packet.rect_col_num = rect_col_num;
  384. packet.formation_type = formation_type;
  385. packet.formation_heading = formation_heading;
  386. packet.form_head_lock = form_head_lock;
  387. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER, (const char *)&packet, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  388. #endif
  389. }
  390. /**
  391. * @brief Send a vk_formation_leader message
  392. * @param chan MAVLink channel to send the message
  393. * @param struct The MAVLink struct to serialize
  394. */
  395. static inline void mavlink_msg_vk_formation_leader_send_struct(mavlink_channel_t chan, const mavlink_vk_formation_leader_t* vk_formation_leader)
  396. {
  397. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  398. mavlink_msg_vk_formation_leader_send(chan, vk_formation_leader->timestamp, vk_formation_leader->state, vk_formation_leader->lat, vk_formation_leader->lon, vk_formation_leader->msl, vk_formation_leader->ve, vk_formation_leader->vn, vk_formation_leader->vu, vk_formation_leader->yaw, vk_formation_leader->formation_type, vk_formation_leader->x_dist, vk_formation_leader->y_dist, vk_formation_leader->z_dist, vk_formation_leader->rect_col_num, vk_formation_leader->formation_heading, vk_formation_leader->form_head_lock);
  399. #else
  400. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER, (const char *)vk_formation_leader, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  401. #endif
  402. }
  403. #if MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  404. /*
  405. This variant of _send() can be used to save stack space by re-using
  406. memory from the receive buffer. The caller provides a
  407. mavlink_message_t which is the size of a full mavlink message. This
  408. is usually the receive buffer for the channel, and allows a reply to an
  409. incoming message with minimum stack space usage.
  410. */
  411. static inline void mavlink_msg_vk_formation_leader_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t timestamp, uint32_t state, int32_t lat, int32_t lon, float msl, float ve, float vn, float vu, float yaw, uint8_t formation_type, int16_t x_dist, int16_t y_dist, int16_t z_dist, uint16_t rect_col_num, float formation_heading, float form_head_lock)
  412. {
  413. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  414. char *buf = (char *)msgbuf;
  415. _mav_put_uint32_t(buf, 0, timestamp);
  416. _mav_put_uint32_t(buf, 4, state);
  417. _mav_put_int32_t(buf, 8, lat);
  418. _mav_put_int32_t(buf, 12, lon);
  419. _mav_put_float(buf, 16, msl);
  420. _mav_put_float(buf, 20, ve);
  421. _mav_put_float(buf, 24, vn);
  422. _mav_put_float(buf, 28, vu);
  423. _mav_put_float(buf, 32, yaw);
  424. _mav_put_int16_t(buf, 36, x_dist);
  425. _mav_put_int16_t(buf, 38, y_dist);
  426. _mav_put_int16_t(buf, 40, z_dist);
  427. _mav_put_uint16_t(buf, 42, rect_col_num);
  428. _mav_put_uint8_t(buf, 44, formation_type);
  429. _mav_put_float(buf, 45, formation_heading);
  430. _mav_put_float(buf, 49, form_head_lock);
  431. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER, buf, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  432. #else
  433. mavlink_vk_formation_leader_t *packet = (mavlink_vk_formation_leader_t *)msgbuf;
  434. packet->timestamp = timestamp;
  435. packet->state = state;
  436. packet->lat = lat;
  437. packet->lon = lon;
  438. packet->msl = msl;
  439. packet->ve = ve;
  440. packet->vn = vn;
  441. packet->vu = vu;
  442. packet->yaw = yaw;
  443. packet->x_dist = x_dist;
  444. packet->y_dist = y_dist;
  445. packet->z_dist = z_dist;
  446. packet->rect_col_num = rect_col_num;
  447. packet->formation_type = formation_type;
  448. packet->formation_heading = formation_heading;
  449. packet->form_head_lock = form_head_lock;
  450. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_FORMATION_LEADER, (const char *)packet, MAVLINK_MSG_ID_VK_FORMATION_LEADER_MIN_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN, MAVLINK_MSG_ID_VK_FORMATION_LEADER_CRC);
  451. #endif
  452. }
  453. #endif
  454. #endif
  455. // MESSAGE VK_FORMATION_LEADER UNPACKING
  456. /**
  457. * @brief Get field timestamp from vk_formation_leader message
  458. *
  459. * @return [ms] Timestamp in ms from system boot.
  460. */
  461. static inline uint32_t mavlink_msg_vk_formation_leader_get_timestamp(const mavlink_message_t* msg)
  462. {
  463. return _MAV_RETURN_uint32_t(msg, 0);
  464. }
  465. /**
  466. * @brief Get field state from vk_formation_leader message
  467. *
  468. * @return formation leader drone state bitmap
  469. */
  470. static inline uint32_t mavlink_msg_vk_formation_leader_get_state(const mavlink_message_t* msg)
  471. {
  472. return _MAV_RETURN_uint32_t(msg, 4);
  473. }
  474. /**
  475. * @brief Get field lat from vk_formation_leader message
  476. *
  477. * @return [degE7] formation leader latitude in 1e-7deg
  478. */
  479. static inline int32_t mavlink_msg_vk_formation_leader_get_lat(const mavlink_message_t* msg)
  480. {
  481. return _MAV_RETURN_int32_t(msg, 8);
  482. }
  483. /**
  484. * @brief Get field lon from vk_formation_leader message
  485. *
  486. * @return [degE7] formation leader longitude in 1e-7deg
  487. */
  488. static inline int32_t mavlink_msg_vk_formation_leader_get_lon(const mavlink_message_t* msg)
  489. {
  490. return _MAV_RETURN_int32_t(msg, 12);
  491. }
  492. /**
  493. * @brief Get field msl from vk_formation_leader message
  494. *
  495. * @return [m] formation leader msl altitude in meter
  496. */
  497. static inline float mavlink_msg_vk_formation_leader_get_msl(const mavlink_message_t* msg)
  498. {
  499. return _MAV_RETURN_float(msg, 16);
  500. }
  501. /**
  502. * @brief Get field ve from vk_formation_leader message
  503. *
  504. * @return [m/s] formation leader east speed
  505. */
  506. static inline float mavlink_msg_vk_formation_leader_get_ve(const mavlink_message_t* msg)
  507. {
  508. return _MAV_RETURN_float(msg, 20);
  509. }
  510. /**
  511. * @brief Get field vn from vk_formation_leader message
  512. *
  513. * @return [m/s] formation leader north speed
  514. */
  515. static inline float mavlink_msg_vk_formation_leader_get_vn(const mavlink_message_t* msg)
  516. {
  517. return _MAV_RETURN_float(msg, 24);
  518. }
  519. /**
  520. * @brief Get field vu from vk_formation_leader message
  521. *
  522. * @return [m/s] formation leader up speed
  523. */
  524. static inline float mavlink_msg_vk_formation_leader_get_vu(const mavlink_message_t* msg)
  525. {
  526. return _MAV_RETURN_float(msg, 28);
  527. }
  528. /**
  529. * @brief Get field yaw from vk_formation_leader message
  530. *
  531. * @return [deg] formation leader yaw
  532. */
  533. static inline float mavlink_msg_vk_formation_leader_get_yaw(const mavlink_message_t* msg)
  534. {
  535. return _MAV_RETURN_float(msg, 32);
  536. }
  537. /**
  538. * @brief Get field formation_type from vk_formation_leader message
  539. *
  540. * @return formation type
  541. */
  542. static inline uint8_t mavlink_msg_vk_formation_leader_get_formation_type(const mavlink_message_t* msg)
  543. {
  544. return _MAV_RETURN_uint8_t(msg, 44);
  545. }
  546. /**
  547. * @brief Get field x_dist from vk_formation_leader message
  548. *
  549. * @return [cm] distance between drones in x axis
  550. */
  551. static inline int16_t mavlink_msg_vk_formation_leader_get_x_dist(const mavlink_message_t* msg)
  552. {
  553. return _MAV_RETURN_int16_t(msg, 36);
  554. }
  555. /**
  556. * @brief Get field y_dist from vk_formation_leader message
  557. *
  558. * @return [cm] distance between drones in y axis
  559. */
  560. static inline int16_t mavlink_msg_vk_formation_leader_get_y_dist(const mavlink_message_t* msg)
  561. {
  562. return _MAV_RETURN_int16_t(msg, 38);
  563. }
  564. /**
  565. * @brief Get field z_dist from vk_formation_leader message
  566. *
  567. * @return [cm] distance between drones in z axis
  568. */
  569. static inline int16_t mavlink_msg_vk_formation_leader_get_z_dist(const mavlink_message_t* msg)
  570. {
  571. return _MAV_RETURN_int16_t(msg, 40);
  572. }
  573. /**
  574. * @brief Get field rect_col_num from vk_formation_leader message
  575. *
  576. * @return columns number of rectangle formation
  577. */
  578. static inline uint16_t mavlink_msg_vk_formation_leader_get_rect_col_num(const mavlink_message_t* msg)
  579. {
  580. return _MAV_RETURN_uint16_t(msg, 42);
  581. }
  582. /**
  583. * @brief Get field formation_heading from vk_formation_leader message
  584. *
  585. * @return [deg] if nan, use yaw as formation heading
  586. */
  587. static inline float mavlink_msg_vk_formation_leader_get_formation_heading(const mavlink_message_t* msg)
  588. {
  589. return _MAV_RETURN_float(msg, 45);
  590. }
  591. /**
  592. * @brief Get field form_head_lock from vk_formation_leader message
  593. *
  594. * @return 0 unlock, 1 lock
  595. */
  596. static inline float mavlink_msg_vk_formation_leader_get_form_head_lock(const mavlink_message_t* msg)
  597. {
  598. return _MAV_RETURN_float(msg, 49);
  599. }
  600. /**
  601. * @brief Decode a vk_formation_leader message into a struct
  602. *
  603. * @param msg The message to decode
  604. * @param vk_formation_leader C-struct to decode the message contents into
  605. */
  606. static inline void mavlink_msg_vk_formation_leader_decode(const mavlink_message_t* msg, mavlink_vk_formation_leader_t* vk_formation_leader)
  607. {
  608. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  609. vk_formation_leader->timestamp = mavlink_msg_vk_formation_leader_get_timestamp(msg);
  610. vk_formation_leader->state = mavlink_msg_vk_formation_leader_get_state(msg);
  611. vk_formation_leader->lat = mavlink_msg_vk_formation_leader_get_lat(msg);
  612. vk_formation_leader->lon = mavlink_msg_vk_formation_leader_get_lon(msg);
  613. vk_formation_leader->msl = mavlink_msg_vk_formation_leader_get_msl(msg);
  614. vk_formation_leader->ve = mavlink_msg_vk_formation_leader_get_ve(msg);
  615. vk_formation_leader->vn = mavlink_msg_vk_formation_leader_get_vn(msg);
  616. vk_formation_leader->vu = mavlink_msg_vk_formation_leader_get_vu(msg);
  617. vk_formation_leader->yaw = mavlink_msg_vk_formation_leader_get_yaw(msg);
  618. vk_formation_leader->x_dist = mavlink_msg_vk_formation_leader_get_x_dist(msg);
  619. vk_formation_leader->y_dist = mavlink_msg_vk_formation_leader_get_y_dist(msg);
  620. vk_formation_leader->z_dist = mavlink_msg_vk_formation_leader_get_z_dist(msg);
  621. vk_formation_leader->rect_col_num = mavlink_msg_vk_formation_leader_get_rect_col_num(msg);
  622. vk_formation_leader->formation_type = mavlink_msg_vk_formation_leader_get_formation_type(msg);
  623. vk_formation_leader->formation_heading = mavlink_msg_vk_formation_leader_get_formation_heading(msg);
  624. vk_formation_leader->form_head_lock = mavlink_msg_vk_formation_leader_get_form_head_lock(msg);
  625. #else
  626. uint8_t len = msg->len < MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN? msg->len : MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN;
  627. memset(vk_formation_leader, 0, MAVLINK_MSG_ID_VK_FORMATION_LEADER_LEN);
  628. memcpy(vk_formation_leader, _MAV_PAYLOAD(msg), len);
  629. #endif
  630. }