1 // MESSAGE HIL_STATE_QUATERNION PACKING
3 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115
5 typedef struct __mavlink_hil_state_quaternion_t
7 uint64_t time_usec
; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
8 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)
9 float rollspeed
; ///< Body frame roll / phi angular speed (rad/s)
10 float pitchspeed
; ///< Body frame pitch / theta angular speed (rad/s)
11 float yawspeed
; ///< Body frame yaw / psi angular speed (rad/s)
12 int32_t lat
; ///< Latitude, expressed as * 1E7
13 int32_t lon
; ///< Longitude, expressed as * 1E7
14 int32_t alt
; ///< Altitude in meters, expressed as * 1000 (millimeters)
15 int16_t vx
; ///< Ground X Speed (Latitude), expressed as m/s * 100
16 int16_t vy
; ///< Ground Y Speed (Longitude), expressed as m/s * 100
17 int16_t vz
; ///< Ground Z Speed (Altitude), expressed as m/s * 100
18 uint16_t ind_airspeed
; ///< Indicated airspeed, expressed as m/s * 100
19 uint16_t true_airspeed
; ///< True airspeed, expressed as m/s * 100
20 int16_t xacc
; ///< X acceleration (mg)
21 int16_t yacc
; ///< Y acceleration (mg)
22 int16_t zacc
; ///< Z acceleration (mg)
23 } mavlink_hil_state_quaternion_t
;
25 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN 64
26 #define MAVLINK_MSG_ID_115_LEN 64
28 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4
29 #define MAVLINK_MSG_ID_115_CRC 4
31 #define MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_ATTITUDE_QUATERNION_LEN 4
33 #define MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION { \
34 "HIL_STATE_QUATERNION", \
36 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_quaternion_t, time_usec) }, \
37 { "attitude_quaternion", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_hil_state_quaternion_t, attitude_quaternion) }, \
38 { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_quaternion_t, rollspeed) }, \
39 { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_quaternion_t, pitchspeed) }, \
40 { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_state_quaternion_t, yawspeed) }, \
41 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_quaternion_t, lat) }, \
42 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_quaternion_t, lon) }, \
43 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_hil_state_quaternion_t, alt) }, \
44 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_quaternion_t, vx) }, \
45 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_quaternion_t, vy) }, \
46 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_quaternion_t, vz) }, \
47 { "ind_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_hil_state_quaternion_t, ind_airspeed) }, \
48 { "true_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_hil_state_quaternion_t, true_airspeed) }, \
49 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_hil_state_quaternion_t, xacc) }, \
50 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_hil_state_quaternion_t, yacc) }, \
51 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_hil_state_quaternion_t, zacc) }, \
57 * @brief Pack a hil_state_quaternion message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
62 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
63 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
64 * @param rollspeed Body frame roll / phi angular speed (rad/s)
65 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
66 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
67 * @param lat Latitude, expressed as * 1E7
68 * @param lon Longitude, expressed as * 1E7
69 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
70 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
71 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
72 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
73 * @param ind_airspeed Indicated airspeed, expressed as m/s * 100
74 * @param true_airspeed True airspeed, expressed as m/s * 100
75 * @param xacc X acceleration (mg)
76 * @param yacc Y acceleration (mg)
77 * @param zacc Z acceleration (mg)
78 * @return length of the message in bytes (excluding serial stream start sign)
80 static inline uint16_t mavlink_msg_hil_state_quaternion_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
81 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
)
83 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
84 char buf
[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
];
85 _mav_put_uint64_t(buf
, 0, time_usec
);
86 _mav_put_float(buf
, 24, rollspeed
);
87 _mav_put_float(buf
, 28, pitchspeed
);
88 _mav_put_float(buf
, 32, yawspeed
);
89 _mav_put_int32_t(buf
, 36, lat
);
90 _mav_put_int32_t(buf
, 40, lon
);
91 _mav_put_int32_t(buf
, 44, alt
);
92 _mav_put_int16_t(buf
, 48, vx
);
93 _mav_put_int16_t(buf
, 50, vy
);
94 _mav_put_int16_t(buf
, 52, vz
);
95 _mav_put_uint16_t(buf
, 54, ind_airspeed
);
96 _mav_put_uint16_t(buf
, 56, true_airspeed
);
97 _mav_put_int16_t(buf
, 58, xacc
);
98 _mav_put_int16_t(buf
, 60, yacc
);
99 _mav_put_int16_t(buf
, 62, zacc
);
100 _mav_put_float_array(buf
, 8, attitude_quaternion
, 4);
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
103 mavlink_hil_state_quaternion_t packet
;
104 packet
.time_usec
= time_usec
;
105 packet
.rollspeed
= rollspeed
;
106 packet
.pitchspeed
= pitchspeed
;
107 packet
.yawspeed
= yawspeed
;
114 packet
.ind_airspeed
= ind_airspeed
;
115 packet
.true_airspeed
= true_airspeed
;
119 mav_array_memcpy(packet
.attitude_quaternion
, attitude_quaternion
, sizeof(float)*4);
120 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
123 msg
->msgid
= MAVLINK_MSG_ID_HIL_STATE_QUATERNION
;
124 #if MAVLINK_CRC_EXTRA
125 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
127 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
132 * @brief Pack a hil_state_quaternion message on a channel
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
138 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
139 * @param rollspeed Body frame roll / phi angular speed (rad/s)
140 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
141 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
142 * @param lat Latitude, expressed as * 1E7
143 * @param lon Longitude, expressed as * 1E7
144 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
145 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
146 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
147 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
148 * @param ind_airspeed Indicated airspeed, expressed as m/s * 100
149 * @param true_airspeed True airspeed, expressed as m/s * 100
150 * @param xacc X acceleration (mg)
151 * @param yacc Y acceleration (mg)
152 * @param zacc Z acceleration (mg)
153 * @return length of the message in bytes (excluding serial stream start sign)
155 static inline uint16_t mavlink_msg_hil_state_quaternion_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
156 mavlink_message_t
* msg
,
157 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
)
159 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
160 char buf
[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
];
161 _mav_put_uint64_t(buf
, 0, time_usec
);
162 _mav_put_float(buf
, 24, rollspeed
);
163 _mav_put_float(buf
, 28, pitchspeed
);
164 _mav_put_float(buf
, 32, yawspeed
);
165 _mav_put_int32_t(buf
, 36, lat
);
166 _mav_put_int32_t(buf
, 40, lon
);
167 _mav_put_int32_t(buf
, 44, alt
);
168 _mav_put_int16_t(buf
, 48, vx
);
169 _mav_put_int16_t(buf
, 50, vy
);
170 _mav_put_int16_t(buf
, 52, vz
);
171 _mav_put_uint16_t(buf
, 54, ind_airspeed
);
172 _mav_put_uint16_t(buf
, 56, true_airspeed
);
173 _mav_put_int16_t(buf
, 58, xacc
);
174 _mav_put_int16_t(buf
, 60, yacc
);
175 _mav_put_int16_t(buf
, 62, zacc
);
176 _mav_put_float_array(buf
, 8, attitude_quaternion
, 4);
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
179 mavlink_hil_state_quaternion_t packet
;
180 packet
.time_usec
= time_usec
;
181 packet
.rollspeed
= rollspeed
;
182 packet
.pitchspeed
= pitchspeed
;
183 packet
.yawspeed
= yawspeed
;
190 packet
.ind_airspeed
= ind_airspeed
;
191 packet
.true_airspeed
= true_airspeed
;
195 mav_array_memcpy(packet
.attitude_quaternion
, attitude_quaternion
, sizeof(float)*4);
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
199 msg
->msgid
= MAVLINK_MSG_ID_HIL_STATE_QUATERNION
;
200 #if MAVLINK_CRC_EXTRA
201 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
203 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
208 * @brief Encode a hil_state_quaternion struct
210 * @param system_id ID of this system
211 * @param component_id ID of this component (e.g. 200 for IMU)
212 * @param msg The MAVLink message to compress the data into
213 * @param hil_state_quaternion C-struct to read the message contents from
215 static 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
)
217 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
);
221 * @brief Encode a hil_state_quaternion struct on a channel
223 * @param system_id ID of this system
224 * @param component_id ID of this component (e.g. 200 for IMU)
225 * @param chan The MAVLink channel this message will be sent over
226 * @param msg The MAVLink message to compress the data into
227 * @param hil_state_quaternion C-struct to read the message contents from
229 static 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
)
231 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
);
235 * @brief Send a hil_state_quaternion message
236 * @param chan MAVLink channel to send the message
238 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
239 * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
240 * @param rollspeed Body frame roll / phi angular speed (rad/s)
241 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
242 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
243 * @param lat Latitude, expressed as * 1E7
244 * @param lon Longitude, expressed as * 1E7
245 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
246 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
247 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
248 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
249 * @param ind_airspeed Indicated airspeed, expressed as m/s * 100
250 * @param true_airspeed True airspeed, expressed as m/s * 100
251 * @param xacc X acceleration (mg)
252 * @param yacc Y acceleration (mg)
253 * @param zacc Z acceleration (mg)
255 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
257 static 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
)
259 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
260 char buf
[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
];
261 _mav_put_uint64_t(buf
, 0, time_usec
);
262 _mav_put_float(buf
, 24, rollspeed
);
263 _mav_put_float(buf
, 28, pitchspeed
);
264 _mav_put_float(buf
, 32, yawspeed
);
265 _mav_put_int32_t(buf
, 36, lat
);
266 _mav_put_int32_t(buf
, 40, lon
);
267 _mav_put_int32_t(buf
, 44, alt
);
268 _mav_put_int16_t(buf
, 48, vx
);
269 _mav_put_int16_t(buf
, 50, vy
);
270 _mav_put_int16_t(buf
, 52, vz
);
271 _mav_put_uint16_t(buf
, 54, ind_airspeed
);
272 _mav_put_uint16_t(buf
, 56, true_airspeed
);
273 _mav_put_int16_t(buf
, 58, xacc
);
274 _mav_put_int16_t(buf
, 60, yacc
);
275 _mav_put_int16_t(buf
, 62, zacc
);
276 _mav_put_float_array(buf
, 8, attitude_quaternion
, 4);
277 #if MAVLINK_CRC_EXTRA
278 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
280 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
283 mavlink_hil_state_quaternion_t packet
;
284 packet
.time_usec
= time_usec
;
285 packet
.rollspeed
= rollspeed
;
286 packet
.pitchspeed
= pitchspeed
;
287 packet
.yawspeed
= yawspeed
;
294 packet
.ind_airspeed
= ind_airspeed
;
295 packet
.true_airspeed
= true_airspeed
;
299 mav_array_memcpy(packet
.attitude_quaternion
, attitude_quaternion
, sizeof(float)*4);
300 #if MAVLINK_CRC_EXTRA
301 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, (const char *)&packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
303 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, (const char *)&packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
308 #if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
310 This varient of _send() can be used to save stack space by re-using
311 memory from the receive buffer. The caller provides a
312 mavlink_message_t which is the size of a full mavlink message. This
313 is usually the receive buffer for the channel, and allows a reply to an
314 incoming message with minimum stack space usage.
316 static 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
)
318 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
319 char *buf
= (char *)msgbuf
;
320 _mav_put_uint64_t(buf
, 0, time_usec
);
321 _mav_put_float(buf
, 24, rollspeed
);
322 _mav_put_float(buf
, 28, pitchspeed
);
323 _mav_put_float(buf
, 32, yawspeed
);
324 _mav_put_int32_t(buf
, 36, lat
);
325 _mav_put_int32_t(buf
, 40, lon
);
326 _mav_put_int32_t(buf
, 44, alt
);
327 _mav_put_int16_t(buf
, 48, vx
);
328 _mav_put_int16_t(buf
, 50, vy
);
329 _mav_put_int16_t(buf
, 52, vz
);
330 _mav_put_uint16_t(buf
, 54, ind_airspeed
);
331 _mav_put_uint16_t(buf
, 56, true_airspeed
);
332 _mav_put_int16_t(buf
, 58, xacc
);
333 _mav_put_int16_t(buf
, 60, yacc
);
334 _mav_put_int16_t(buf
, 62, zacc
);
335 _mav_put_float_array(buf
, 8, attitude_quaternion
, 4);
336 #if MAVLINK_CRC_EXTRA
337 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
339 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, buf
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
342 mavlink_hil_state_quaternion_t
*packet
= (mavlink_hil_state_quaternion_t
*)msgbuf
;
343 packet
->time_usec
= time_usec
;
344 packet
->rollspeed
= rollspeed
;
345 packet
->pitchspeed
= pitchspeed
;
346 packet
->yawspeed
= yawspeed
;
353 packet
->ind_airspeed
= ind_airspeed
;
354 packet
->true_airspeed
= true_airspeed
;
358 mav_array_memcpy(packet
->attitude_quaternion
, attitude_quaternion
, sizeof(float)*4);
359 #if MAVLINK_CRC_EXTRA
360 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, (const char *)packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC
);
362 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION
, (const char *)packet
, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);
370 // MESSAGE HIL_STATE_QUATERNION UNPACKING
374 * @brief Get field time_usec from hil_state_quaternion message
376 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
378 static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t
* msg
)
380 return _MAV_RETURN_uint64_t(msg
, 0);
384 * @brief Get field attitude_quaternion from hil_state_quaternion message
386 * @return Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
388 static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t
* msg
, float *attitude_quaternion
)
390 return _MAV_RETURN_float_array(msg
, attitude_quaternion
, 4, 8);
394 * @brief Get field rollspeed from hil_state_quaternion message
396 * @return Body frame roll / phi angular speed (rad/s)
398 static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t
* msg
)
400 return _MAV_RETURN_float(msg
, 24);
404 * @brief Get field pitchspeed from hil_state_quaternion message
406 * @return Body frame pitch / theta angular speed (rad/s)
408 static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t
* msg
)
410 return _MAV_RETURN_float(msg
, 28);
414 * @brief Get field yawspeed from hil_state_quaternion message
416 * @return Body frame yaw / psi angular speed (rad/s)
418 static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t
* msg
)
420 return _MAV_RETURN_float(msg
, 32);
424 * @brief Get field lat from hil_state_quaternion message
426 * @return Latitude, expressed as * 1E7
428 static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t
* msg
)
430 return _MAV_RETURN_int32_t(msg
, 36);
434 * @brief Get field lon from hil_state_quaternion message
436 * @return Longitude, expressed as * 1E7
438 static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t
* msg
)
440 return _MAV_RETURN_int32_t(msg
, 40);
444 * @brief Get field alt from hil_state_quaternion message
446 * @return Altitude in meters, expressed as * 1000 (millimeters)
448 static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t
* msg
)
450 return _MAV_RETURN_int32_t(msg
, 44);
454 * @brief Get field vx from hil_state_quaternion message
456 * @return Ground X Speed (Latitude), expressed as m/s * 100
458 static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t
* msg
)
460 return _MAV_RETURN_int16_t(msg
, 48);
464 * @brief Get field vy from hil_state_quaternion message
466 * @return Ground Y Speed (Longitude), expressed as m/s * 100
468 static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t
* msg
)
470 return _MAV_RETURN_int16_t(msg
, 50);
474 * @brief Get field vz from hil_state_quaternion message
476 * @return Ground Z Speed (Altitude), expressed as m/s * 100
478 static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t
* msg
)
480 return _MAV_RETURN_int16_t(msg
, 52);
484 * @brief Get field ind_airspeed from hil_state_quaternion message
486 * @return Indicated airspeed, expressed as m/s * 100
488 static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t
* msg
)
490 return _MAV_RETURN_uint16_t(msg
, 54);
494 * @brief Get field true_airspeed from hil_state_quaternion message
496 * @return True airspeed, expressed as m/s * 100
498 static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t
* msg
)
500 return _MAV_RETURN_uint16_t(msg
, 56);
504 * @brief Get field xacc from hil_state_quaternion message
506 * @return X acceleration (mg)
508 static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t
* msg
)
510 return _MAV_RETURN_int16_t(msg
, 58);
514 * @brief Get field yacc from hil_state_quaternion message
516 * @return Y acceleration (mg)
518 static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t
* msg
)
520 return _MAV_RETURN_int16_t(msg
, 60);
524 * @brief Get field zacc from hil_state_quaternion message
526 * @return Z acceleration (mg)
528 static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t
* msg
)
530 return _MAV_RETURN_int16_t(msg
, 62);
534 * @brief Decode a hil_state_quaternion message into a struct
536 * @param msg The message to decode
537 * @param hil_state_quaternion C-struct to decode the message contents into
539 static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t
* msg
, mavlink_hil_state_quaternion_t
* hil_state_quaternion
)
541 #if MAVLINK_NEED_BYTE_SWAP
542 hil_state_quaternion
->time_usec
= mavlink_msg_hil_state_quaternion_get_time_usec(msg
);
543 mavlink_msg_hil_state_quaternion_get_attitude_quaternion(msg
, hil_state_quaternion
->attitude_quaternion
);
544 hil_state_quaternion
->rollspeed
= mavlink_msg_hil_state_quaternion_get_rollspeed(msg
);
545 hil_state_quaternion
->pitchspeed
= mavlink_msg_hil_state_quaternion_get_pitchspeed(msg
);
546 hil_state_quaternion
->yawspeed
= mavlink_msg_hil_state_quaternion_get_yawspeed(msg
);
547 hil_state_quaternion
->lat
= mavlink_msg_hil_state_quaternion_get_lat(msg
);
548 hil_state_quaternion
->lon
= mavlink_msg_hil_state_quaternion_get_lon(msg
);
549 hil_state_quaternion
->alt
= mavlink_msg_hil_state_quaternion_get_alt(msg
);
550 hil_state_quaternion
->vx
= mavlink_msg_hil_state_quaternion_get_vx(msg
);
551 hil_state_quaternion
->vy
= mavlink_msg_hil_state_quaternion_get_vy(msg
);
552 hil_state_quaternion
->vz
= mavlink_msg_hil_state_quaternion_get_vz(msg
);
553 hil_state_quaternion
->ind_airspeed
= mavlink_msg_hil_state_quaternion_get_ind_airspeed(msg
);
554 hil_state_quaternion
->true_airspeed
= mavlink_msg_hil_state_quaternion_get_true_airspeed(msg
);
555 hil_state_quaternion
->xacc
= mavlink_msg_hil_state_quaternion_get_xacc(msg
);
556 hil_state_quaternion
->yacc
= mavlink_msg_hil_state_quaternion_get_yacc(msg
);
557 hil_state_quaternion
->zacc
= mavlink_msg_hil_state_quaternion_get_zacc(msg
);
559 memcpy(hil_state_quaternion
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN
);