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.

563 lines
23 KiB

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