Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_mission_item.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE MISSION_ITEM PACKING
3
4#define MAVLINK_MSG_ID_MISSION_ITEM 39
5
6
8 float param1; /*< PARAM1, see MAV_CMD enum*/
9 float param2; /*< PARAM2, see MAV_CMD enum*/
10 float param3; /*< PARAM3, see MAV_CMD enum*/
11 float param4; /*< PARAM4, see MAV_CMD enum*/
12 float x; /*< PARAM5 / local: X coordinate, global: latitude*/
13 float y; /*< PARAM6 / local: Y coordinate, global: longitude*/
14 float z; /*< PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).*/
15 uint16_t seq; /*< Sequence*/
16 uint16_t command; /*< The scheduled action for the waypoint.*/
17 uint8_t target_system; /*< System ID*/
18 uint8_t target_component; /*< Component ID*/
19 uint8_t frame; /*< The coordinate system of the waypoint.*/
20 uint8_t current; /*< false:0, true:1*/
21 uint8_t autocontinue; /*< Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.*/
22 uint8_t mission_type; /*< Mission type.*/
23} mavlink_mission_item_t;
24
25#define MAVLINK_MSG_ID_MISSION_ITEM_LEN 38
26#define MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN 37
27#define MAVLINK_MSG_ID_39_LEN 38
28#define MAVLINK_MSG_ID_39_MIN_LEN 37
29
30#define MAVLINK_MSG_ID_MISSION_ITEM_CRC 254
31#define MAVLINK_MSG_ID_39_CRC 254
32
33
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_MISSION_ITEM {
37 39,
38 "MISSION_ITEM",
39 15,
40 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_mission_item_t, target_system) },
41 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_mission_item_t, target_component) },
42 { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_mission_item_t, seq) },
43 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_mission_item_t, frame) },
44 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_mission_item_t, command) },
45 { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_mission_item_t, current) },
46 { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_mission_item_t, autocontinue) },
47 { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mission_item_t, param1) },
48 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mission_item_t, param2) },
49 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mission_item_t, param3) },
50 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mission_item_t, param4) },
51 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mission_item_t, x) },
52 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mission_item_t, y) },
53 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mission_item_t, z) },
54 { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_mission_item_t, mission_type) },
55 } \
56}
57#else
58#define MAVLINK_MESSAGE_INFO_MISSION_ITEM {
59 "MISSION_ITEM",
60 15,
61 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_mission_item_t, target_system) },
62 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_mission_item_t, target_component) },
63 { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_mission_item_t, seq) },
64 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_mission_item_t, frame) },
65 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_mission_item_t, command) },
66 { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_mission_item_t, current) },
67 { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_mission_item_t, autocontinue) },
68 { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mission_item_t, param1) },
69 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mission_item_t, param2) },
70 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mission_item_t, param3) },
71 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mission_item_t, param4) },
72 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mission_item_t, x) },
73 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mission_item_t, y) },
74 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mission_item_t, z) },
75 { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_mission_item_t, mission_type) },
76 } \
77}
78#endif
79
80/**
81 * @brief Pack a mission_item message
82 * @param system_id ID of this system
83 * @param component_id ID of this component (e.g. 200 for IMU)
84 * @param msg The MAVLink message to compress the data into
85 *
86 * @param target_system System ID
87 * @param target_component Component ID
88 * @param seq Sequence
89 * @param frame The coordinate system of the waypoint.
90 * @param command The scheduled action for the waypoint.
91 * @param current false:0, true:1
92 * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
93 * @param param1 PARAM1, see MAV_CMD enum
94 * @param param2 PARAM2, see MAV_CMD enum
95 * @param param3 PARAM3, see MAV_CMD enum
96 * @param param4 PARAM4, see MAV_CMD enum
97 * @param x PARAM5 / local: X coordinate, global: latitude
98 * @param y PARAM6 / local: Y coordinate, global: longitude
99 * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
100 * @param mission_type Mission type.
101 * @return length of the message in bytes (excluding serial stream start sign)
102 */
103static inline uint16_t mavlink_msg_mission_item_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
104 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)
105{
106#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 _mav_put_float(buf, 0, param1);
109 _mav_put_float(buf, 4, param2);
110 _mav_put_float(buf, 8, param3);
111 _mav_put_float(buf, 12, param4);
112 _mav_put_float(buf, 16, x);
113 _mav_put_float(buf, 20, y);
114 _mav_put_float(buf, 24, z);
115 _mav_put_uint16_t(buf, 28, seq);
116 _mav_put_uint16_t(buf, 30, command);
117 _mav_put_uint8_t(buf, 32, target_system);
118 _mav_put_uint8_t(buf, 33, target_component);
119 _mav_put_uint8_t(buf, 34, frame);
120 _mav_put_uint8_t(buf, 35, current);
121 _mav_put_uint8_t(buf, 36, autocontinue);
122 _mav_put_uint8_t(buf, 37, mission_type);
123
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
125#else
126 mavlink_mission_item_t packet;
127 packet.param1 = param1;
128 packet.param2 = param2;
129 packet.param3 = param3;
130 packet.param4 = param4;
131 packet.x = x;
132 packet.y = y;
133 packet.z = z;
134 packet.seq = seq;
135 packet.command = command;
136 packet.target_system = target_system;
137 packet.target_component = target_component;
138 packet.frame = frame;
139 packet.current = current;
140 packet.autocontinue = autocontinue;
141 packet.mission_type = mission_type;
142
143 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
144#endif
145
146 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
147 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);
148}
149
150/**
151 * @brief Pack a mission_item message
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param status MAVLink status structure
155 * @param msg The MAVLink message to compress the data into
156 *
157 * @param target_system System ID
158 * @param target_component Component ID
159 * @param seq Sequence
160 * @param frame The coordinate system of the waypoint.
161 * @param command The scheduled action for the waypoint.
162 * @param current false:0, true:1
163 * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
164 * @param param1 PARAM1, see MAV_CMD enum
165 * @param param2 PARAM2, see MAV_CMD enum
166 * @param param3 PARAM3, see MAV_CMD enum
167 * @param param4 PARAM4, see MAV_CMD enum
168 * @param x PARAM5 / local: X coordinate, global: latitude
169 * @param y PARAM6 / local: Y coordinate, global: longitude
170 * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
171 * @param mission_type Mission type.
172 * @return length of the message in bytes (excluding serial stream start sign)
173 */
174static inline uint16_t mavlink_msg_mission_item_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
175 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)
176{
177#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 _mav_put_float(buf, 0, param1);
180 _mav_put_float(buf, 4, param2);
181 _mav_put_float(buf, 8, param3);
182 _mav_put_float(buf, 12, param4);
183 _mav_put_float(buf, 16, x);
184 _mav_put_float(buf, 20, y);
185 _mav_put_float(buf, 24, z);
186 _mav_put_uint16_t(buf, 28, seq);
187 _mav_put_uint16_t(buf, 30, command);
188 _mav_put_uint8_t(buf, 32, target_system);
189 _mav_put_uint8_t(buf, 33, target_component);
190 _mav_put_uint8_t(buf, 34, frame);
191 _mav_put_uint8_t(buf, 35, current);
192 _mav_put_uint8_t(buf, 36, autocontinue);
193 _mav_put_uint8_t(buf, 37, mission_type);
194
195 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
196#else
197 mavlink_mission_item_t packet;
198 packet.param1 = param1;
199 packet.param2 = param2;
200 packet.param3 = param3;
201 packet.param4 = param4;
202 packet.x = x;
203 packet.y = y;
204 packet.z = z;
205 packet.seq = seq;
206 packet.command = command;
207 packet.target_system = target_system;
208 packet.target_component = target_component;
209 packet.frame = frame;
210 packet.current = current;
211 packet.autocontinue = autocontinue;
212 packet.mission_type = mission_type;
213
214 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
215#endif
216
217 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
218#if MAVLINK_CRC_EXTRA
219 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN, MAVLINK_MSG_ID_MISSION_ITEM_CRC);
220#else
221 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
222#endif
223}
224
225/**
226 * @brief Pack a mission_item message on a channel
227 * @param system_id ID of this system
228 * @param component_id ID of this component (e.g. 200 for IMU)
229 * @param chan The MAVLink channel this message will be sent over
230 * @param msg The MAVLink message to compress the data into
231 * @param target_system System ID
232 * @param target_component Component ID
233 * @param seq Sequence
234 * @param frame The coordinate system of the waypoint.
235 * @param command The scheduled action for the waypoint.
236 * @param current false:0, true:1
237 * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
238 * @param param1 PARAM1, see MAV_CMD enum
239 * @param param2 PARAM2, see MAV_CMD enum
240 * @param param3 PARAM3, see MAV_CMD enum
241 * @param param4 PARAM4, see MAV_CMD enum
242 * @param x PARAM5 / local: X coordinate, global: latitude
243 * @param y PARAM6 / local: Y coordinate, global: longitude
244 * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
245 * @param mission_type Mission type.
246 * @return length of the message in bytes (excluding serial stream start sign)
247 */
248static inline uint16_t mavlink_msg_mission_item_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
249 mavlink_message_t* msg,
250 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
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
270 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
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
289 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
290#endif
291
292 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
293 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);
294}
295
296/**
297 * @brief Encode a mission_item struct
298 *
299 * @param system_id ID of this system
300 * @param component_id ID of this component (e.g. 200 for IMU)
301 * @param msg The MAVLink message to compress the data into
302 * @param mission_item C-struct to read the message contents from
303 */
304static 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)
305{
306 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);
307}
308
309/**
310 * @brief Encode a mission_item struct on a channel
311 *
312 * @param system_id ID of this system
313 * @param component_id ID of this component (e.g. 200 for IMU)
314 * @param chan The MAVLink channel this message will be sent over
315 * @param msg The MAVLink message to compress the data into
316 * @param mission_item C-struct to read the message contents from
317 */
318static 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)
319{
320 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);
321}
322
323/**
324 * @brief Encode a mission_item struct with provided status structure
325 *
326 * @param system_id ID of this system
327 * @param component_id ID of this component (e.g. 200 for IMU)
328 * @param status MAVLink status structure
329 * @param msg The MAVLink message to compress the data into
330 * @param mission_item C-struct to read the message contents from
331 */
332static inline uint16_t mavlink_msg_mission_item_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_item_t* mission_item)
333{
334 return mavlink_msg_mission_item_pack_status(system_id, component_id, _status, 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);
335}
336
337/**
338 * @brief Send a mission_item message
339 * @param chan MAVLink channel to send the message
340 *
341 * @param target_system System ID
342 * @param target_component Component ID
343 * @param seq Sequence
344 * @param frame The coordinate system of the waypoint.
345 * @param command The scheduled action for the waypoint.
346 * @param current false:0, true:1
347 * @param autocontinue Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
348 * @param param1 PARAM1, see MAV_CMD enum
349 * @param param2 PARAM2, see MAV_CMD enum
350 * @param param3 PARAM3, see MAV_CMD enum
351 * @param param4 PARAM4, see MAV_CMD enum
352 * @param x PARAM5 / local: X coordinate, global: latitude
353 * @param y PARAM6 / local: Y coordinate, global: longitude
354 * @param z PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
355 * @param mission_type Mission type.
356 */
357#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
358
359static 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)
360{
361#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
362 char buf[MAVLINK_MSG_ID_MISSION_ITEM_LEN];
363 _mav_put_float(buf, 0, param1);
364 _mav_put_float(buf, 4, param2);
365 _mav_put_float(buf, 8, param3);
366 _mav_put_float(buf, 12, param4);
367 _mav_put_float(buf, 16, x);
368 _mav_put_float(buf, 20, y);
369 _mav_put_float(buf, 24, z);
370 _mav_put_uint16_t(buf, 28, seq);
371 _mav_put_uint16_t(buf, 30, command);
372 _mav_put_uint8_t(buf, 32, target_system);
373 _mav_put_uint8_t(buf, 33, target_component);
374 _mav_put_uint8_t(buf, 34, frame);
375 _mav_put_uint8_t(buf, 35, current);
376 _mav_put_uint8_t(buf, 36, autocontinue);
377 _mav_put_uint8_t(buf, 37, mission_type);
378
379 _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);
380#else
381 mavlink_mission_item_t packet;
382 packet.param1 = param1;
383 packet.param2 = param2;
384 packet.param3 = param3;
385 packet.param4 = param4;
386 packet.x = x;
387 packet.y = y;
388 packet.z = z;
389 packet.seq = seq;
390 packet.command = command;
391 packet.target_system = target_system;
392 packet.target_component = target_component;
393 packet.frame = frame;
394 packet.current = current;
395 packet.autocontinue = autocontinue;
396 packet.mission_type = mission_type;
397
398 _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);
399#endif
400}
401
402/**
403 * @brief Send a mission_item message
404 * @param chan MAVLink channel to send the message
405 * @param struct The MAVLink struct to serialize
406 */
407static inline void mavlink_msg_mission_item_send_struct(mavlink_channel_t chan, const mavlink_mission_item_t* mission_item)
408{
409#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
410 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);
411#else
412 _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);
413#endif
414}
415
416#if MAVLINK_MSG_ID_MISSION_ITEM_LEN <= MAVLINK_MAX_PAYLOAD_LEN
417/*
418 This variant of _send() can be used to save stack space by reusing
419 memory from the receive buffer. The caller provides a
420 mavlink_message_t which is the size of a full mavlink message. This
421 is usually the receive buffer for the channel, and allows a reply to an
422 incoming message with minimum stack space usage.
423 */
424static 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)
425{
426#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
427 char *buf = (char *)msgbuf;
428 _mav_put_float(buf, 0, param1);
429 _mav_put_float(buf, 4, param2);
430 _mav_put_float(buf, 8, param3);
431 _mav_put_float(buf, 12, param4);
432 _mav_put_float(buf, 16, x);
433 _mav_put_float(buf, 20, y);
434 _mav_put_float(buf, 24, z);
435 _mav_put_uint16_t(buf, 28, seq);
436 _mav_put_uint16_t(buf, 30, command);
437 _mav_put_uint8_t(buf, 32, target_system);
438 _mav_put_uint8_t(buf, 33, target_component);
439 _mav_put_uint8_t(buf, 34, frame);
440 _mav_put_uint8_t(buf, 35, current);
441 _mav_put_uint8_t(buf, 36, autocontinue);
442 _mav_put_uint8_t(buf, 37, mission_type);
443
444 _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);
445#else
446 mavlink_mission_item_t *packet = (mavlink_mission_item_t *)msgbuf;
447 packet->param1 = param1;
448 packet->param2 = param2;
449 packet->param3 = param3;
450 packet->param4 = param4;
451 packet->x = x;
452 packet->y = y;
453 packet->z = z;
454 packet->seq = seq;
455 packet->command = command;
456 packet->target_system = target_system;
457 packet->target_component = target_component;
458 packet->frame = frame;
459 packet->current = current;
460 packet->autocontinue = autocontinue;
461 packet->mission_type = mission_type;
462
463 _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);
464#endif
465}
466#endif
467
468#endif
469
470// MESSAGE MISSION_ITEM UNPACKING
471
472
473/**
474 * @brief Get field target_system from mission_item message
475 *
476 * @return System ID
477 */
478static inline uint8_t mavlink_msg_mission_item_get_target_system(const mavlink_message_t* msg)
479{
480 return _MAV_RETURN_uint8_t(msg, 32);
481}
482
483/**
484 * @brief Get field target_component from mission_item message
485 *
486 * @return Component ID
487 */
488static inline uint8_t mavlink_msg_mission_item_get_target_component(const mavlink_message_t* msg)
489{
490 return _MAV_RETURN_uint8_t(msg, 33);
491}
492
493/**
494 * @brief Get field seq from mission_item message
495 *
496 * @return Sequence
497 */
498static inline uint16_t mavlink_msg_mission_item_get_seq(const mavlink_message_t* msg)
499{
500 return _MAV_RETURN_uint16_t(msg, 28);
501}
502
503/**
504 * @brief Get field frame from mission_item message
505 *
506 * @return The coordinate system of the waypoint.
507 */
508static inline uint8_t mavlink_msg_mission_item_get_frame(const mavlink_message_t* msg)
509{
510 return _MAV_RETURN_uint8_t(msg, 34);
511}
512
513/**
514 * @brief Get field command from mission_item message
515 *
516 * @return The scheduled action for the waypoint.
517 */
518static inline uint16_t mavlink_msg_mission_item_get_command(const mavlink_message_t* msg)
519{
520 return _MAV_RETURN_uint16_t(msg, 30);
521}
522
523/**
524 * @brief Get field current from mission_item message
525 *
526 * @return false:0, true:1
527 */
528static inline uint8_t mavlink_msg_mission_item_get_current(const mavlink_message_t* msg)
529{
530 return _MAV_RETURN_uint8_t(msg, 35);
531}
532
533/**
534 * @brief Get field autocontinue from mission_item message
535 *
536 * @return Autocontinue to next waypoint. 0: false, 1: true. Set false to pause mission after the item completes.
537 */
538static inline uint8_t mavlink_msg_mission_item_get_autocontinue(const mavlink_message_t* msg)
539{
540 return _MAV_RETURN_uint8_t(msg, 36);
541}
542
543/**
544 * @brief Get field param1 from mission_item message
545 *
546 * @return PARAM1, see MAV_CMD enum
547 */
548static inline float mavlink_msg_mission_item_get_param1(const mavlink_message_t* msg)
549{
550 return _MAV_RETURN_float(msg, 0);
551}
552
553/**
554 * @brief Get field param2 from mission_item message
555 *
556 * @return PARAM2, see MAV_CMD enum
557 */
558static inline float mavlink_msg_mission_item_get_param2(const mavlink_message_t* msg)
559{
560 return _MAV_RETURN_float(msg, 4);
561}
562
563/**
564 * @brief Get field param3 from mission_item message
565 *
566 * @return PARAM3, see MAV_CMD enum
567 */
568static inline float mavlink_msg_mission_item_get_param3(const mavlink_message_t* msg)
569{
570 return _MAV_RETURN_float(msg, 8);
571}
572
573/**
574 * @brief Get field param4 from mission_item message
575 *
576 * @return PARAM4, see MAV_CMD enum
577 */
578static inline float mavlink_msg_mission_item_get_param4(const mavlink_message_t* msg)
579{
580 return _MAV_RETURN_float(msg, 12);
581}
582
583/**
584 * @brief Get field x from mission_item message
585 *
586 * @return PARAM5 / local: X coordinate, global: latitude
587 */
588static inline float mavlink_msg_mission_item_get_x(const mavlink_message_t* msg)
589{
590 return _MAV_RETURN_float(msg, 16);
591}
592
593/**
594 * @brief Get field y from mission_item message
595 *
596 * @return PARAM6 / local: Y coordinate, global: longitude
597 */
598static inline float mavlink_msg_mission_item_get_y(const mavlink_message_t* msg)
599{
600 return _MAV_RETURN_float(msg, 20);
601}
602
603/**
604 * @brief Get field z from mission_item message
605 *
606 * @return PARAM7 / local: Z coordinate, global: altitude (relative or absolute, depending on frame).
607 */
608static inline float mavlink_msg_mission_item_get_z(const mavlink_message_t* msg)
609{
610 return _MAV_RETURN_float(msg, 24);
611}
612
613/**
614 * @brief Get field mission_type from mission_item message
615 *
616 * @return Mission type.
617 */
618static inline uint8_t mavlink_msg_mission_item_get_mission_type(const mavlink_message_t* msg)
619{
620 return _MAV_RETURN_uint8_t(msg, 37);
621}
622
623/**
624 * @brief Decode a mission_item message into a struct
625 *
626 * @param msg The message to decode
627 * @param mission_item C-struct to decode the message contents into
628 */
629static inline void mavlink_msg_mission_item_decode(const mavlink_message_t* msg, mavlink_mission_item_t* mission_item)
630{
631#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
632 mission_item->param1 = mavlink_msg_mission_item_get_param1(msg);
633 mission_item->param2 = mavlink_msg_mission_item_get_param2(msg);
634 mission_item->param3 = mavlink_msg_mission_item_get_param3(msg);
635 mission_item->param4 = mavlink_msg_mission_item_get_param4(msg);
636 mission_item->x = mavlink_msg_mission_item_get_x(msg);
637 mission_item->y = mavlink_msg_mission_item_get_y(msg);
638 mission_item->z = mavlink_msg_mission_item_get_z(msg);
639 mission_item->seq = mavlink_msg_mission_item_get_seq(msg);
640 mission_item->command = mavlink_msg_mission_item_get_command(msg);
641 mission_item->target_system = mavlink_msg_mission_item_get_target_system(msg);
642 mission_item->target_component = mavlink_msg_mission_item_get_target_component(msg);
643 mission_item->frame = mavlink_msg_mission_item_get_frame(msg);
644 mission_item->current = mavlink_msg_mission_item_get_current(msg);
645 mission_item->autocontinue = mavlink_msg_mission_item_get_autocontinue(msg);
646 mission_item->mission_type = mavlink_msg_mission_item_get_mission_type(msg);
647#else
648 uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ITEM_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ITEM_LEN;
649 memset(mission_item, 0, MAVLINK_MSG_ID_MISSION_ITEM_LEN);
650 memcpy(mission_item, _MAV_PAYLOAD(msg), len);
651#endif
652}