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