mavlink_msg_command_int.h
Go to the documentation of this file.
1 // MESSAGE COMMAND_INT PACKING
2 
3 #define MAVLINK_MSG_ID_COMMAND_INT 75
4 
5 typedef struct __mavlink_command_int_t
6 {
7  float param1; /*< PARAM1, see MAV_CMD enum*/
8  float param2; /*< PARAM2, see MAV_CMD enum*/
9  float param3; /*< PARAM3, see MAV_CMD enum*/
10  float param4; /*< PARAM4, see MAV_CMD enum*/
11  int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/
12  int32_t y; /*< PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7*/
13  float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.*/
14  uint16_t command; /*< The scheduled action for the mission item. 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 COMMAND. see MAV_FRAME in mavlink_types.h*/
18  uint8_t current; /*< false:0, true:1*/
19  uint8_t autocontinue; /*< autocontinue to next wp*/
21 
22 #define MAVLINK_MSG_ID_COMMAND_INT_LEN 35
23 #define MAVLINK_MSG_ID_75_LEN 35
24 
25 #define MAVLINK_MSG_ID_COMMAND_INT_CRC 158
26 #define MAVLINK_MSG_ID_75_CRC 158
27 
28 
29 
30 #define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
31  "COMMAND_INT", \
32  13, \
33  { { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
34  { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
35  { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
36  { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
37  { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
38  { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
39  { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
40  { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
41  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
42  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
43  { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
44  { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
45  { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
46  } \
47 }
48 
49 
71 static inline uint16_t mavlink_msg_command_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72  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)
73 {
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_int32_t(buf, 16, x);
81  _mav_put_int32_t(buf, 20, y);
82  _mav_put_float(buf, 24, z);
83  _mav_put_uint16_t(buf, 28, command);
84  _mav_put_uint8_t(buf, 30, target_system);
85  _mav_put_uint8_t(buf, 31, target_component);
86  _mav_put_uint8_t(buf, 32, frame);
87  _mav_put_uint8_t(buf, 33, current);
88  _mav_put_uint8_t(buf, 34, autocontinue);
89 
91 #else
92  mavlink_command_int_t packet;
93  packet.param1 = param1;
94  packet.param2 = param2;
95  packet.param3 = param3;
96  packet.param4 = param4;
97  packet.x = x;
98  packet.y = y;
99  packet.z = z;
100  packet.command = command;
101  packet.target_system = target_system;
103  packet.frame = frame;
104  packet.current = current;
105  packet.autocontinue = autocontinue;
106 
108 #endif
109 
110  msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
111 #if MAVLINK_CRC_EXTRA
113 #else
114  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_LEN);
115 #endif
116 }
117 
139 static inline uint16_t mavlink_msg_command_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
140  mavlink_message_t* msg,
141  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)
142 {
143 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
145  _mav_put_float(buf, 0, param1);
146  _mav_put_float(buf, 4, param2);
147  _mav_put_float(buf, 8, param3);
148  _mav_put_float(buf, 12, param4);
149  _mav_put_int32_t(buf, 16, x);
150  _mav_put_int32_t(buf, 20, y);
151  _mav_put_float(buf, 24, z);
152  _mav_put_uint16_t(buf, 28, command);
153  _mav_put_uint8_t(buf, 30, target_system);
154  _mav_put_uint8_t(buf, 31, target_component);
155  _mav_put_uint8_t(buf, 32, frame);
156  _mav_put_uint8_t(buf, 33, current);
157  _mav_put_uint8_t(buf, 34, autocontinue);
158 
160 #else
161  mavlink_command_int_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.command = command;
170  packet.target_system = target_system;
172  packet.frame = frame;
173  packet.current = current;
174  packet.autocontinue = autocontinue;
175 
177 #endif
178 
179  msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
180 #if MAVLINK_CRC_EXTRA
182 #else
183  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_LEN);
184 #endif
185 }
186 
195 static 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)
196 {
197  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);
198 }
199 
209 static 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)
210 {
211  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);
212 }
213 
232 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
233 
234 static 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)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
238  _mav_put_float(buf, 0, param1);
239  _mav_put_float(buf, 4, param2);
240  _mav_put_float(buf, 8, param3);
241  _mav_put_float(buf, 12, param4);
242  _mav_put_int32_t(buf, 16, x);
243  _mav_put_int32_t(buf, 20, y);
244  _mav_put_float(buf, 24, z);
245  _mav_put_uint16_t(buf, 28, command);
248  _mav_put_uint8_t(buf, 32, frame);
249  _mav_put_uint8_t(buf, 33, current);
250  _mav_put_uint8_t(buf, 34, autocontinue);
251 
252 #if MAVLINK_CRC_EXTRA
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
256 #endif
257 #else
258  mavlink_command_int_t packet;
259  packet.param1 = param1;
260  packet.param2 = param2;
261  packet.param3 = param3;
262  packet.param4 = param4;
263  packet.x = x;
264  packet.y = y;
265  packet.z = z;
266  packet.command = command;
267  packet.target_system = target_system;
269  packet.frame = frame;
270  packet.current = current;
271  packet.autocontinue = autocontinue;
272 
273 #if MAVLINK_CRC_EXTRA
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
275 #else
276  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
277 #endif
278 #endif
279 }
280 
281 #if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
282 /*
283  This varient of _send() can be used to save stack space by re-using
284  memory from the receive buffer. The caller provides a
285  mavlink_message_t which is the size of a full mavlink message. This
286  is usually the receive buffer for the channel, and allows a reply to an
287  incoming message with minimum stack space usage.
288  */
289 static 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)
290 {
291 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292  char *buf = (char *)msgbuf;
293  _mav_put_float(buf, 0, param1);
294  _mav_put_float(buf, 4, param2);
295  _mav_put_float(buf, 8, param3);
296  _mav_put_float(buf, 12, param4);
297  _mav_put_int32_t(buf, 16, x);
298  _mav_put_int32_t(buf, 20, y);
299  _mav_put_float(buf, 24, z);
300  _mav_put_uint16_t(buf, 28, command);
303  _mav_put_uint8_t(buf, 32, frame);
304  _mav_put_uint8_t(buf, 33, current);
305  _mav_put_uint8_t(buf, 34, autocontinue);
306 
307 #if MAVLINK_CRC_EXTRA
309 #else
310  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
311 #endif
312 #else
313  mavlink_command_int_t *packet = (mavlink_command_int_t *)msgbuf;
314  packet->param1 = param1;
315  packet->param2 = param2;
316  packet->param3 = param3;
317  packet->param4 = param4;
318  packet->x = x;
319  packet->y = y;
320  packet->z = z;
321  packet->command = command;
322  packet->target_system = target_system;
324  packet->frame = frame;
325  packet->current = current;
326  packet->autocontinue = autocontinue;
327 
328 #if MAVLINK_CRC_EXTRA
329  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
330 #else
331  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
332 #endif
333 #endif
334 }
335 #endif
336 
337 #endif
338 
339 // MESSAGE COMMAND_INT UNPACKING
340 
341 
347 static inline uint8_t mavlink_msg_command_int_get_target_system(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_uint8_t(msg, 30);
350 }
351 
357 static inline uint8_t mavlink_msg_command_int_get_target_component(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_uint8_t(msg, 31);
360 }
361 
367 static inline uint8_t mavlink_msg_command_int_get_frame(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_uint8_t(msg, 32);
370 }
371 
377 static inline uint16_t mavlink_msg_command_int_get_command(const mavlink_message_t* msg)
378 {
379  return _MAV_RETURN_uint16_t(msg, 28);
380 }
381 
387 static inline uint8_t mavlink_msg_command_int_get_current(const mavlink_message_t* msg)
388 {
389  return _MAV_RETURN_uint8_t(msg, 33);
390 }
391 
397 static inline uint8_t mavlink_msg_command_int_get_autocontinue(const mavlink_message_t* msg)
398 {
399  return _MAV_RETURN_uint8_t(msg, 34);
400 }
401 
407 static inline float mavlink_msg_command_int_get_param1(const mavlink_message_t* msg)
408 {
409  return _MAV_RETURN_float(msg, 0);
410 }
411 
417 static inline float mavlink_msg_command_int_get_param2(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_float(msg, 4);
420 }
421 
427 static inline float mavlink_msg_command_int_get_param3(const mavlink_message_t* msg)
428 {
429  return _MAV_RETURN_float(msg, 8);
430 }
431 
437 static inline float mavlink_msg_command_int_get_param4(const mavlink_message_t* msg)
438 {
439  return _MAV_RETURN_float(msg, 12);
440 }
441 
447 static inline int32_t mavlink_msg_command_int_get_x(const mavlink_message_t* msg)
448 {
449  return _MAV_RETURN_int32_t(msg, 16);
450 }
451 
457 static inline int32_t mavlink_msg_command_int_get_y(const mavlink_message_t* msg)
458 {
459  return _MAV_RETURN_int32_t(msg, 20);
460 }
461 
467 static inline float mavlink_msg_command_int_get_z(const mavlink_message_t* msg)
468 {
469  return _MAV_RETURN_float(msg, 24);
470 }
471 
478 static inline void mavlink_msg_command_int_decode(const mavlink_message_t* msg, mavlink_command_int_t* command_int)
479 {
480 #if MAVLINK_NEED_BYTE_SWAP
481  command_int->param1 = mavlink_msg_command_int_get_param1(msg);
482  command_int->param2 = mavlink_msg_command_int_get_param2(msg);
483  command_int->param3 = mavlink_msg_command_int_get_param3(msg);
484  command_int->param4 = mavlink_msg_command_int_get_param4(msg);
485  command_int->x = mavlink_msg_command_int_get_x(msg);
486  command_int->y = mavlink_msg_command_int_get_y(msg);
487  command_int->z = mavlink_msg_command_int_get_z(msg);
488  command_int->command = mavlink_msg_command_int_get_command(msg);
491  command_int->frame = mavlink_msg_command_int_get_frame(msg);
492  command_int->current = mavlink_msg_command_int_get_current(msg);
494 #else
495  memcpy(command_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_INT_LEN);
496 #endif
497 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46