RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_hil_state_quaternion.h
1#pragma once
2// MESSAGE HIL_STATE_QUATERNION PACKING
3
4#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115
5
6MAVPACKED(
7typedef struct __mavlink_hil_state_quaternion_t {
8 uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
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; /*< Body frame roll / phi angular speed (rad/s)*/
11 float pitchspeed; /*< Body frame pitch / theta angular speed (rad/s)*/
12 float yawspeed; /*< Body frame yaw / psi angular speed (rad/s)*/
13 int32_t lat; /*< Latitude, expressed as * 1E7*/
14 int32_t lon; /*< Longitude, expressed as * 1E7*/
15 int32_t alt; /*< Altitude in meters, expressed as * 1000 (millimeters)*/
16 int16_t vx; /*< Ground X Speed (Latitude), expressed as cm/s*/
17 int16_t vy; /*< Ground Y Speed (Longitude), expressed as cm/s*/
18 int16_t vz; /*< Ground Z Speed (Altitude), expressed as cm/s*/
19 uint16_t ind_airspeed; /*< Indicated airspeed, expressed as cm/s*/
20 uint16_t true_airspeed; /*< True airspeed, expressed as cm/s*/
21 int16_t xacc; /*< X acceleration (mg)*/
22 int16_t yacc; /*< Y acceleration (mg)*/
23 int16_t zacc; /*< Z acceleration (mg)*/
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 Timestamp (microseconds since UNIX epoch or microseconds since system boot)
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 Body frame roll / phi angular speed (rad/s)
92 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
93 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
94 * @param lat Latitude, expressed as * 1E7
95 * @param lon Longitude, expressed as * 1E7
96 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
97 * @param vx Ground X Speed (Latitude), expressed as cm/s
98 * @param vy Ground Y Speed (Longitude), expressed as cm/s
99 * @param vz Ground Z Speed (Altitude), expressed as cm/s
100 * @param ind_airspeed Indicated airspeed, expressed as cm/s
101 * @param true_airspeed True airspeed, expressed as cm/s
102 * @param xacc X acceleration (mg)
103 * @param yacc Y acceleration (mg)
104 * @param zacc Z acceleration (mg)
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
111 char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN];
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
150 msg->msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION;
151 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC);
152}
153
154/**
155 * @brief Pack a hil_state_quaternion message on a channel
156 * @param system_id ID of this system
157 * @param component_id ID of this component (e.g. 200 for IMU)
158 * @param chan The MAVLink channel this message will be sent over
159 * @param msg The MAVLink message to compress the data into
160 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
161 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
162 * @param rollspeed Body frame roll / phi angular speed (rad/s)
163 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
164 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
165 * @param lat Latitude, expressed as * 1E7
166 * @param lon Longitude, expressed as * 1E7
167 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
168 * @param vx Ground X Speed (Latitude), expressed as cm/s
169 * @param vy Ground Y Speed (Longitude), expressed as cm/s
170 * @param vz Ground Z Speed (Altitude), expressed as cm/s
171 * @param ind_airspeed Indicated airspeed, expressed as cm/s
172 * @param true_airspeed True airspeed, expressed as cm/s
173 * @param xacc X acceleration (mg)
174 * @param yacc Y acceleration (mg)
175 * @param zacc Z acceleration (mg)
176 * @return length of the message in bytes (excluding serial stream start sign)
177 */
178static inline uint16_t mavlink_msg_hil_state_quaternion_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
179 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
183 char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN];
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
222 msg->msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION;
223 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);
224}
225
226/**
227 * @brief Encode a hil_state_quaternion struct
228 *
229 * @param system_id ID of this system
230 * @param component_id ID of this component (e.g. 200 for IMU)
231 * @param msg The MAVLink message to compress the data into
232 * @param hil_state_quaternion C-struct to read the message contents from
233 */
234static 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)
235{
236 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);
237}
238
239/**
240 * @brief Encode a hil_state_quaternion struct on a channel
241 *
242 * @param system_id ID of this system
243 * @param component_id ID of this component (e.g. 200 for IMU)
244 * @param chan The MAVLink channel this message will be sent over
245 * @param msg The MAVLink message to compress the data into
246 * @param hil_state_quaternion C-struct to read the message contents from
247 */
248static 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)
249{
250 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);
251}
252
253/**
254 * @brief Send a hil_state_quaternion message
255 * @param chan MAVLink channel to send the message
256 *
257 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
258 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
259 * @param rollspeed Body frame roll / phi angular speed (rad/s)
260 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
261 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
262 * @param lat Latitude, expressed as * 1E7
263 * @param lon Longitude, expressed as * 1E7
264 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
265 * @param vx Ground X Speed (Latitude), expressed as cm/s
266 * @param vy Ground Y Speed (Longitude), expressed as cm/s
267 * @param vz Ground Z Speed (Altitude), expressed as cm/s
268 * @param ind_airspeed Indicated airspeed, expressed as cm/s
269 * @param true_airspeed True airspeed, expressed as cm/s
270 * @param xacc X acceleration (mg)
271 * @param yacc Y acceleration (mg)
272 * @param zacc Z acceleration (mg)
273 */
274#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
275
276static 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)
277{
278#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
279 char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN];
280 _mav_put_uint64_t(buf, 0, time_usec);
281 _mav_put_float(buf, 24, rollspeed);
282 _mav_put_float(buf, 28, pitchspeed);
283 _mav_put_float(buf, 32, yawspeed);
284 _mav_put_int32_t(buf, 36, lat);
285 _mav_put_int32_t(buf, 40, lon);
286 _mav_put_int32_t(buf, 44, alt);
287 _mav_put_int16_t(buf, 48, vx);
288 _mav_put_int16_t(buf, 50, vy);
289 _mav_put_int16_t(buf, 52, vz);
290 _mav_put_uint16_t(buf, 54, ind_airspeed);
291 _mav_put_uint16_t(buf, 56, true_airspeed);
292 _mav_put_int16_t(buf, 58, xacc);
293 _mav_put_int16_t(buf, 60, yacc);
294 _mav_put_int16_t(buf, 62, zacc);
295 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
296 _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);
297#else
298 mavlink_hil_state_quaternion_t packet;
299 packet.time_usec = time_usec;
300 packet.rollspeed = rollspeed;
301 packet.pitchspeed = pitchspeed;
302 packet.yawspeed = yawspeed;
303 packet.lat = lat;
304 packet.lon = lon;
305 packet.alt = alt;
306 packet.vx = vx;
307 packet.vy = vy;
308 packet.vz = vz;
309 packet.ind_airspeed = ind_airspeed;
310 packet.true_airspeed = true_airspeed;
311 packet.xacc = xacc;
312 packet.yacc = yacc;
313 packet.zacc = zacc;
314 mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
315 _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);
316#endif
317}
318
319/**
320 * @brief Send a hil_state_quaternion message
321 * @param chan MAVLink channel to send the message
322 * @param struct The MAVLink struct to serialize
323 */
324static inline void mavlink_msg_hil_state_quaternion_send_struct(mavlink_channel_t chan, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
325{
326#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
327 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);
328#else
329 _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);
330#endif
331}
332
333#if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
334/*
335 This varient of _send() can be used to save stack space by re-using
336 memory from the receive buffer. The caller provides a
337 mavlink_message_t which is the size of a full mavlink message. This
338 is usually the receive buffer for the channel, and allows a reply to an
339 incoming message with minimum stack space usage.
340 */
341static 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)
342{
343#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
344 char *buf = (char *)msgbuf;
345 _mav_put_uint64_t(buf, 0, time_usec);
346 _mav_put_float(buf, 24, rollspeed);
347 _mav_put_float(buf, 28, pitchspeed);
348 _mav_put_float(buf, 32, yawspeed);
349 _mav_put_int32_t(buf, 36, lat);
350 _mav_put_int32_t(buf, 40, lon);
351 _mav_put_int32_t(buf, 44, alt);
352 _mav_put_int16_t(buf, 48, vx);
353 _mav_put_int16_t(buf, 50, vy);
354 _mav_put_int16_t(buf, 52, vz);
355 _mav_put_uint16_t(buf, 54, ind_airspeed);
356 _mav_put_uint16_t(buf, 56, true_airspeed);
357 _mav_put_int16_t(buf, 58, xacc);
358 _mav_put_int16_t(buf, 60, yacc);
359 _mav_put_int16_t(buf, 62, zacc);
360 _mav_put_float_array(buf, 8, attitude_quaternion, 4);
361 _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);
362#else
363 mavlink_hil_state_quaternion_t *packet = (mavlink_hil_state_quaternion_t *)msgbuf;
364 packet->time_usec = time_usec;
365 packet->rollspeed = rollspeed;
366 packet->pitchspeed = pitchspeed;
367 packet->yawspeed = yawspeed;
368 packet->lat = lat;
369 packet->lon = lon;
370 packet->alt = alt;
371 packet->vx = vx;
372 packet->vy = vy;
373 packet->vz = vz;
374 packet->ind_airspeed = ind_airspeed;
375 packet->true_airspeed = true_airspeed;
376 packet->xacc = xacc;
377 packet->yacc = yacc;
378 packet->zacc = zacc;
379 mav_array_memcpy(packet->attitude_quaternion, attitude_quaternion, sizeof(float)*4);
380 _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);
381#endif
382}
383#endif
384
385#endif
386
387// MESSAGE HIL_STATE_QUATERNION UNPACKING
388
389
390/**
391 * @brief Get field time_usec from hil_state_quaternion message
392 *
393 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
394 */
395static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t* msg)
396{
397 return _MAV_RETURN_uint64_t(msg, 0);
398}
399
400/**
401 * @brief Get field attitude_quaternion from hil_state_quaternion message
402 *
403 * @return Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
404 */
405static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t* msg, float *attitude_quaternion)
406{
407 return _MAV_RETURN_float_array(msg, attitude_quaternion, 4, 8);
408}
409
410/**
411 * @brief Get field rollspeed from hil_state_quaternion message
412 *
413 * @return Body frame roll / phi angular speed (rad/s)
414 */
415static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t* msg)
416{
417 return _MAV_RETURN_float(msg, 24);
418}
419
420/**
421 * @brief Get field pitchspeed from hil_state_quaternion message
422 *
423 * @return Body frame pitch / theta angular speed (rad/s)
424 */
425static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t* msg)
426{
427 return _MAV_RETURN_float(msg, 28);
428}
429
430/**
431 * @brief Get field yawspeed from hil_state_quaternion message
432 *
433 * @return Body frame yaw / psi angular speed (rad/s)
434 */
435static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t* msg)
436{
437 return _MAV_RETURN_float(msg, 32);
438}
439
440/**
441 * @brief Get field lat from hil_state_quaternion message
442 *
443 * @return Latitude, expressed as * 1E7
444 */
445static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t* msg)
446{
447 return _MAV_RETURN_int32_t(msg, 36);
448}
449
450/**
451 * @brief Get field lon from hil_state_quaternion message
452 *
453 * @return Longitude, expressed as * 1E7
454 */
455static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t* msg)
456{
457 return _MAV_RETURN_int32_t(msg, 40);
458}
459
460/**
461 * @brief Get field alt from hil_state_quaternion message
462 *
463 * @return Altitude in meters, expressed as * 1000 (millimeters)
464 */
465static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t* msg)
466{
467 return _MAV_RETURN_int32_t(msg, 44);
468}
469
470/**
471 * @brief Get field vx from hil_state_quaternion message
472 *
473 * @return Ground X Speed (Latitude), expressed as cm/s
474 */
475static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t* msg)
476{
477 return _MAV_RETURN_int16_t(msg, 48);
478}
479
480/**
481 * @brief Get field vy from hil_state_quaternion message
482 *
483 * @return Ground Y Speed (Longitude), expressed as cm/s
484 */
485static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t* msg)
486{
487 return _MAV_RETURN_int16_t(msg, 50);
488}
489
490/**
491 * @brief Get field vz from hil_state_quaternion message
492 *
493 * @return Ground Z Speed (Altitude), expressed as cm/s
494 */
495static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t* msg)
496{
497 return _MAV_RETURN_int16_t(msg, 52);
498}
499
500/**
501 * @brief Get field ind_airspeed from hil_state_quaternion message
502 *
503 * @return Indicated airspeed, expressed as cm/s
504 */
505static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t* msg)
506{
507 return _MAV_RETURN_uint16_t(msg, 54);
508}
509
510/**
511 * @brief Get field true_airspeed from hil_state_quaternion message
512 *
513 * @return True airspeed, expressed as cm/s
514 */
515static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t* msg)
516{
517 return _MAV_RETURN_uint16_t(msg, 56);
518}
519
520/**
521 * @brief Get field xacc from hil_state_quaternion message
522 *
523 * @return X acceleration (mg)
524 */
525static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t* msg)
526{
527 return _MAV_RETURN_int16_t(msg, 58);
528}
529
530/**
531 * @brief Get field yacc from hil_state_quaternion message
532 *
533 * @return Y acceleration (mg)
534 */
535static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t* msg)
536{
537 return _MAV_RETURN_int16_t(msg, 60);
538}
539
540/**
541 * @brief Get field zacc from hil_state_quaternion message
542 *
543 * @return Z acceleration (mg)
544 */
545static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_int16_t(msg, 62);
548}
549
550/**
551 * @brief Decode a hil_state_quaternion message into a struct
552 *
553 * @param msg The message to decode
554 * @param hil_state_quaternion C-struct to decode the message contents into
555 */
556static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t* msg, mavlink_hil_state_quaternion_t* hil_state_quaternion)
557{
558#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
559 hil_state_quaternion->time_usec = mavlink_msg_hil_state_quaternion_get_time_usec(msg);
560 mavlink_msg_hil_state_quaternion_get_attitude_quaternion(msg, hil_state_quaternion->attitude_quaternion);
561 hil_state_quaternion->rollspeed = mavlink_msg_hil_state_quaternion_get_rollspeed(msg);
562 hil_state_quaternion->pitchspeed = mavlink_msg_hil_state_quaternion_get_pitchspeed(msg);
563 hil_state_quaternion->yawspeed = mavlink_msg_hil_state_quaternion_get_yawspeed(msg);
564 hil_state_quaternion->lat = mavlink_msg_hil_state_quaternion_get_lat(msg);
565 hil_state_quaternion->lon = mavlink_msg_hil_state_quaternion_get_lon(msg);
566 hil_state_quaternion->alt = mavlink_msg_hil_state_quaternion_get_alt(msg);
567 hil_state_quaternion->vx = mavlink_msg_hil_state_quaternion_get_vx(msg);
568 hil_state_quaternion->vy = mavlink_msg_hil_state_quaternion_get_vy(msg);
569 hil_state_quaternion->vz = mavlink_msg_hil_state_quaternion_get_vz(msg);
570 hil_state_quaternion->ind_airspeed = mavlink_msg_hil_state_quaternion_get_ind_airspeed(msg);
571 hil_state_quaternion->true_airspeed = mavlink_msg_hil_state_quaternion_get_true_airspeed(msg);
572 hil_state_quaternion->xacc = mavlink_msg_hil_state_quaternion_get_xacc(msg);
573 hil_state_quaternion->yacc = mavlink_msg_hil_state_quaternion_get_yacc(msg);
574 hil_state_quaternion->zacc = mavlink_msg_hil_state_quaternion_get_zacc(msg);
575#else
576 uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN? msg->len : MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN;
577 memset(hil_state_quaternion, 0, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
578 memcpy(hil_state_quaternion, _MAV_PAYLOAD(msg), len);
579#endif
580}