Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_hil_state_quaternion.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE HIL_STATE_QUATERNION PACKING
3
4#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115
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 attitude_quaternion[4]; /*< Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)*/
10 float rollspeed; /*< [rad/s] Body frame roll / phi angular speed*/
11 float pitchspeed; /*< [rad/s] Body frame pitch / theta angular speed*/
12 float yawspeed; /*< [rad/s] Body frame yaw / psi angular speed*/
13 int32_t lat; /*< [degE7] Latitude*/
14 int32_t lon; /*< [degE7] Longitude*/
15 int32_t alt; /*< [mm] Altitude*/
16 int16_t vx; /*< [cm/s] Ground X Speed (Latitude)*/
17 int16_t vy; /*< [cm/s] Ground Y Speed (Longitude)*/
18 int16_t vz; /*< [cm/s] Ground Z Speed (Altitude)*/
19 uint16_t ind_airspeed; /*< [cm/s] Indicated airspeed*/
20 uint16_t true_airspeed; /*< [cm/s] True airspeed*/
21 int16_t xacc; /*< [mG] X acceleration*/
22 int16_t yacc; /*< [mG] Y acceleration*/
23 int16_t zacc; /*< [mG] Z acceleration*/
24} mavlink_hil_state_quaternion_t;
25
26#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN 64
27#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN 64
28#define MAVLINK_MSG_ID_115_LEN 64
29#define MAVLINK_MSG_ID_115_MIN_LEN 64
30
31#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4
32#define MAVLINK_MSG_ID_115_CRC 4
33
34#define MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_ATTITUDE_QUATERNION_LEN 4
35
36#if MAVLINK_COMMAND_24BIT
37#define MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION {
38 115,
39 "HIL_STATE_QUATERNION",
40 16,
41 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_quaternion_t, time_usec) },
42 { "attitude_quaternion", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_hil_state_quaternion_t, attitude_quaternion) },
43 { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_quaternion_t, rollspeed) },
44 { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_quaternion_t, pitchspeed) },
45 { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_state_quaternion_t, yawspeed) },
46 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_quaternion_t, lat) },
47 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_quaternion_t, lon) },
48 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_hil_state_quaternion_t, alt) },
49 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_quaternion_t, vx) },
50 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_quaternion_t, vy) },
51 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_quaternion_t, vz) },
52 { "ind_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_hil_state_quaternion_t, ind_airspeed) },
53 { "true_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_hil_state_quaternion_t, true_airspeed) },
54 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_hil_state_quaternion_t, xacc) },
55 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_hil_state_quaternion_t, yacc) },
56 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_hil_state_quaternion_t, zacc) },
57 } \
58}
59#else
60#define MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION {
61 "HIL_STATE_QUATERNION",
62 16,
63 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_quaternion_t, time_usec) },
64 { "attitude_quaternion", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_hil_state_quaternion_t, attitude_quaternion) },
65 { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_quaternion_t, rollspeed) },
66 { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_quaternion_t, pitchspeed) },
67 { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_state_quaternion_t, yawspeed) },
68 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_quaternion_t, lat) },
69 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_quaternion_t, lon) },
70 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_hil_state_quaternion_t, alt) },
71 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_quaternion_t, vx) },
72 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_quaternion_t, vy) },
73 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_quaternion_t, vz) },
74 { "ind_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_hil_state_quaternion_t, ind_airspeed) },
75 { "true_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_hil_state_quaternion_t, true_airspeed) },
76 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_hil_state_quaternion_t, xacc) },
77 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_hil_state_quaternion_t, yacc) },
78 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_hil_state_quaternion_t, zacc) },
79 } \
80}
81#endif
82
83/**
84 * @brief Pack a hil_state_quaternion message
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param msg The MAVLink message to compress the data into
88 *
89 * @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.
90 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
91 * @param rollspeed [rad/s] Body frame roll / phi angular speed
92 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
93 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
94 * @param lat [degE7] Latitude
95 * @param lon [degE7] Longitude
96 * @param alt [mm] Altitude
97 * @param vx [cm/s] Ground X Speed (Latitude)
98 * @param vy [cm/s] Ground Y Speed (Longitude)
99 * @param vz [cm/s] Ground Z Speed (Altitude)
100 * @param ind_airspeed [cm/s] Indicated airspeed
101 * @param true_airspeed [cm/s] True airspeed
102 * @param xacc [mG] X acceleration
103 * @param yacc [mG] Y acceleration
104 * @param zacc [mG] Z acceleration
105 * @return length of the message in bytes (excluding serial stream start sign)
106 */
107static inline uint16_t mavlink_msg_hil_state_quaternion_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
108 uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc)
109{
110#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
112 _mav_put_uint64_t(buf, 0, time_usec);
113 _mav_put_float(buf, 24, rollspeed);
114 _mav_put_float(buf, 28, pitchspeed);
115 _mav_put_float(buf, 32, yawspeed);
116 _mav_put_int32_t(buf, 36, lat);
117 _mav_put_int32_t(buf, 40, lon);
118 _mav_put_int32_t(buf, 44, alt);
119 _mav_put_int16_t(buf, 48, vx);
120 _mav_put_int16_t(buf, 50, vy);
121 _mav_put_int16_t(buf, 52, vz);
122 _mav_put_uint16_t(buf, 54, ind_airspeed);
123 _mav_put_uint16_t(buf, 56, true_airspeed);
124 _mav_put_int16_t(buf, 58, xacc);
125 _mav_put_int16_t(buf, 60, yacc);
126 _mav_put_int16_t(buf, 62, zacc);
127 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
129#else
130 mavlink_hil_state_quaternion_t packet;
131 packet.time_usec = time_usec;
132 packet.rollspeed = rollspeed;
133 packet.pitchspeed = pitchspeed;
134 packet.yawspeed = yawspeed;
135 packet.lat = lat;
136 packet.lon = lon;
137 packet.alt = alt;
138 packet.vx = vx;
139 packet.vy = vy;
140 packet.vz = vz;
141 packet.ind_airspeed = ind_airspeed;
142 packet.true_airspeed = true_airspeed;
143 packet.xacc = xacc;
144 packet.yacc = yacc;
145 packet.zacc = zacc;
146 mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
148#endif
149
152}
153
154/**
155 * @brief Pack a hil_state_quaternion message
156 * @param system_id ID of this system
157 * @param component_id ID of this component (e.g. 200 for IMU)
158 * @param status MAVLink status structure
159 * @param msg The MAVLink message to compress the data into
160 *
161 * @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.
162 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
163 * @param rollspeed [rad/s] Body frame roll / phi angular speed
164 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
165 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
166 * @param lat [degE7] Latitude
167 * @param lon [degE7] Longitude
168 * @param alt [mm] Altitude
169 * @param vx [cm/s] Ground X Speed (Latitude)
170 * @param vy [cm/s] Ground Y Speed (Longitude)
171 * @param vz [cm/s] Ground Z Speed (Altitude)
172 * @param ind_airspeed [cm/s] Indicated airspeed
173 * @param true_airspeed [cm/s] True airspeed
174 * @param xacc [mG] X acceleration
175 * @param yacc [mG] Y acceleration
176 * @param zacc [mG] Z acceleration
177 * @return length of the message in bytes (excluding serial stream start sign)
178 */
179static inline uint16_t mavlink_msg_hil_state_quaternion_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
180 uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 _mav_put_uint64_t(buf, 0, time_usec);
185 _mav_put_float(buf, 24, rollspeed);
186 _mav_put_float(buf, 28, pitchspeed);
187 _mav_put_float(buf, 32, yawspeed);
188 _mav_put_int32_t(buf, 36, lat);
189 _mav_put_int32_t(buf, 40, lon);
190 _mav_put_int32_t(buf, 44, alt);
191 _mav_put_int16_t(buf, 48, vx);
192 _mav_put_int16_t(buf, 50, vy);
193 _mav_put_int16_t(buf, 52, vz);
194 _mav_put_uint16_t(buf, 54, ind_airspeed);
195 _mav_put_uint16_t(buf, 56, true_airspeed);
196 _mav_put_int16_t(buf, 58, xacc);
197 _mav_put_int16_t(buf, 60, yacc);
198 _mav_put_int16_t(buf, 62, zacc);
199 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
200 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
201#else
202 mavlink_hil_state_quaternion_t packet;
203 packet.time_usec = time_usec;
204 packet.rollspeed = rollspeed;
205 packet.pitchspeed = pitchspeed;
206 packet.yawspeed = yawspeed;
207 packet.lat = lat;
208 packet.lon = lon;
209 packet.alt = alt;
210 packet.vx = vx;
211 packet.vy = vy;
212 packet.vz = vz;
213 packet.ind_airspeed = ind_airspeed;
214 packet.true_airspeed = true_airspeed;
215 packet.xacc = xacc;
216 packet.yacc = yacc;
217 packet.zacc = zacc;
218 mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
219 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
220#endif
221
223#if MAVLINK_CRC_EXTRA
224 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
225#else
226 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
227#endif
228}
229
230/**
231 * @brief Pack a hil_state_quaternion message on a channel
232 * @param system_id ID of this system
233 * @param component_id ID of this component (e.g. 200 for IMU)
234 * @param chan The MAVLink channel this message will be sent over
235 * @param msg The MAVLink message to compress the data into
236 * @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.
237 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
238 * @param rollspeed [rad/s] Body frame roll / phi angular speed
239 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
240 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
241 * @param lat [degE7] Latitude
242 * @param lon [degE7] Longitude
243 * @param alt [mm] Altitude
244 * @param vx [cm/s] Ground X Speed (Latitude)
245 * @param vy [cm/s] Ground Y Speed (Longitude)
246 * @param vz [cm/s] Ground Z Speed (Altitude)
247 * @param ind_airspeed [cm/s] Indicated airspeed
248 * @param true_airspeed [cm/s] True airspeed
249 * @param xacc [mG] X acceleration
250 * @param yacc [mG] Y acceleration
251 * @param zacc [mG] Z acceleration
252 * @return length of the message in bytes (excluding serial stream start sign)
253 */
254static inline uint16_t mavlink_msg_hil_state_quaternion_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
255 mavlink_message_t* msg,
256 uint64_t time_usec,const float *attitude_quaternion,float rollspeed,float pitchspeed,float yawspeed,int32_t lat,int32_t lon,int32_t alt,int16_t vx,int16_t vy,int16_t vz,uint16_t ind_airspeed,uint16_t true_airspeed,int16_t xacc,int16_t yacc,int16_t zacc)
257{
258#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
260 _mav_put_uint64_t(buf, 0, time_usec);
261 _mav_put_float(buf, 24, rollspeed);
262 _mav_put_float(buf, 28, pitchspeed);
263 _mav_put_float(buf, 32, yawspeed);
264 _mav_put_int32_t(buf, 36, lat);
265 _mav_put_int32_t(buf, 40, lon);
266 _mav_put_int32_t(buf, 44, alt);
267 _mav_put_int16_t(buf, 48, vx);
268 _mav_put_int16_t(buf, 50, vy);
269 _mav_put_int16_t(buf, 52, vz);
270 _mav_put_uint16_t(buf, 54, ind_airspeed);
271 _mav_put_uint16_t(buf, 56, true_airspeed);
272 _mav_put_int16_t(buf, 58, xacc);
273 _mav_put_int16_t(buf, 60, yacc);
274 _mav_put_int16_t(buf, 62, zacc);
275 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
276 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
277#else
278 mavlink_hil_state_quaternion_t packet;
279 packet.time_usec = time_usec;
280 packet.rollspeed = rollspeed;
281 packet.pitchspeed = pitchspeed;
282 packet.yawspeed = yawspeed;
283 packet.lat = lat;
284 packet.lon = lon;
285 packet.alt = alt;
286 packet.vx = vx;
287 packet.vy = vy;
288 packet.vz = vz;
289 packet.ind_airspeed = ind_airspeed;
290 packet.true_airspeed = true_airspeed;
291 packet.xacc = xacc;
292 packet.yacc = yacc;
293 packet.zacc = zacc;
294 mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
295 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
296#endif
297
299 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
300}
301
302/**
303 * @brief Encode a hil_state_quaternion struct
304 *
305 * @param system_id ID of this system
306 * @param component_id ID of this component (e.g. 200 for IMU)
307 * @param msg The MAVLink message to compress the data into
308 * @param hil_state_quaternion C-struct to read the message contents from
309 */
310static inline uint16_t mavlink_msg_hil_state_quaternion_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
311{
312 return mavlink_msg_hil_state_quaternion_pack(system_id, component_id, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc);
313}
314
315/**
316 * @brief Encode a hil_state_quaternion struct on a channel
317 *
318 * @param system_id ID of this system
319 * @param component_id ID of this component (e.g. 200 for IMU)
320 * @param chan The MAVLink channel this message will be sent over
321 * @param msg The MAVLink message to compress the data into
322 * @param hil_state_quaternion C-struct to read the message contents from
323 */
324static inline uint16_t mavlink_msg_hil_state_quaternion_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
325{
326 return mavlink_msg_hil_state_quaternion_pack_chan(system_id, component_id, chan, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc);
327}
328
329/**
330 * @brief Encode a hil_state_quaternion struct with provided status structure
331 *
332 * @param system_id ID of this system
333 * @param component_id ID of this component (e.g. 200 for IMU)
334 * @param status MAVLink status structure
335 * @param msg The MAVLink message to compress the data into
336 * @param hil_state_quaternion C-struct to read the message contents from
337 */
338static inline uint16_t mavlink_msg_hil_state_quaternion_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
339{
340 return mavlink_msg_hil_state_quaternion_pack_status(system_id, component_id, _status, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc);
341}
342
343/**
344 * @brief Send a hil_state_quaternion message
345 * @param chan MAVLink channel to send the message
346 *
347 * @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.
348 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
349 * @param rollspeed [rad/s] Body frame roll / phi angular speed
350 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
351 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
352 * @param lat [degE7] Latitude
353 * @param lon [degE7] Longitude
354 * @param alt [mm] Altitude
355 * @param vx [cm/s] Ground X Speed (Latitude)
356 * @param vy [cm/s] Ground Y Speed (Longitude)
357 * @param vz [cm/s] Ground Z Speed (Altitude)
358 * @param ind_airspeed [cm/s] Indicated airspeed
359 * @param true_airspeed [cm/s] True airspeed
360 * @param xacc [mG] X acceleration
361 * @param yacc [mG] Y acceleration
362 * @param zacc [mG] Z acceleration
363 */
364#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
365
366static inline void mavlink_msg_hil_state_quaternion_send(mavlink_channel_t chan, uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc)
367{
368#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
369 char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN];
370 _mav_put_uint64_t(buf, 0, time_usec);
371 _mav_put_float(buf, 24, rollspeed);
372 _mav_put_float(buf, 28, pitchspeed);
373 _mav_put_float(buf, 32, yawspeed);
374 _mav_put_int32_t(buf, 36, lat);
375 _mav_put_int32_t(buf, 40, lon);
376 _mav_put_int32_t(buf, 44, alt);
377 _mav_put_int16_t(buf, 48, vx);
378 _mav_put_int16_t(buf, 50, vy);
379 _mav_put_int16_t(buf, 52, vz);
380 _mav_put_uint16_t(buf, 54, ind_airspeed);
381 _mav_put_uint16_t(buf, 56, true_airspeed);
382 _mav_put_int16_t(buf, 58, xacc);
383 _mav_put_int16_t(buf, 60, yacc);
384 _mav_put_int16_t(buf, 62, zacc);
385 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
386 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
387#else
388 mavlink_hil_state_quaternion_t packet;
389 packet.time_usec = time_usec;
390 packet.rollspeed = rollspeed;
391 packet.pitchspeed = pitchspeed;
392 packet.yawspeed = yawspeed;
393 packet.lat = lat;
394 packet.lon = lon;
395 packet.alt = alt;
396 packet.vx = vx;
397 packet.vy = vy;
398 packet.vz = vz;
399 packet.ind_airspeed = ind_airspeed;
400 packet.true_airspeed = true_airspeed;
401 packet.xacc = xacc;
402 packet.yacc = yacc;
403 packet.zacc = zacc;
404 mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
405 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
406#endif
407}
408
409/**
410 * @brief Send a hil_state_quaternion message
411 * @param chan MAVLink channel to send the message
412 * @param struct The MAVLink struct to serialize
413 */
414static inline void mavlink_msg_hil_state_quaternion_send_struct(mavlink_channel_t chan, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
415{
416#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
417 mavlink_msg_hil_state_quaternion_send(chan, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc);
418#else
419 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)hil_state_quaternion, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
420#endif
421}
422
423#if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
424/*
425 This variant of _send() can be used to save stack space by reusing
426 memory from the receive buffer. The caller provides a
427 mavlink_message_t which is the size of a full mavlink message. This
428 is usually the receive buffer for the channel, and allows a reply to an
429 incoming message with minimum stack space usage.
430 */
431static inline void mavlink_msg_hil_state_quaternion_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc)
432{
433#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
434 char *buf = (char *)msgbuf;
435 _mav_put_uint64_t(buf, 0, time_usec);
436 _mav_put_float(buf, 24, rollspeed);
437 _mav_put_float(buf, 28, pitchspeed);
438 _mav_put_float(buf, 32, yawspeed);
439 _mav_put_int32_t(buf, 36, lat);
440 _mav_put_int32_t(buf, 40, lon);
441 _mav_put_int32_t(buf, 44, alt);
442 _mav_put_int16_t(buf, 48, vx);
443 _mav_put_int16_t(buf, 50, vy);
444 _mav_put_int16_t(buf, 52, vz);
445 _mav_put_uint16_t(buf, 54, ind_airspeed);
446 _mav_put_uint16_t(buf, 56, true_airspeed);
447 _mav_put_int16_t(buf, 58, xacc);
448 _mav_put_int16_t(buf, 60, yacc);
449 _mav_put_int16_t(buf, 62, zacc);
450 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
451 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
452#else
453 mavlink_hil_state_quaternion_t *packet = (mavlink_hil_state_quaternion_t *)msgbuf;
454 packet->time_usec = time_usec;
455 packet->rollspeed = rollspeed;
456 packet->pitchspeed = pitchspeed;
457 packet->yawspeed = yawspeed;
458 packet->lat = lat;
459 packet->lon = lon;
460 packet->alt = alt;
461 packet->vx = vx;
462 packet->vy = vy;
463 packet->vz = vz;
464 packet->ind_airspeed = ind_airspeed;
465 packet->true_airspeed = true_airspeed;
466 packet->xacc = xacc;
467 packet->yacc = yacc;
468 packet->zacc = zacc;
469 mav_array_memcpy(packet->attitude_quaternion, attitude_quaternion, sizeof(float)*4);
470 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
471#endif
472}
473#endif
474
475#endif
476
477// MESSAGE HIL_STATE_QUATERNION UNPACKING
478
479
480/**
481 * @brief Get field time_usec from hil_state_quaternion message
482 *
483 * @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.
484 */
485static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t* msg)
486{
487 return _MAV_RETURN_uint64_t(msg, 0);
488}
489
490/**
491 * @brief Get field attitude_quaternion from hil_state_quaternion message
492 *
493 * @return Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
494 */
495static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t* msg, float *attitude_quaternion)
496{
497 return _MAV_RETURN_float_array(msg, attitude_quaternion, 4, 8);
498}
499
500/**
501 * @brief Get field rollspeed from hil_state_quaternion message
502 *
503 * @return [rad/s] Body frame roll / phi angular speed
504 */
505static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t* msg)
506{
507 return _MAV_RETURN_float(msg, 24);
508}
509
510/**
511 * @brief Get field pitchspeed from hil_state_quaternion message
512 *
513 * @return [rad/s] Body frame pitch / theta angular speed
514 */
515static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t* msg)
516{
517 return _MAV_RETURN_float(msg, 28);
518}
519
520/**
521 * @brief Get field yawspeed from hil_state_quaternion message
522 *
523 * @return [rad/s] Body frame yaw / psi angular speed
524 */
525static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t* msg)
526{
527 return _MAV_RETURN_float(msg, 32);
528}
529
530/**
531 * @brief Get field lat from hil_state_quaternion message
532 *
533 * @return [degE7] Latitude
534 */
535static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t* msg)
536{
537 return _MAV_RETURN_int32_t(msg, 36);
538}
539
540/**
541 * @brief Get field lon from hil_state_quaternion message
542 *
543 * @return [degE7] Longitude
544 */
545static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_int32_t(msg, 40);
548}
549
550/**
551 * @brief Get field alt from hil_state_quaternion message
552 *
553 * @return [mm] Altitude
554 */
555static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t* msg)
556{
557 return _MAV_RETURN_int32_t(msg, 44);
558}
559
560/**
561 * @brief Get field vx from hil_state_quaternion message
562 *
563 * @return [cm/s] Ground X Speed (Latitude)
564 */
565static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t* msg)
566{
567 return _MAV_RETURN_int16_t(msg, 48);
568}
569
570/**
571 * @brief Get field vy from hil_state_quaternion message
572 *
573 * @return [cm/s] Ground Y Speed (Longitude)
574 */
575static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t* msg)
576{
577 return _MAV_RETURN_int16_t(msg, 50);
578}
579
580/**
581 * @brief Get field vz from hil_state_quaternion message
582 *
583 * @return [cm/s] Ground Z Speed (Altitude)
584 */
585static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t* msg)
586{
587 return _MAV_RETURN_int16_t(msg, 52);
588}
589
590/**
591 * @brief Get field ind_airspeed from hil_state_quaternion message
592 *
593 * @return [cm/s] Indicated airspeed
594 */
595static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t* msg)
596{
597 return _MAV_RETURN_uint16_t(msg, 54);
598}
599
600/**
601 * @brief Get field true_airspeed from hil_state_quaternion message
602 *
603 * @return [cm/s] True airspeed
604 */
605static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t* msg)
606{
607 return _MAV_RETURN_uint16_t(msg, 56);
608}
609
610/**
611 * @brief Get field xacc from hil_state_quaternion message
612 *
613 * @return [mG] X acceleration
614 */
615static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t* msg)
616{
617 return _MAV_RETURN_int16_t(msg, 58);
618}
619
620/**
621 * @brief Get field yacc from hil_state_quaternion message
622 *
623 * @return [mG] Y acceleration
624 */
625static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t* msg)
626{
627 return _MAV_RETURN_int16_t(msg, 60);
628}
629
630/**
631 * @brief Get field zacc from hil_state_quaternion message
632 *
633 * @return [mG] Z acceleration
634 */
635static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t* msg)
636{
637 return _MAV_RETURN_int16_t(msg, 62);
638}
639
640/**
641 * @brief Decode a hil_state_quaternion message into a struct
642 *
643 * @param msg The message to decode
644 * @param hil_state_quaternion C-struct to decode the message contents into
645 */
646static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t* msg, mavlink_hil_state_quaternion_t* hil_state_quaternion)
647{
648#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
649 hil_state_quaternion->time_usec = mavlink_msg_hil_state_quaternion_get_time_usec(msg);
650 mavlink_msg_hil_state_quaternion_get_attitude_quaternion(msg, hil_state_quaternion->attitude_quaternion);
651 hil_state_quaternion->rollspeed = mavlink_msg_hil_state_quaternion_get_rollspeed(msg);
652 hil_state_quaternion->pitchspeed = mavlink_msg_hil_state_quaternion_get_pitchspeed(msg);
653 hil_state_quaternion->yawspeed = mavlink_msg_hil_state_quaternion_get_yawspeed(msg);
654 hil_state_quaternion->lat = mavlink_msg_hil_state_quaternion_get_lat(msg);
655 hil_state_quaternion->lon = mavlink_msg_hil_state_quaternion_get_lon(msg);
656 hil_state_quaternion->alt = mavlink_msg_hil_state_quaternion_get_alt(msg);
657 hil_state_quaternion->vx = mavlink_msg_hil_state_quaternion_get_vx(msg);
658 hil_state_quaternion->vy = mavlink_msg_hil_state_quaternion_get_vy(msg);
659 hil_state_quaternion->vz = mavlink_msg_hil_state_quaternion_get_vz(msg);
660 hil_state_quaternion->ind_airspeed = mavlink_msg_hil_state_quaternion_get_ind_airspeed(msg);
661 hil_state_quaternion->true_airspeed = mavlink_msg_hil_state_quaternion_get_true_airspeed(msg);
662 hil_state_quaternion->xacc = mavlink_msg_hil_state_quaternion_get_xacc(msg);
663 hil_state_quaternion->yacc = mavlink_msg_hil_state_quaternion_get_yacc(msg);
664 hil_state_quaternion->zacc = mavlink_msg_hil_state_quaternion_get_zacc(msg);
665#else
666 uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN? msg->len : MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN;
667 memset(hil_state_quaternion, 0, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
668 memcpy(hil_state_quaternion, _MAV_PAYLOAD(msg), len);
669#endif
670}