RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_command_int.h
1#pragma once
2// MESSAGE COMMAND_INT PACKING
3
4#define MAVLINK_MSG_ID_COMMAND_INT 75
5
6MAVPACKED(
7typedef struct __mavlink_command_int_t {
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 int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/
13 int32_t y; /*< PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7*/
14 float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.*/
15 uint16_t command; /*< The scheduled action for the mission item. 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 COMMAND. 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_command_int_t;
22
23#define MAVLINK_MSG_ID_COMMAND_INT_LEN 35
24#define MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN 35
25#define MAVLINK_MSG_ID_75_LEN 35
26#define MAVLINK_MSG_ID_75_MIN_LEN 35
27
28#define MAVLINK_MSG_ID_COMMAND_INT_CRC 158
29#define MAVLINK_MSG_ID_75_CRC 158
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
35 75, \
36 "COMMAND_INT", \
37 13, \
38 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
39 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
40 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
41 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
42 { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
43 { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
44 { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
45 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
46 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
47 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
48 { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
49 { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
50 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
55 "COMMAND_INT", \
56 13, \
57 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
58 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
59 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
60 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
61 { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
62 { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
63 { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
64 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
65 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
66 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
67 { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
68 { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
69 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
70 } \
71}
72#endif
73
95static inline uint16_t mavlink_msg_command_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_COMMAND_INT_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_int32_t(buf, 16, x);
105 _mav_put_int32_t(buf, 20, y);
106 _mav_put_float(buf, 24, z);
107 _mav_put_uint16_t(buf, 28, command);
108 _mav_put_uint8_t(buf, 30, target_system);
109 _mav_put_uint8_t(buf, 31, target_component);
110 _mav_put_uint8_t(buf, 32, frame);
111 _mav_put_uint8_t(buf, 33, current);
112 _mav_put_uint8_t(buf, 34, autocontinue);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
115#else
116 mavlink_command_int_t packet;
117 packet.param1 = param1;
118 packet.param2 = param2;
119 packet.param3 = param3;
120 packet.param4 = param4;
121 packet.x = x;
122 packet.y = y;
123 packet.z = z;
124 packet.command = command;
125 packet.target_system = target_system;
126 packet.target_component = target_component;
127 packet.frame = frame;
128 packet.current = current;
129 packet.autocontinue = autocontinue;
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
132#endif
133
134 msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
135 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
136}
137
159static inline uint16_t mavlink_msg_command_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
160 mavlink_message_t* msg,
161 uint8_t target_system,uint8_t target_component,uint8_t frame,uint16_t command,uint8_t current,uint8_t autocontinue,float param1,float param2,float param3,float param4,int32_t x,int32_t y,float z)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
164 char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
165 _mav_put_float(buf, 0, param1);
166 _mav_put_float(buf, 4, param2);
167 _mav_put_float(buf, 8, param3);
168 _mav_put_float(buf, 12, param4);
169 _mav_put_int32_t(buf, 16, x);
170 _mav_put_int32_t(buf, 20, y);
171 _mav_put_float(buf, 24, z);
172 _mav_put_uint16_t(buf, 28, command);
173 _mav_put_uint8_t(buf, 30, target_system);
174 _mav_put_uint8_t(buf, 31, target_component);
175 _mav_put_uint8_t(buf, 32, frame);
176 _mav_put_uint8_t(buf, 33, current);
177 _mav_put_uint8_t(buf, 34, autocontinue);
178
179 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
180#else
181 mavlink_command_int_t packet;
182 packet.param1 = param1;
183 packet.param2 = param2;
184 packet.param3 = param3;
185 packet.param4 = param4;
186 packet.x = x;
187 packet.y = y;
188 packet.z = z;
189 packet.command = command;
190 packet.target_system = target_system;
191 packet.target_component = target_component;
192 packet.frame = frame;
193 packet.current = current;
194 packet.autocontinue = autocontinue;
195
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
197#endif
198
199 msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
200 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
201}
202
211static inline uint16_t mavlink_msg_command_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
212{
213 return mavlink_msg_command_int_pack(system_id, component_id, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
214}
215
225static inline uint16_t mavlink_msg_command_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
226{
227 return mavlink_msg_command_int_pack_chan(system_id, component_id, chan, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
228}
229
248#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
249
250static inline void mavlink_msg_command_int_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
251{
252#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253 char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
254 _mav_put_float(buf, 0, param1);
255 _mav_put_float(buf, 4, param2);
256 _mav_put_float(buf, 8, param3);
257 _mav_put_float(buf, 12, param4);
258 _mav_put_int32_t(buf, 16, x);
259 _mav_put_int32_t(buf, 20, y);
260 _mav_put_float(buf, 24, z);
261 _mav_put_uint16_t(buf, 28, command);
262 _mav_put_uint8_t(buf, 30, target_system);
263 _mav_put_uint8_t(buf, 31, target_component);
264 _mav_put_uint8_t(buf, 32, frame);
265 _mav_put_uint8_t(buf, 33, current);
266 _mav_put_uint8_t(buf, 34, autocontinue);
267
268 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
269#else
270 mavlink_command_int_t packet;
271 packet.param1 = param1;
272 packet.param2 = param2;
273 packet.param3 = param3;
274 packet.param4 = param4;
275 packet.x = x;
276 packet.y = y;
277 packet.z = z;
278 packet.command = command;
279 packet.target_system = target_system;
280 packet.target_component = target_component;
281 packet.frame = frame;
282 packet.current = current;
283 packet.autocontinue = autocontinue;
284
285 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
286#endif
287}
288
294static inline void mavlink_msg_command_int_send_struct(mavlink_channel_t chan, const mavlink_command_int_t* command_int)
295{
296#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
297 mavlink_msg_command_int_send(chan, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
298#else
299 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)command_int, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
300#endif
301}
302
303#if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
304/*
305 This varient of _send() can be used to save stack space by re-using
306 memory from the receive buffer. The caller provides a
307 mavlink_message_t which is the size of a full mavlink message. This
308 is usually the receive buffer for the channel, and allows a reply to an
309 incoming message with minimum stack space usage.
310 */
311static inline void mavlink_msg_command_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
312{
313#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
314 char *buf = (char *)msgbuf;
315 _mav_put_float(buf, 0, param1);
316 _mav_put_float(buf, 4, param2);
317 _mav_put_float(buf, 8, param3);
318 _mav_put_float(buf, 12, param4);
319 _mav_put_int32_t(buf, 16, x);
320 _mav_put_int32_t(buf, 20, y);
321 _mav_put_float(buf, 24, z);
322 _mav_put_uint16_t(buf, 28, command);
323 _mav_put_uint8_t(buf, 30, target_system);
324 _mav_put_uint8_t(buf, 31, target_component);
325 _mav_put_uint8_t(buf, 32, frame);
326 _mav_put_uint8_t(buf, 33, current);
327 _mav_put_uint8_t(buf, 34, autocontinue);
328
329 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
330#else
331 mavlink_command_int_t *packet = (mavlink_command_int_t *)msgbuf;
332 packet->param1 = param1;
333 packet->param2 = param2;
334 packet->param3 = param3;
335 packet->param4 = param4;
336 packet->x = x;
337 packet->y = y;
338 packet->z = z;
339 packet->command = command;
340 packet->target_system = target_system;
341 packet->target_component = target_component;
342 packet->frame = frame;
343 packet->current = current;
344 packet->autocontinue = autocontinue;
345
346 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
347#endif
348}
349#endif
350
351#endif
352
353// MESSAGE COMMAND_INT UNPACKING
354
355
361static inline uint8_t mavlink_msg_command_int_get_target_system(const mavlink_message_t* msg)
362{
363 return _MAV_RETURN_uint8_t(msg, 30);
364}
365
371static inline uint8_t mavlink_msg_command_int_get_target_component(const mavlink_message_t* msg)
372{
373 return _MAV_RETURN_uint8_t(msg, 31);
374}
375
381static inline uint8_t mavlink_msg_command_int_get_frame(const mavlink_message_t* msg)
382{
383 return _MAV_RETURN_uint8_t(msg, 32);
384}
385
391static inline uint16_t mavlink_msg_command_int_get_command(const mavlink_message_t* msg)
392{
393 return _MAV_RETURN_uint16_t(msg, 28);
394}
395
401static inline uint8_t mavlink_msg_command_int_get_current(const mavlink_message_t* msg)
402{
403 return _MAV_RETURN_uint8_t(msg, 33);
404}
405
411static inline uint8_t mavlink_msg_command_int_get_autocontinue(const mavlink_message_t* msg)
412{
413 return _MAV_RETURN_uint8_t(msg, 34);
414}
415
421static inline float mavlink_msg_command_int_get_param1(const mavlink_message_t* msg)
422{
423 return _MAV_RETURN_float(msg, 0);
424}
425
431static inline float mavlink_msg_command_int_get_param2(const mavlink_message_t* msg)
432{
433 return _MAV_RETURN_float(msg, 4);
434}
435
441static inline float mavlink_msg_command_int_get_param3(const mavlink_message_t* msg)
442{
443 return _MAV_RETURN_float(msg, 8);
444}
445
451static inline float mavlink_msg_command_int_get_param4(const mavlink_message_t* msg)
452{
453 return _MAV_RETURN_float(msg, 12);
454}
455
461static inline int32_t mavlink_msg_command_int_get_x(const mavlink_message_t* msg)
462{
463 return _MAV_RETURN_int32_t(msg, 16);
464}
465
471static inline int32_t mavlink_msg_command_int_get_y(const mavlink_message_t* msg)
472{
473 return _MAV_RETURN_int32_t(msg, 20);
474}
475
481static inline float mavlink_msg_command_int_get_z(const mavlink_message_t* msg)
482{
483 return _MAV_RETURN_float(msg, 24);
484}
485
492static inline void mavlink_msg_command_int_decode(const mavlink_message_t* msg, mavlink_command_int_t* command_int)
493{
494#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
495 command_int->param1 = mavlink_msg_command_int_get_param1(msg);
496 command_int->param2 = mavlink_msg_command_int_get_param2(msg);
497 command_int->param3 = mavlink_msg_command_int_get_param3(msg);
498 command_int->param4 = mavlink_msg_command_int_get_param4(msg);
499 command_int->x = mavlink_msg_command_int_get_x(msg);
500 command_int->y = mavlink_msg_command_int_get_y(msg);
501 command_int->z = mavlink_msg_command_int_get_z(msg);
502 command_int->command = mavlink_msg_command_int_get_command(msg);
503 command_int->target_system = mavlink_msg_command_int_get_target_system(msg);
504 command_int->target_component = mavlink_msg_command_int_get_target_component(msg);
505 command_int->frame = mavlink_msg_command_int_get_frame(msg);
506 command_int->current = mavlink_msg_command_int_get_current(msg);
507 command_int->autocontinue = mavlink_msg_command_int_get_autocontinue(msg);
508#else
509 uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_INT_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_INT_LEN;
510 memset(command_int, 0, MAVLINK_MSG_ID_COMMAND_INT_LEN);
511 memcpy(command_int, _MAV_PAYLOAD(msg), len);
512#endif
513}