source: flair-src/trunk/tools/Controller/Mavlink/src/include/common/mavlink_msg_hil_controls.h@ 88

Last change on this file since 88 was 88, checked in by Sanahuja Guillaume, 8 years ago

m

File size: 18.2 KB
Line 
1// MESSAGE HIL_CONTROLS PACKING
2
3#define MAVLINK_MSG_ID_HIL_CONTROLS 91
4
5typedef struct MAVLINK_PACKED __mavlink_hil_controls_t
6{
7 uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
8 float roll_ailerons; /*< Control output -1 .. 1*/
9 float pitch_elevator; /*< Control output -1 .. 1*/
10 float yaw_rudder; /*< Control output -1 .. 1*/
11 float throttle; /*< Throttle 0 .. 1*/
12 float aux1; /*< Aux 1, -1 .. 1*/
13 float aux2; /*< Aux 2, -1 .. 1*/
14 float aux3; /*< Aux 3, -1 .. 1*/
15 float aux4; /*< Aux 4, -1 .. 1*/
16 uint8_t mode; /*< System mode (MAV_MODE)*/
17 uint8_t nav_mode; /*< Navigation mode (MAV_NAV_MODE)*/
18} mavlink_hil_controls_t;
19
20#define MAVLINK_MSG_ID_HIL_CONTROLS_LEN 42
21#define MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN 42
22#define MAVLINK_MSG_ID_91_LEN 42
23#define MAVLINK_MSG_ID_91_MIN_LEN 42
24
25#define MAVLINK_MSG_ID_HIL_CONTROLS_CRC 63
26#define MAVLINK_MSG_ID_91_CRC 63
27
28
29
30#if MAVLINK_COMMAND_24BIT
31#define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
32 91, \
33 "HIL_CONTROLS", \
34 11, \
35 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
36 { "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
37 { "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
38 { "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
39 { "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
40 { "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
41 { "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
42 { "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
43 { "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
44 { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
45 { "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
46 } \
47}
48#else
49#define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
50 "HIL_CONTROLS", \
51 11, \
52 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
53 { "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
54 { "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
55 { "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
56 { "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
57 { "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
58 { "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
59 { "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
60 { "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
61 { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
62 { "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
63 } \
64}
65#endif
66
67/**
68 * @brief Pack a hil_controls message
69 * @param system_id ID of this system
70 * @param component_id ID of this component (e.g. 200 for IMU)
71 * @param msg The MAVLink message to compress the data into
72 *
73 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
74 * @param roll_ailerons Control output -1 .. 1
75 * @param pitch_elevator Control output -1 .. 1
76 * @param yaw_rudder Control output -1 .. 1
77 * @param throttle Throttle 0 .. 1
78 * @param aux1 Aux 1, -1 .. 1
79 * @param aux2 Aux 2, -1 .. 1
80 * @param aux3 Aux 3, -1 .. 1
81 * @param aux4 Aux 4, -1 .. 1
82 * @param mode System mode (MAV_MODE)
83 * @param nav_mode Navigation mode (MAV_NAV_MODE)
84 * @return length of the message in bytes (excluding serial stream start sign)
85 */
86static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
87 uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
88{
89#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
91 _mav_put_uint64_t(buf, 0, time_usec);
92 _mav_put_float(buf, 8, roll_ailerons);
93 _mav_put_float(buf, 12, pitch_elevator);
94 _mav_put_float(buf, 16, yaw_rudder);
95 _mav_put_float(buf, 20, throttle);
96 _mav_put_float(buf, 24, aux1);
97 _mav_put_float(buf, 28, aux2);
98 _mav_put_float(buf, 32, aux3);
99 _mav_put_float(buf, 36, aux4);
100 _mav_put_uint8_t(buf, 40, mode);
101 _mav_put_uint8_t(buf, 41, nav_mode);
102
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
104#else
105 mavlink_hil_controls_t packet;
106 packet.time_usec = time_usec;
107 packet.roll_ailerons = roll_ailerons;
108 packet.pitch_elevator = pitch_elevator;
109 packet.yaw_rudder = yaw_rudder;
110 packet.throttle = throttle;
111 packet.aux1 = aux1;
112 packet.aux2 = aux2;
113 packet.aux3 = aux3;
114 packet.aux4 = aux4;
115 packet.mode = mode;
116 packet.nav_mode = nav_mode;
117
118 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
119#endif
120
121 msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
122 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
123}
124
125/**
126 * @brief Pack a hil_controls message on a channel
127 * @param system_id ID of this system
128 * @param component_id ID of this component (e.g. 200 for IMU)
129 * @param chan The MAVLink channel this message will be sent over
130 * @param msg The MAVLink message to compress the data into
131 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
132 * @param roll_ailerons Control output -1 .. 1
133 * @param pitch_elevator Control output -1 .. 1
134 * @param yaw_rudder Control output -1 .. 1
135 * @param throttle Throttle 0 .. 1
136 * @param aux1 Aux 1, -1 .. 1
137 * @param aux2 Aux 2, -1 .. 1
138 * @param aux3 Aux 3, -1 .. 1
139 * @param aux4 Aux 4, -1 .. 1
140 * @param mode System mode (MAV_MODE)
141 * @param nav_mode Navigation mode (MAV_NAV_MODE)
142 * @return length of the message in bytes (excluding serial stream start sign)
143 */
144static inline uint16_t mavlink_msg_hil_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
145 mavlink_message_t* msg,
146 uint64_t time_usec,float roll_ailerons,float pitch_elevator,float yaw_rudder,float throttle,float aux1,float aux2,float aux3,float aux4,uint8_t mode,uint8_t nav_mode)
147{
148#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
150 _mav_put_uint64_t(buf, 0, time_usec);
151 _mav_put_float(buf, 8, roll_ailerons);
152 _mav_put_float(buf, 12, pitch_elevator);
153 _mav_put_float(buf, 16, yaw_rudder);
154 _mav_put_float(buf, 20, throttle);
155 _mav_put_float(buf, 24, aux1);
156 _mav_put_float(buf, 28, aux2);
157 _mav_put_float(buf, 32, aux3);
158 _mav_put_float(buf, 36, aux4);
159 _mav_put_uint8_t(buf, 40, mode);
160 _mav_put_uint8_t(buf, 41, nav_mode);
161
162 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
163#else
164 mavlink_hil_controls_t packet;
165 packet.time_usec = time_usec;
166 packet.roll_ailerons = roll_ailerons;
167 packet.pitch_elevator = pitch_elevator;
168 packet.yaw_rudder = yaw_rudder;
169 packet.throttle = throttle;
170 packet.aux1 = aux1;
171 packet.aux2 = aux2;
172 packet.aux3 = aux3;
173 packet.aux4 = aux4;
174 packet.mode = mode;
175 packet.nav_mode = nav_mode;
176
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
178#endif
179
180 msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
181 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
182}
183
184/**
185 * @brief Encode a hil_controls struct
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 hil_controls C-struct to read the message contents from
191 */
192static inline uint16_t mavlink_msg_hil_controls_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
193{
194 return mavlink_msg_hil_controls_pack(system_id, component_id, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
195}
196
197/**
198 * @brief Encode a hil_controls struct on a channel
199 *
200 * @param system_id ID of this system
201 * @param component_id ID of this component (e.g. 200 for IMU)
202 * @param chan The MAVLink channel this message will be sent over
203 * @param msg The MAVLink message to compress the data into
204 * @param hil_controls C-struct to read the message contents from
205 */
206static inline uint16_t mavlink_msg_hil_controls_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
207{
208 return mavlink_msg_hil_controls_pack_chan(system_id, component_id, chan, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
209}
210
211/**
212 * @brief Send a hil_controls message
213 * @param chan MAVLink channel to send the message
214 *
215 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
216 * @param roll_ailerons Control output -1 .. 1
217 * @param pitch_elevator Control output -1 .. 1
218 * @param yaw_rudder Control output -1 .. 1
219 * @param throttle Throttle 0 .. 1
220 * @param aux1 Aux 1, -1 .. 1
221 * @param aux2 Aux 2, -1 .. 1
222 * @param aux3 Aux 3, -1 .. 1
223 * @param aux4 Aux 4, -1 .. 1
224 * @param mode System mode (MAV_MODE)
225 * @param nav_mode Navigation mode (MAV_NAV_MODE)
226 */
227#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
228
229static inline void mavlink_msg_hil_controls_send(mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
230{
231#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
232 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
233 _mav_put_uint64_t(buf, 0, time_usec);
234 _mav_put_float(buf, 8, roll_ailerons);
235 _mav_put_float(buf, 12, pitch_elevator);
236 _mav_put_float(buf, 16, yaw_rudder);
237 _mav_put_float(buf, 20, throttle);
238 _mav_put_float(buf, 24, aux1);
239 _mav_put_float(buf, 28, aux2);
240 _mav_put_float(buf, 32, aux3);
241 _mav_put_float(buf, 36, aux4);
242 _mav_put_uint8_t(buf, 40, mode);
243 _mav_put_uint8_t(buf, 41, nav_mode);
244
245 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
246#else
247 mavlink_hil_controls_t packet;
248 packet.time_usec = time_usec;
249 packet.roll_ailerons = roll_ailerons;
250 packet.pitch_elevator = pitch_elevator;
251 packet.yaw_rudder = yaw_rudder;
252 packet.throttle = throttle;
253 packet.aux1 = aux1;
254 packet.aux2 = aux2;
255 packet.aux3 = aux3;
256 packet.aux4 = aux4;
257 packet.mode = mode;
258 packet.nav_mode = nav_mode;
259
260 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
261#endif
262}
263
264/**
265 * @brief Send a hil_controls message
266 * @param chan MAVLink channel to send the message
267 * @param struct The MAVLink struct to serialize
268 */
269static inline void mavlink_msg_hil_controls_send_struct(mavlink_channel_t chan, const mavlink_hil_controls_t* hil_controls)
270{
271#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272 mavlink_msg_hil_controls_send(chan, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
273#else
274 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)hil_controls, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
275#endif
276}
277
278#if MAVLINK_MSG_ID_HIL_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
279/*
280 This varient of _send() can be used to save stack space by re-using
281 memory from the receive buffer. The caller provides a
282 mavlink_message_t which is the size of a full mavlink message. This
283 is usually the receive buffer for the channel, and allows a reply to an
284 incoming message with minimum stack space usage.
285 */
286static inline void mavlink_msg_hil_controls_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
287{
288#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
289 char *buf = (char *)msgbuf;
290 _mav_put_uint64_t(buf, 0, time_usec);
291 _mav_put_float(buf, 8, roll_ailerons);
292 _mav_put_float(buf, 12, pitch_elevator);
293 _mav_put_float(buf, 16, yaw_rudder);
294 _mav_put_float(buf, 20, throttle);
295 _mav_put_float(buf, 24, aux1);
296 _mav_put_float(buf, 28, aux2);
297 _mav_put_float(buf, 32, aux3);
298 _mav_put_float(buf, 36, aux4);
299 _mav_put_uint8_t(buf, 40, mode);
300 _mav_put_uint8_t(buf, 41, nav_mode);
301
302 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
303#else
304 mavlink_hil_controls_t *packet = (mavlink_hil_controls_t *)msgbuf;
305 packet->time_usec = time_usec;
306 packet->roll_ailerons = roll_ailerons;
307 packet->pitch_elevator = pitch_elevator;
308 packet->yaw_rudder = yaw_rudder;
309 packet->throttle = throttle;
310 packet->aux1 = aux1;
311 packet->aux2 = aux2;
312 packet->aux3 = aux3;
313 packet->aux4 = aux4;
314 packet->mode = mode;
315 packet->nav_mode = nav_mode;
316
317 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
318#endif
319}
320#endif
321
322#endif
323
324// MESSAGE HIL_CONTROLS UNPACKING
325
326
327/**
328 * @brief Get field time_usec from hil_controls message
329 *
330 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
331 */
332static inline uint64_t mavlink_msg_hil_controls_get_time_usec(const mavlink_message_t* msg)
333{
334 return _MAV_RETURN_uint64_t(msg, 0);
335}
336
337/**
338 * @brief Get field roll_ailerons from hil_controls message
339 *
340 * @return Control output -1 .. 1
341 */
342static inline float mavlink_msg_hil_controls_get_roll_ailerons(const mavlink_message_t* msg)
343{
344 return _MAV_RETURN_float(msg, 8);
345}
346
347/**
348 * @brief Get field pitch_elevator from hil_controls message
349 *
350 * @return Control output -1 .. 1
351 */
352static inline float mavlink_msg_hil_controls_get_pitch_elevator(const mavlink_message_t* msg)
353{
354 return _MAV_RETURN_float(msg, 12);
355}
356
357/**
358 * @brief Get field yaw_rudder from hil_controls message
359 *
360 * @return Control output -1 .. 1
361 */
362static inline float mavlink_msg_hil_controls_get_yaw_rudder(const mavlink_message_t* msg)
363{
364 return _MAV_RETURN_float(msg, 16);
365}
366
367/**
368 * @brief Get field throttle from hil_controls message
369 *
370 * @return Throttle 0 .. 1
371 */
372static inline float mavlink_msg_hil_controls_get_throttle(const mavlink_message_t* msg)
373{
374 return _MAV_RETURN_float(msg, 20);
375}
376
377/**
378 * @brief Get field aux1 from hil_controls message
379 *
380 * @return Aux 1, -1 .. 1
381 */
382static inline float mavlink_msg_hil_controls_get_aux1(const mavlink_message_t* msg)
383{
384 return _MAV_RETURN_float(msg, 24);
385}
386
387/**
388 * @brief Get field aux2 from hil_controls message
389 *
390 * @return Aux 2, -1 .. 1
391 */
392static inline float mavlink_msg_hil_controls_get_aux2(const mavlink_message_t* msg)
393{
394 return _MAV_RETURN_float(msg, 28);
395}
396
397/**
398 * @brief Get field aux3 from hil_controls message
399 *
400 * @return Aux 3, -1 .. 1
401 */
402static inline float mavlink_msg_hil_controls_get_aux3(const mavlink_message_t* msg)
403{
404 return _MAV_RETURN_float(msg, 32);
405}
406
407/**
408 * @brief Get field aux4 from hil_controls message
409 *
410 * @return Aux 4, -1 .. 1
411 */
412static inline float mavlink_msg_hil_controls_get_aux4(const mavlink_message_t* msg)
413{
414 return _MAV_RETURN_float(msg, 36);
415}
416
417/**
418 * @brief Get field mode from hil_controls message
419 *
420 * @return System mode (MAV_MODE)
421 */
422static inline uint8_t mavlink_msg_hil_controls_get_mode(const mavlink_message_t* msg)
423{
424 return _MAV_RETURN_uint8_t(msg, 40);
425}
426
427/**
428 * @brief Get field nav_mode from hil_controls message
429 *
430 * @return Navigation mode (MAV_NAV_MODE)
431 */
432static inline uint8_t mavlink_msg_hil_controls_get_nav_mode(const mavlink_message_t* msg)
433{
434 return _MAV_RETURN_uint8_t(msg, 41);
435}
436
437/**
438 * @brief Decode a hil_controls message into a struct
439 *
440 * @param msg The message to decode
441 * @param hil_controls C-struct to decode the message contents into
442 */
443static inline void mavlink_msg_hil_controls_decode(const mavlink_message_t* msg, mavlink_hil_controls_t* hil_controls)
444{
445#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
446 hil_controls->time_usec = mavlink_msg_hil_controls_get_time_usec(msg);
447 hil_controls->roll_ailerons = mavlink_msg_hil_controls_get_roll_ailerons(msg);
448 hil_controls->pitch_elevator = mavlink_msg_hil_controls_get_pitch_elevator(msg);
449 hil_controls->yaw_rudder = mavlink_msg_hil_controls_get_yaw_rudder(msg);
450 hil_controls->throttle = mavlink_msg_hil_controls_get_throttle(msg);
451 hil_controls->aux1 = mavlink_msg_hil_controls_get_aux1(msg);
452 hil_controls->aux2 = mavlink_msg_hil_controls_get_aux2(msg);
453 hil_controls->aux3 = mavlink_msg_hil_controls_get_aux3(msg);
454 hil_controls->aux4 = mavlink_msg_hil_controls_get_aux4(msg);
455 hil_controls->mode = mavlink_msg_hil_controls_get_mode(msg);
456 hil_controls->nav_mode = mavlink_msg_hil_controls_get_nav_mode(msg);
457#else
458 uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_CONTROLS_LEN? msg->len : MAVLINK_MSG_ID_HIL_CONTROLS_LEN;
459 memset(hil_controls, 0, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
460 memcpy(hil_controls, _MAV_PAYLOAD(msg), len);
461#endif
462}
Note: See TracBrowser for help on using the repository browser.