Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE MISSION_ITEM PACKING
2
 
3
#define MAVLINK_MSG_ID_MISSION_ITEM 39
4
 
5
typedef struct __mavlink_mission_item_t
6
{
7
 float param1; ///< PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
8
 float param2; ///< PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
9
 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.
10
 float param4; ///< PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
11
 float x; ///< PARAM5 / local: x position, global: latitude
12
 float y; ///< PARAM6 / y position: global: longitude
13
 float z; ///< PARAM7 / z position: global: altitude
14
 uint16_t seq; ///< Sequence
15
 uint16_t command; ///< The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
16
 uint8_t target_system; ///< System ID
17
 uint8_t target_component; ///< Component ID
18
 uint8_t frame; ///< The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
19
 uint8_t current; ///< false:0, true:1
20
 uint8_t autocontinue; ///< autocontinue to next wp
21
} mavlink_mission_item_t;
22
 
23
#define MAVLINK_MSG_ID_MISSION_ITEM_LEN 37
24
#define MAVLINK_MSG_ID_39_LEN 37
25
 
26
 
27
 
28
#define MAVLINK_MESSAGE_INFO_MISSION_ITEM { \
29
        "MISSION_ITEM", \
30
        14, \
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) }, \
45
         } \
46
}
47
 
48
 
49
/**
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
54
 *
55
 * @param target_system System ID
56
 * @param target_component Component ID
57
 * @param seq Sequence
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)
70
 */
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)
73
{
74
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75
        char buf[37];
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);
90
 
91
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 37);
92
#else
93
        mavlink_mission_item_t packet;
94
        packet.param1 = param1;
95
        packet.param2 = param2;
96
        packet.param3 = param3;
97
        packet.param4 = param4;
98
        packet.x = x;
99
        packet.y = y;
100
        packet.z = z;
101
        packet.seq = seq;
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;
108
 
109
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 37);
110
#endif
111
 
112
        msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
113
        return mavlink_finalize_message(msg, system_id, component_id, 37, 254);
114
}
115
 
116
/**
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)
137
 */
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)
141
{
142
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143
        char buf[37];
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);
158
 
159
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 37);
160
#else
161
        mavlink_mission_item_t packet;
162
        packet.param1 = param1;
163
        packet.param2 = param2;
164
        packet.param3 = param3;
165
        packet.param4 = param4;
166
        packet.x = x;
167
        packet.y = y;
168
        packet.z = z;
169
        packet.seq = seq;
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;
176
 
177
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 37);
178
#endif
179
 
180
        msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM;
181
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 37, 254);
182
}
183
 
184
/**
185
 * @brief Encode a mission_item struct into a message
186
 *
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
191
 */
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)
193
{
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);
195
}
196
 
197
/**
198
 * @brief Send a mission_item message
199
 * @param chan MAVLink channel to send the message
200
 *
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
215
 */
216
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
217
 
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)
219
{
220
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
221
        char buf[37];
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);
236
 
237
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, buf, 37, 254);
238
#else
239
        mavlink_mission_item_t packet;
240
        packet.param1 = param1;
241
        packet.param2 = param2;
242
        packet.param3 = param3;
243
        packet.param4 = param4;
244
        packet.x = x;
245
        packet.y = y;
246
        packet.z = z;
247
        packet.seq = seq;
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;
254
 
255
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM, (const char *)&packet, 37, 254);
256
#endif
257
}
258
 
259
#endif
260
 
261
// MESSAGE MISSION_ITEM UNPACKING
262
 
263
 
264
/**
265
 * @brief Get field target_system from mission_item message
266
 *
267
 * @return System ID
268
 */
269
static inline uint8_t mavlink_msg_mission_item_get_target_system(const mavlink_message_t* msg)
270
{
271
        return _MAV_RETURN_uint8_t(msg,  32);
272
}
273
 
274
/**
275
 * @brief Get field target_component from mission_item message
276
 *
277
 * @return Component ID
278
 */
279
static inline uint8_t mavlink_msg_mission_item_get_target_component(const mavlink_message_t* msg)
280
{
281
        return _MAV_RETURN_uint8_t(msg,  33);
282
}
283
 
