mavlink_msg_mission_item.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. #pragma once
  2. // MESSAGE MISSION_ITEM PACKING
  3. #define MAVLINK_MSG_ID_MISSION_ITEM 39
  4. typedef struct __mavlink_mission_item_t {
  5. float param1; /*< PARAM1, see MAV_CMD enum*/
  6. float param2; /*< PARAM2, see MAV_CMD enum*/
  7. float param3; /*< PARAM3, see MAV_CMD enum*/
  8. float param4; /*< PARAM4, see MAV_CMD enum*/
  9. float x; /*< PARAM5 / local: X coordinate, global: latitude*/
  10. float y; /*< PARAM6 / local: Y coordinate, global: longitude*/
  11. float z; /*< PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).*/
  12. uint16_t seq; /*< Sequence*/
  13. uint16_t command; /*< The scheduled action for the waypoint.*/
  14. uint8_t target_system; /*< System ID*/
  15. uint8_t target_component; /*< Component ID*/
  16. uint8_t frame; /*< The coordinate system of the waypoint.*/
  17. uint8_t current; /*< false:0, true:1*/
  18. uint8_t autocontinue; /*< Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.*/
  19. uint8_t mission_type; /*< Mission type.*/
  20. } mavlink_mission_item_t;
  21. #define MAVLINK_MSG_ID_MISSION_ITEM_LEN 38
  22. #define MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN 37
  23. #define MAVLINK_MSG_ID_39_LEN 38
  24. #define MAVLINK_MSG_ID_39_MIN_LEN 37
  25. #define MAVLINK_MSG_ID_MISSION_ITEM_CRC 254
  26. #define MAVLINK_MSG_ID_39_CRC 254
  27. #if MAVLINK_COMMAND_24BIT
  28. #define MAVLINK_MESSAGE_INFO_MISSION_ITEM { \
  29. 39, \
  30. "MISSION_ITEM", \
  31. 15, \
  32. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_mission_item_t, target_system) }, \
  33. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_mission_item_t, target_component) }, \
  34. { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_mission_item_t, seq) }, \
  35. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_mission_item_t, frame) }, \
  36. { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_mission_item_t, command) }, \
  37. { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_mission_item_t, current) }, \
  38. { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_mission_item_t, autocontinue) }, \
  39. { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mission_item_t, param1) }, \
  40. { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mission_item_t, param2) }, \
  41. { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mission_item_t, param3) }, \
  42. { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mission_item_t, param4) }, \
  43. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mission_item_t, x) }, \
  44. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mission_item_t, y) }, \
  45. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mission_item_t, z) }, \
  46. { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_mission_item_t, mission_type) }, \
  47. } \
  48. }
  49. #else
  50. #define MAVLINK_MESSAGE_INFO_MISSION_ITEM { \
  51. "MISSION_ITEM", \
  52. 15, \
  53. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_mission_item_t, target_system) }, \
  54. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_mission_item_t, target_component) }, \
  55. { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_mission_item_t, seq) }, \
  56. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_mission_item_t, frame) }, \
  57. { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_mission_item_t, command) }, \
  58. { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_mission_item_t, current) }, \
  59. { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_mission_item_t, autocontinue) }, \
  60. { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mission_item_t, param1) }, \
  61. { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mission_item_t, param2) }, \
  62. { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mission_item_t, param3) }, \
  63. { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mission_item_t, param4) }, \
  64. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mission_item_t, x) }, \
  65. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mission_item_t, y) }, \
  66. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mission_item_t, z) }, \
  67. { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_mission_item_t, mission_type) }, \
  68. } \
  69. }
  70. #endif
  71. /**
  72. * @brief Pack a mission_item message
  73. * @param system_id ID of this system
  74. * @param component_id ID of this component (e.g. 200 for IMU)
  75. * @param msg The MAVLink message to compress the data into
  76. *
  77. * @param target_system System ID
  78. * @param target_component Component ID
  79. * @param seq Sequence
  80. * @param frame The coordinate system of the waypoint.
  81. * @param command The scheduled action for the waypoint.
  82. * @param current false:0, true:1
  83. * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
  84. * @param param1 PARAM1, see MAV_CMD enum
  85. * @param param2 PARAM2, see MAV_CMD enum
  86. * @param param3 PARAM3, see MAV_CMD enum
  87. * @param param4 PARAM4, see MAV_CMD enum
  88. * @param x PARAM5 / local: X coordinate, global: latitude
  89. * @param y PARAM6 / local: Y coordinate, global: longitude
  90. * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
  91. * @param mission_type Mission type.
  92. * @return length of the message in bytes (excluding serial stream start sign)
  93. */
  94. static inline uint16_t mavlink_msg_mission_item_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  95. uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z, uint8_t mission_type)
  96. {
  97. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  98. char buf[MAVLINK_MSG_ID_MISSION_ITEM_LEN];
  99. _mav_put_float(buf, 0, param1);
  100. _mav_put_float(buf, 4, param2);
  101. _mav_put_float(buf, 8, param3);
  102. _mav_put_float(buf, 12, param4);
  103. _mav_put_float(buf, 16, x);
  104. _mav_put_float(buf, 20, y);
  105. _mav_put_float(buf, 24, z);
  106. _mav_put_uint16_t(buf, 28, seq);
  107. _mav_put_uint16_t(buf, 30, command);
  108. _mav_put_uint8_t(buf, 32, target_system);
  109. _mav_put_uint8_t(buf, 33, target_component);
  110. _mav_put_uint8_t(buf, 34, frame);
  111. _mav_put_uint8_t(buf, 35, current);
  112. _mav_put_uint8_t(buf, 36, autocontinue);
  113. _mav_put_uint8_t(buf, 37, mission_type);
  114. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
  115. #else
  116. mavlink_mission_item_t packet;
  117. packet.param1 = param1;
  118. packet.param2 = param2;
  119. packet.param3 = param3;
  120. packet.param4 = param4;
  121. packet.x = x;
  122. packet.y = y;
  123. packet.z = z;
  124. packet.seq = seq;
  125. packet.command = command;
  126. packet.target_system = target_system;
  127. packet.target_component = target_component;
  128. packet.frame = frame;
  129. packet.current = current;
  130. packet.autocontinue = autocontinue;
  131. packet.mission_type = mission_type;
  132. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
  133. #endif
  134. msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
  135. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  136. }
  137. /**
  138. * @brief Pack a mission_item message on a channel
  139. * @param system_id ID of this system
  140. * @param component_id ID of this component (e.g. 200 for IMU)
  141. * @param chan The MAVLink channel this message will be sent over
  142. * @param msg The MAVLink message to compress the data into
  143. * @param target_system System ID
  144. * @param target_component Component ID
  145. * @param seq Sequence
  146. * @param frame The coordinate system of the waypoint.
  147. * @param command The scheduled action for the waypoint.
  148. * @param current false:0, true:1
  149. * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
  150. * @param param1 PARAM1, see MAV_CMD enum
  151. * @param param2 PARAM2, see MAV_CMD enum
  152. * @param param3 PARAM3, see MAV_CMD enum
  153. * @param param4 PARAM4, see MAV_CMD enum
  154. * @param x PARAM5 / local: X coordinate, global: latitude
  155. * @param y PARAM6 / local: Y coordinate, global: longitude
  156. * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
  157. * @param mission_type Mission type.
  158. * @return length of the message in bytes (excluding serial stream start sign)
  159. */
  160. static inline uint16_t mavlink_msg_mission_item_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  161. mavlink_message_t* msg,
  162. uint8_t target_system,uint8_t target_component,uint16_t seq,uint8_t frame,uint16_t command,uint8_t current,uint8_t autocontinue,float param1,float param2,float param3,float param4,float x,float y,float z,uint8_t mission_type)
  163. {
  164. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  165. char buf[MAVLINK_MSG_ID_MISSION_ITEM_LEN];
  166. _mav_put_float(buf, 0, param1);
  167. _mav_put_float(buf, 4, param2);
  168. _mav_put_float(buf, 8, param3);
  169. _mav_put_float(buf, 12, param4);
  170. _mav_put_float(buf, 16, x);
  171. _mav_put_float(buf, 20, y);
  172. _mav_put_float(buf, 24, z);
  173. _mav_put_uint16_t(buf, 28, seq);
  174. _mav_put_uint16_t(buf, 30, command);
  175. _mav_put_uint8_t(buf, 32, target_system);
  176. _mav_put_uint8_t(buf, 33, target_component);
  177. _mav_put_uint8_t(buf, 34, frame);
  178. _mav_put_uint8_t(buf, 35, current);
  179. _mav_put_uint8_t(buf, 36, autocontinue);
  180. _mav_put_uint8_t(buf, 37, mission_type);
  181. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
  182. #else
  183. mavlink_mission_item_t packet;
  184. packet.param1 = param1;
  185. packet.param2 = param2;
  186. packet.param3 = param3;
  187. packet.param4 = param4;
  188. packet.x = x;
  189. packet.y = y;
  190. packet.z = z;
  191. packet.seq = seq;
  192. packet.command = command;
  193. packet.target_system = target_system;
  194. packet.target_component = target_component;
  195. packet.frame = frame;
  196. packet.current = current;
  197. packet.autocontinue = autocontinue;
  198. packet.mission_type = mission_type;
  199. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
  200. #endif
  201. msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
  202. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  203. }
  204. /**
  205. * @brief Encode a mission_item struct
  206. *
  207. * @param system_id ID of this system
  208. * @param component_id ID of this component (e.g. 200 for IMU)
  209. * @param msg The MAVLink message to compress the data into
  210. * @param mission_item C-struct to read the message contents from
  211. */
  212. static inline uint16_t mavlink_msg_mission_item_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_item_t* mission_item)
  213. {
  214. return mavlink_msg_mission_item_pack(system_id, component_id, msg, mission_item->target_system, mission_item->target_component, mission_item->seq, mission_item->frame, mission_item->command, mission_item->current, mission_item->autocontinue, mission_item->param1, mission_item->param2, mission_item->param3, mission_item->param4, mission_item->x, mission_item->y, mission_item->z, mission_item->mission_type);
  215. }
  216. /**
  217. * @brief Encode a mission_item struct on a channel
  218. *
  219. * @param system_id ID of this system
  220. * @param component_id ID of this component (e.g. 200 for IMU)
  221. * @param chan The MAVLink channel this message will be sent over
  222. * @param msg The MAVLink message to compress the data into
  223. * @param mission_item C-struct to read the message contents from
  224. */
  225. static inline uint16_t mavlink_msg_mission_item_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_item_t* mission_item)
  226. {
  227. return mavlink_msg_mission_item_pack_chan(system_id, component_id, chan, msg, mission_item->target_system, mission_item->target_component, mission_item->seq, mission_item->frame, mission_item->command, mission_item->current, mission_item->autocontinue, mission_item->param1, mission_item->param2, mission_item->param3, mission_item->param4, mission_item->x, mission_item->y, mission_item->z, mission_item->mission_type);
  228. }
  229. /**
  230. * @brief Send a mission_item message
  231. * @param chan MAVLink channel to send the message
  232. *
  233. * @param target_system System ID
  234. * @param target_component Component ID
  235. * @param seq Sequence
  236. * @param frame The coordinate system of the waypoint.
  237. * @param command The scheduled action for the waypoint.
  238. * @param current false:0, true:1
  239. * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
  240. * @param param1 PARAM1, see MAV_CMD enum
  241. * @param param2 PARAM2, see MAV_CMD enum
  242. * @param param3 PARAM3, see MAV_CMD enum
  243. * @param param4 PARAM4, see MAV_CMD enum
  244. * @param x PARAM5 / local: X coordinate, global: latitude
  245. * @param y PARAM6 / local: Y coordinate, global: longitude
  246. * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
  247. * @param mission_type Mission type.
  248. */
  249. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  250. static inline void mavlink_msg_mission_item_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z, uint8_t mission_type)
  251. {
  252. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  253. char buf[MAVLINK_MSG_ID_MISSION_ITEM_LEN];
  254. _mav_put_float(buf, 0, param1);
  255. _mav_put_float(buf, 4, param2);
  256. _mav_put_float(buf, 8, param3);
  257. _mav_put_float(buf, 12, param4);
  258. _mav_put_float(buf, 16, x);
  259. _mav_put_float(buf, 20, y);
  260. _mav_put_float(buf, 24, z);
  261. _mav_put_uint16_t(buf, 28, seq);
  262. _mav_put_uint16_t(buf, 30, command);
  263. _mav_put_uint8_t(buf, 32, target_system);
  264. _mav_put_uint8_t(buf, 33, target_component);
  265. _mav_put_uint8_t(buf, 34, frame);
  266. _mav_put_uint8_t(buf, 35, current);
  267. _mav_put_uint8_t(buf, 36, autocontinue);
  268. _mav_put_uint8_t(buf, 37, mission_type);
  269. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, buf, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  270. #else
  271. mavlink_mission_item_t packet;
  272. packet.param1 = param1;
  273. packet.param2 = param2;
  274. packet.param3 = param3;
  275. packet.param4 = param4;
  276. packet.x = x;
  277. packet.y = y;
  278. packet.z = z;
  279. packet.seq = seq;
  280. packet.command = command;
  281. packet.target_system = target_system;
  282. packet.target_component = target_component;
  283. packet.frame = frame;
  284. packet.current = current;
  285. packet.autocontinue = autocontinue;
  286. packet.mission_type = mission_type;
  287. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, (const char *)&packet, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  288. #endif
  289. }
  290. /**
  291. * @brief Send a mission_item message
  292. * @param chan MAVLink channel to send the message
  293. * @param struct The MAVLink struct to serialize
  294. */
  295. static inline void mavlink_msg_mission_item_send_struct(mavlink_channel_t chan, const mavlink_mission_item_t* mission_item)
  296. {
  297. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  298. mavlink_msg_mission_item_send(chan, mission_item->target_system, mission_item->target_component, mission_item->seq, mission_item->frame, mission_item->command, mission_item->current, mission_item->autocontinue, mission_item->param1, mission_item->param2, mission_item->param3, mission_item->param4, mission_item->x, mission_item->y, mission_item->z, mission_item->mission_type);
  299. #else
  300. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, (const char *)mission_item, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  301. #endif
  302. }
  303. #if MAVLINK_MSG_ID_MISSION_ITEM_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  304. /*
  305. This variant of _send() can be used to save stack space by re-using
  306. memory from the receive buffer. The caller provides a
  307. mavlink_message_t which is the size of a full mavlink message. This
  308. is usually the receive buffer for the channel, and allows a reply to an
  309. incoming message with minimum stack space usage.
  310. */
  311. static inline void mavlink_msg_mission_item_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, float x, float y, float z, uint8_t mission_type)
  312. {
  313. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  314. char *buf = (char *)msgbuf;
  315. _mav_put_float(buf, 0, param1);
  316. _mav_put_float(buf, 4, param2);
  317. _mav_put_float(buf, 8, param3);
  318. _mav_put_float(buf, 12, param4);
  319. _mav_put_float(buf, 16, x);
  320. _mav_put_float(buf, 20, y);
  321. _mav_put_float(buf, 24, z);
  322. _mav_put_uint16_t(buf, 28, seq);
  323. _mav_put_uint16_t(buf, 30, command);
  324. _mav_put_uint8_t(buf, 32, target_system);
  325. _mav_put_uint8_t(buf, 33, target_component);
  326. _mav_put_uint8_t(buf, 34, frame);
  327. _mav_put_uint8_t(buf, 35, current);
  328. _mav_put_uint8_t(buf, 36, autocontinue);
  329. _mav_put_uint8_t(buf, 37, mission_type);
  330. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, buf, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  331. #else
  332. mavlink_mission_item_t *packet = (mavlink_mission_item_t *)msgbuf;
  333. packet->param1 = param1;
  334. packet->param2 = param2;
  335. packet->param3 = param3;
  336. packet->param4 = param4;
  337. packet->x = x;
  338. packet->y = y;
  339. packet->z = z;
  340. packet->seq = seq;
  341. packet->command = command;
  342. packet->target_system = target_system;
  343. packet->target_component = target_component;
  344. packet->frame = frame;
  345. packet->current = current;
  346. packet->autocontinue = autocontinue;
  347. packet->mission_type = mission_type;
  348. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, (const char *)packet, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
  349. #endif
  350. }
  351. #endif
  352. #endif
  353. // MESSAGE MISSION_ITEM UNPACKING
  354. /**
  355. * @brief Get field target_system from mission_item message
  356. *
  357. * @return System ID
  358. */
  359. static inline uint8_t mavlink_msg_mission_item_get_target_system(const mavlink_message_t* msg)
  360. {
  361. return _MAV_RETURN_uint8_t(msg, 32);
  362. }
  363. /**
  364. * @brief Get field target_component from mission_item message
  365. *
  366. * @return Component ID
  367. */
  368. static inline uint8_t mavlink_msg_mission_item_get_target_component(const mavlink_message_t* msg)
  369. {
  370. return _MAV_RETURN_uint8_t(msg, 33);
  371. }
  372. /**
  373. * @brief Get field seq from mission_item message
  374. *
  375. * @return Sequence
  376. */
  377. static inline uint16_t mavlink_msg_mission_item_get_seq(const mavlink_message_t* msg)
  378. {
  379. return _MAV_RETURN_uint16_t(msg, 28);
  380. }
  381. /**
  382. * @brief Get field frame from mission_item message
  383. *
  384. * @return The coordinate system of the waypoint.
  385. */
  386. static inline uint8_t mavlink_msg_mission_item_get_frame(const mavlink_message_t* msg)
  387. {
  388. return _MAV_RETURN_uint8_t(msg, 34);
  389. }
  390. /**
  391. * @brief Get field command from mission_item message
  392. *
  393. * @return The scheduled action for the waypoint.
  394. */
  395. static inline uint16_t mavlink_msg_mission_item_get_command(const mavlink_message_t* msg)
  396. {
  397. return _MAV_RETURN_uint16_t(msg, 30);
  398. }
  399. /**
  400. * @brief Get field current from mission_item message
  401. *
  402. * @return false:0, true:1
  403. */
  404. static inline uint8_t mavlink_msg_mission_item_get_current(const mavlink_message_t* msg)
  405. {
  406. return _MAV_RETURN_uint8_t(msg, 35);
  407. }
  408. /**
  409. * @brief Get field autocontinue from mission_item message
  410. *
  411. * @return Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
  412. */
  413. static inline uint8_t mavlink_msg_mission_item_get_autocontinue(const mavlink_message_t* msg)
  414. {
  415. return _MAV_RETURN_uint8_t(msg, 36);
  416. }
  417. /**
  418. * @brief Get field param1 from mission_item message
  419. *
  420. * @return PARAM1, see MAV_CMD enum
  421. */
  422. static inline float mavlink_msg_mission_item_get_param1(const mavlink_message_t* msg)
  423. {
  424. return _MAV_RETURN_float(msg, 0);
  425. }
  426. /**
  427. * @brief Get field param2 from mission_item message
  428. *
  429. * @return PARAM2, see MAV_CMD enum
  430. */
  431. static inline float mavlink_msg_mission_item_get_param2(const mavlink_message_t* msg)
  432. {
  433. return _MAV_RETURN_float(msg, 4);
  434. }
  435. /**
  436. * @brief Get field param3 from mission_item message
  437. *
  438. * @return PARAM3, see MAV_CMD enum
  439. */
  440. static inline float mavlink_msg_mission_item_get_param3(const mavlink_message_t* msg)
  441. {
  442. return _MAV_RETURN_float(msg, 8);
  443. }
  444. /**
  445. * @brief Get field param4 from mission_item message
  446. *
  447. * @return PARAM4, see MAV_CMD enum
  448. */
  449. static inline float mavlink_msg_mission_item_get_param4(const mavlink_message_t* msg)
  450. {
  451. return _MAV_RETURN_float(msg, 12);
  452. }
  453. /**
  454. * @brief Get field x from mission_item message
  455. *
  456. * @return PARAM5 / local: X coordinate, global: latitude
  457. */
  458. static inline float mavlink_msg_mission_item_get_x(const mavlink_message_t* msg)
  459. {
  460. return _MAV_RETURN_float(msg, 16);
  461. }
  462. /**
  463. * @brief Get field y from mission_item message
  464. *
  465. * @return PARAM6 / local: Y coordinate, global: longitude
  466. */
  467. static inline float mavlink_msg_mission_item_get_y(const mavlink_message_t* msg)
  468. {
  469. return _MAV_RETURN_float(msg, 20);
  470. }
  471. /**
  472. * @brief Get field z from mission_item message
  473. *
  474. * @return PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
  475. */
  476. static inline float mavlink_msg_mission_item_get_z(const mavlink_message_t* msg)
  477. {
  478. return _MAV_RETURN_float(msg, 24);
  479. }
  480. /**
  481. * @brief Get field mission_type from mission_item message
  482. *
  483. * @return Mission type.
  484. */
  485. static inline uint8_t mavlink_msg_mission_item_get_mission_type(const mavlink_message_t* msg)
  486. {
  487. return _MAV_RETURN_uint8_t(msg, 37);
  488. }
  489. /**
  490. * @brief Decode a mission_item message into a struct
  491. *
  492. * @param msg The message to decode
  493. * @param mission_item C-struct to decode the message contents into
  494. */
  495. static inline void mavlink_msg_mission_item_decode(const mavlink_message_t* msg, mavlink_mission_item_t* mission_item)
  496. {
  497. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  498. mission_item->param1 = mavlink_msg_mission_item_get_param1(msg);
  499. mission_item->param2 = mavlink_msg_mission_item_get_param2(msg);
  500. mission_item->param3 = mavlink_msg_mission_item_get_param3(msg);
  501. mission_item->param4 = mavlink_msg_mission_item_get_param4(msg);
  502. mission_item->x = mavlink_msg_mission_item_get_x(msg);
  503. mission_item->y = mavlink_msg_mission_item_get_y(msg);
  504. mission_item->z = mavlink_msg_mission_item_get_z(msg);
  505. mission_item->seq = mavlink_msg_mission_item_get_seq(msg);
  506. mission_item->command = mavlink_msg_mission_item_get_command(msg);
  507. mission_item->target_system = mavlink_msg_mission_item_get_target_system(msg);
  508. mission_item->target_component = mavlink_msg_mission_item_get_target_component(msg);
  509. mission_item->frame = mavlink_msg_mission_item_get_frame(msg);
  510. mission_item->current = mavlink_msg_mission_item_get_current(msg);
  511. mission_item->autocontinue = mavlink_msg_mission_item_get_autocontinue(msg);
  512. mission_item->mission_type = mavlink_msg_mission_item_get_mission_type(msg);
  513. #else
  514. uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ITEM_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ITEM_LEN;
  515. memset(mission_item, 0, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
  516. memcpy(mission_item, _MAV_PAYLOAD(msg), len);
  517. #endif
  518. }