1 // MESSAGE MISSION_ITEM PACKING
3 #define MAVLINK_MSG_ID_MISSION_ITEM 39
5 typedef struct __mavlink_mission_item_t
{
6 float param1
; ///< PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
7 float param2
; ///< PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
8 float param3
; ///< PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
9 float param4
; ///< PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
10 float x
; ///< PARAM5 / local: x position, global: latitude
11 float y
; ///< PARAM6 / y position: global: longitude
12 float z
; ///< PARAM7 / z position: global: altitude
13 uint16_t seq
; ///< Sequence
14 uint16_t command
; ///< The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
15 uint8_t target_system
; ///< System ID
16 uint8_t target_component
; ///< Component ID
17 uint8_t frame
; ///< The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
18 uint8_t current
; ///< false:0, true:1
19 uint8_t autocontinue
; ///< autocontinue to next wp
20 } mavlink_mission_item_t
;
22 #define MAVLINK_MSG_ID_MISSION_ITEM_LEN 37
23 #define MAVLINK_MSG_ID_39_LEN 37
26 #define MAVLINK_MESSAGE_INFO_MISSION_ITEM \
31 { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mission_item_t, param1) }, \
32 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mission_item_t, param2) }, \
33 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mission_item_t, param3) }, \
34 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mission_item_t, param4) }, \
35 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_mission_item_t, x) }, \
36 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_mission_item_t, y) }, \
37 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_mission_item_t, z) }, \
38 { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_mission_item_t, seq) }, \
39 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_mission_item_t, command) }, \
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 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_mission_item_t, frame) }, \
43 { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_mission_item_t, current) }, \
44 { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_mission_item_t, autocontinue) }, \
50 * @brief Pack a mission_item message
51 * @param system_id ID of this system
52 * @param component_id ID of this component (e.g. 200 for IMU)
53 * @param msg The MAVLink message to compress the data into
55 * @param target_system System ID
56 * @param target_component Component ID
58 * @param frame The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
59 * @param command The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
60 * @param current false:0, true:1
61 * @param autocontinue autocontinue to next wp
62 * @param param1 PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
63 * @param param2 PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
64 * @param param3 PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
65 * @param param4 PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
66 * @param x PARAM5 / local: x position, global: latitude
67 * @param y PARAM6 / y position: global: longitude
68 * @param z PARAM7 / z position: global: altitude
69 * @return length of the message in bytes (excluding serial stream start sign)
71 static inline uint16_t mavlink_msg_mission_item_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
,
72 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
)
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76 _mav_put_float(buf
, 0, param1
);
77 _mav_put_float(buf
, 4, param2
);
78 _mav_put_float(buf
, 8, param3
);
79 _mav_put_float(buf
, 12, param4
);
80 _mav_put_float(buf
, 16, x
);
81 _mav_put_float(buf
, 20, y
);
82 _mav_put_float(buf
, 24, z
);
83 _mav_put_uint16_t(buf
, 28, seq
);
84 _mav_put_uint16_t(buf
, 30, command
);
85 _mav_put_uint8_t(buf
, 32, target_system
);
86 _mav_put_uint8_t(buf
, 33, target_component
);
87 _mav_put_uint8_t(buf
, 34, frame
);
88 _mav_put_uint8_t(buf
, 35, current
);
89 _mav_put_uint8_t(buf
, 36, autocontinue
);
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 37);
93 mavlink_mission_item_t packet
;
94 packet
.param1
= param1
;
95 packet
.param2
= param2
;
96 packet
.param3
= param3
;
97 packet
.param4
= param4
;
102 packet
.command
= command
;
103 packet
.target_system
= target_system
;
104 packet
.target_component
= target_component
;
105 packet
.frame
= frame
;
106 packet
.current
= current
;
107 packet
.autocontinue
= autocontinue
;
109 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 37);
110 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
112 msg
->msgid
= MAVLINK_MSG_ID_MISSION_ITEM
;
113 return mavlink_finalize_message(msg
, system_id
, component_id
, 37, 254);
117 * @brief Pack a mission_item message on a channel
118 * @param system_id ID of this system
119 * @param component_id ID of this component (e.g. 200 for IMU)
120 * @param chan The MAVLink channel this message was sent over
121 * @param msg The MAVLink message to compress the data into
122 * @param target_system System ID
123 * @param target_component Component ID
124 * @param seq Sequence
125 * @param frame The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
126 * @param command The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
127 * @param current false:0, true:1
128 * @param autocontinue autocontinue to next wp
129 * @param param1 PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
130 * @param param2 PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
131 * @param param3 PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
132 * @param param4 PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
133 * @param x PARAM5 / local: x position, global: latitude
134 * @param y PARAM6 / y position: global: longitude
135 * @param z PARAM7 / z position: global: altitude
136 * @return length of the message in bytes (excluding serial stream start sign)
138 static inline uint16_t mavlink_msg_mission_item_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
139 mavlink_message_t
*msg
,
140 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
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
144 _mav_put_float(buf
, 0, param1
);
145 _mav_put_float(buf
, 4, param2
);
146 _mav_put_float(buf
, 8, param3
);
147 _mav_put_float(buf
, 12, param4
);
148 _mav_put_float(buf
, 16, x
);
149 _mav_put_float(buf
, 20, y
);
150 _mav_put_float(buf
, 24, z
);
151 _mav_put_uint16_t(buf
, 28, seq
);
152 _mav_put_uint16_t(buf
, 30, command
);
153 _mav_put_uint8_t(buf
, 32, target_system
);
154 _mav_put_uint8_t(buf
, 33, target_component
);
155 _mav_put_uint8_t(buf
, 34, frame
);
156 _mav_put_uint8_t(buf
, 35, current
);
157 _mav_put_uint8_t(buf
, 36, autocontinue
);
159 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 37);
161 mavlink_mission_item_t packet
;
162 packet
.param1
= param1
;
163 packet
.param2
= param2
;
164 packet
.param3
= param3
;
165 packet
.param4
= param4
;
170 packet
.command
= command
;
171 packet
.target_system
= target_system
;
172 packet
.target_component
= target_component
;
173 packet
.frame
= frame
;
174 packet
.current
= current
;
175 packet
.autocontinue
= autocontinue
;
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 37);
178 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
180 msg
->msgid
= MAVLINK_MSG_ID_MISSION_ITEM
;
181 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, 37, 254);
185 * @brief Encode a mission_item struct into a message
187 * @param system_id ID of this system
188 * @param component_id ID of this component (e.g. 200 for IMU)
189 * @param msg The MAVLink message to compress the data into
190 * @param mission_item C-struct to read the message contents from
192 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
)
194 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
);
198 * @brief Send a mission_item message
199 * @param chan MAVLink channel to send the message
201 * @param target_system System ID
202 * @param target_component Component ID
203 * @param seq Sequence
204 * @param frame The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
205 * @param command The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
206 * @param current false:0, true:1
207 * @param autocontinue autocontinue to next wp
208 * @param param1 PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
209 * @param param2 PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
210 * @param param3 PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
211 * @param param4 PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
212 * @param x PARAM5 / local: x position, global: latitude
213 * @param y PARAM6 / y position: global: longitude
214 * @param z PARAM7 / z position: global: altitude
216 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
218 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
)
220 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
222 _mav_put_float(buf
, 0, param1
);
223 _mav_put_float(buf
, 4, param2
);
224 _mav_put_float(buf
, 8, param3
);
225 _mav_put_float(buf
, 12, param4
);
226 _mav_put_float(buf
, 16, x
);
227 _mav_put_float(buf
, 20, y
);
228 _mav_put_float(buf
, 24, z
);
229 _mav_put_uint16_t(buf
, 28, seq
);
230 _mav_put_uint16_t(buf
, 30, command
);
231 _mav_put_uint8_t(buf
, 32, target_system
);
232 _mav_put_uint8_t(buf
, 33, target_component
);
233 _mav_put_uint8_t(buf
, 34, frame
);
234 _mav_put_uint8_t(buf
, 35, current
);
235 _mav_put_uint8_t(buf
, 36, autocontinue
);
237 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MISSION_ITEM
, buf
, 37, 254);
239 mavlink_mission_item_t packet
;
240 packet
.param1
= param1
;
241 packet
.param2
= param2
;
242 packet
.param3
= param3
;
243 packet
.param4
= param4
;
248 packet
.command
= command
;
249 packet
.target_system
= target_system
;
250 packet
.target_component
= target_component
;
251 packet
.frame
= frame
;
252 packet
.current
= current
;
253 packet
.autocontinue
= autocontinue
;
255 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_MISSION_ITEM
, (const char *)&packet
, 37, 254);
256 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
261 // MESSAGE MISSION_ITEM UNPACKING
265 * @brief Get field target_system from mission_item message
269 static inline uint8_t mavlink_msg_mission_item_get_target_system(const mavlink_message_t
*msg
)
271 return _MAV_RETURN_uint8_t(msg
, 32);
275 * @brief Get field target_component from mission_item message
277 * @return Component ID
279 static inline uint8_t mavlink_msg_mission_item_get_target_component(const mavlink_message_t
*msg
)
281 return _MAV_RETURN_uint8_t(msg
, 33);
285 * @brief Get field seq from mission_item message
289 static inline uint16_t mavlink_msg_mission_item_get_seq(const mavlink_message_t
*msg
)
291 return _MAV_RETURN_uint16_t(msg
, 28);
295 * @brief Get field frame from mission_item message
297 * @return The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
299 static inline uint8_t mavlink_msg_mission_item_get_frame(const mavlink_message_t
*msg
)
301 return _MAV_RETURN_uint8_t(msg
, 34);
305 * @brief Get field command from mission_item message
307 * @return The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
309 static inline uint16_t mavlink_msg_mission_item_get_command(const mavlink_message_t
*msg
)
311 return _MAV_RETURN_uint16_t(msg
, 30);
315 * @brief Get field current from mission_item message
317 * @return false:0, true:1
319 static inline uint8_t mavlink_msg_mission_item_get_current(const mavlink_message_t
*msg
)
321 return _MAV_RETURN_uint8_t(msg
, 35);
325 * @brief Get field autocontinue from mission_item message
327 * @return autocontinue to next wp
329 static inline uint8_t mavlink_msg_mission_item_get_autocontinue(const mavlink_message_t
*msg
)
331 return _MAV_RETURN_uint8_t(msg
, 36);
335 * @brief Get field param1 from mission_item message
337 * @return PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
339 static inline float mavlink_msg_mission_item_get_param1(const mavlink_message_t
*msg
)
341 return _MAV_RETURN_float(msg
, 0);
345 * @brief Get field param2 from mission_item message
347 * @return PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
349 static inline float mavlink_msg_mission_item_get_param2(const mavlink_message_t
*msg
)
351 return _MAV_RETURN_float(msg
, 4);
355 * @brief Get field param3 from mission_item message
357 * @return PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise.
359 static inline float mavlink_msg_mission_item_get_param3(const mavlink_message_t
*msg
)
361 return _MAV_RETURN_float(msg
, 8);
365 * @brief Get field param4 from mission_item message
367 * @return PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
369 static inline float mavlink_msg_mission_item_get_param4(const mavlink_message_t
*msg
)
371 return _MAV_RETURN_float(msg
, 12);
375 * @brief Get field x from mission_item message
377 * @return PARAM5 / local: x position, global: latitude
379 static inline float mavlink_msg_mission_item_get_x(const mavlink_message_t
*msg
)
381 return _MAV_RETURN_float(msg
, 16);
385 * @brief Get field y from mission_item message
387 * @return PARAM6 / y position: global: longitude
389 static inline float mavlink_msg_mission_item_get_y(const mavlink_message_t
*msg
)
391 return _MAV_RETURN_float(msg
, 20);
395 * @brief Get field z from mission_item message
397 * @return PARAM7 / z position: global: altitude
399 static inline float mavlink_msg_mission_item_get_z(const mavlink_message_t
*msg
)
401 return _MAV_RETURN_float(msg
, 24);
405 * @brief Decode a mission_item message into a struct
407 * @param msg The message to decode
408 * @param mission_item C-struct to decode the message contents into
410 static inline void mavlink_msg_mission_item_decode(const mavlink_message_t
*msg
, mavlink_mission_item_t
*mission_item
)
412 #if MAVLINK_NEED_BYTE_SWAP
413 mission_item
->param1
= mavlink_msg_mission_item_get_param1(msg
);
414 mission_item
->param2
= mavlink_msg_mission_item_get_param2(msg
);
415 mission_item
->param3
= mavlink_msg_mission_item_get_param3(msg
);
416 mission_item
->param4
= mavlink_msg_mission_item_get_param4(msg
);
417 mission_item
->x
= mavlink_msg_mission_item_get_x(msg
);
418 mission_item
->y
= mavlink_msg_mission_item_get_y(msg
);
419 mission_item
->z
= mavlink_msg_mission_item_get_z(msg
);
420 mission_item
->seq
= mavlink_msg_mission_item_get_seq(msg
);
421 mission_item
->command
= mavlink_msg_mission_item_get_command(msg
);
422 mission_item
->target_system
= mavlink_msg_mission_item_get_target_system(msg
);
423 mission_item
->target_component
= mavlink_msg_mission_item_get_target_component(msg
);
424 mission_item
->frame
= mavlink_msg_mission_item_get_frame(msg
);
425 mission_item
->current
= mavlink_msg_mission_item_get_current(msg
);
426 mission_item
->autocontinue
= mavlink_msg_mission_item_get_autocontinue(msg
);
428 memcpy(mission_item
, _MAV_PAYLOAD(msg
), 37);