284
/**
285
 * @brief Get field seq from mission_item message
286
 *
287
 * @return Sequence
288
 */
289
static inline uint16_t mavlink_msg_mission_item_get_seq(const mavlink_message_t* msg)
290
{
291
        return _MAV_RETURN_uint16_t(msg,  28);
292
}
293
 
294
/**
295
 * @brief Get field frame from mission_item message
296
 *
297
 * @return The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h
298
 */
299
static inline uint8_t mavlink_msg_mission_item_get_frame(const mavlink_message_t* msg)
300
{
301
        return _MAV_RETURN_uint8_t(msg,  34);
302
}
303
 
304
/**
305
 * @brief Get field command from mission_item message
306
 *
307
 * @return The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs
308
 */
309
static inline uint16_t mavlink_msg_mission_item_get_command(const mavlink_message_t* msg)
310
{
311
        return _MAV_RETURN_uint16_t(msg,  30);
312
}
313
 
314
/**
315
 * @brief Get field current from mission_item message
316
 *
317
 * @return false:0, true:1
318
 */
319
static inline uint8_t mavlink_msg_mission_item_get_current(const mavlink_message_t* msg)
320
{
321
        return _MAV_RETURN_uint8_t(msg,  35);
322
}
323
 
324
/**
325
 * @brief Get field autocontinue from mission_item message
326
 *
327
 * @return autocontinue to next wp
328
 */
329
static inline uint8_t mavlink_msg_mission_item_get_autocontinue(const mavlink_message_t* msg)
330
{
331
        return _MAV_RETURN_uint8_t(msg,  36);
332
}
333
 
334
/**
335
 * @brief Get field param1 from mission_item message
336
 *
337
 * @return PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters
338
 */
339
static inline float mavlink_msg_mission_item_get_param1(const mavlink_message_t* msg)
340
{
341
        return _MAV_RETURN_float(msg,  0);
342
}
343
 
344
/**
345
 * @brief Get field param2 from mission_item message
346
 *
347
 * @return PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds
348
 */
349
static inline float mavlink_msg_mission_item_get_param2(const mavlink_message_t* msg)
350
{
351
        return _MAV_RETURN_float(msg,  4);
352
}
353
 
354
/**
355
 * @brief Get field param3 from mission_item message
356
 *
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.
358
 */
359
static inline float mavlink_msg_mission_item_get_param3(const mavlink_message_t* msg)
360
{
361
        return _MAV_RETURN_float(msg,  8);
362
}
363
 
364
/**
365
 * @brief Get field param4 from mission_item message
366
 *
367
 * @return PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH
368
 */
369
static inline float mavlink_msg_mission_item_get_param4(const mavlink_message_t* msg)
370
{
371
        return _MAV_RETURN_float(msg,  12);
372
}
373
 
374
/**
375
 * @brief Get field x from mission_item message
376
 *
377
 * @return PARAM5 / local: x position, global: latitude
378
 */
379
static inline float mavlink_msg_mission_item_get_x(const mavlink_message_t* msg)
380
{
381
        return _MAV_RETURN_float(msg,  16);
382
}
383
 
384
/**
385
 * @brief Get field y from mission_item message
386
 *
387
 * @return PARAM6 / y position: global: longitude
388
 */
389
static inline float mavlink_msg_mission_item_get_y(const mavlink_message_t* msg)
390
{
391
        return _MAV_RETURN_float(msg,  20);
392
}
393
 
394
/**
395
 * @brief Get field z from mission_item message
396
 *
397
 * @return PARAM7 / z position: global: altitude
398
 */
399
static inline float mavlink_msg_mission_item_get_z(const mavlink_message_t* msg)
400
{
401
        return _MAV_RETURN_float(msg,  24);
402
}
403
 
404
/**
405
 * @brief Decode a mission_item message into a struct
406
 *
407
 * @param msg The message to decode
408
 * @param mission_item C-struct to decode the message contents into
409
 */
410
static inline void mavlink_msg_mission_item_decode(const mavlink_message_t* msg, mavlink_mission_item_t* mission_item)
411
{
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);
427
#else
428
        memcpy(mission_item, _MAV_PAYLOAD(msg), 37);
429
#endif
430
}