before merging master
[inav.git] / lib / main / MAVLink / common / mavlink_msg_hil_state_quaternion.h
bloba605f39febb827bba9a1a5c500deec2061bd3b58
1 #pragma once
2 // MESSAGE HIL_STATE_QUATERNION PACKING
4 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115
7 typedef struct __mavlink_hil_state_quaternion_t {
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;
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
31 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4
32 #define MAVLINK_MSG_ID_115_CRC 4
34 #define MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_ATTITUDE_QUATERNION_LEN 4
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 } \
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 } \
81 #endif
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
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)
107 static 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)
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
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);
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 [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.
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 [rad/s] Body frame roll / phi angular speed
163 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
164 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
165 * @param lat [degE7] Latitude
166 * @param lon [degE7] Longitude
167 * @param alt [mm] Altitude
168 * @param vx [cm/s] Ground X Speed (Latitude)
169 * @param vy [cm/s] Ground Y Speed (Longitude)
170 * @param vz [cm/s] Ground Z Speed (Altitude)
171 * @param ind_airspeed [cm/s] Indicated airspeed
172 * @param true_airspeed [cm/s] True airspeed
173 * @param xacc [mG] X acceleration
174 * @param yacc [mG] Y acceleration
175 * @param zacc [mG] Z acceleration
176 * @return length of the message in bytes (excluding serial stream start sign)
178 static 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)
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
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);
227 * @brief Encode a hil_state_quaternion struct
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
234 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)
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);
240 * @brief Encode a hil_state_quaternion struct on a channel
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
248 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)
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);
254 * @brief Send a hil_state_quaternion message
255 * @param chan MAVLink channel to send the message
257 * @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.
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 [rad/s] Body frame roll / phi angular speed
260 * @param pitchspeed [rad/s] Body frame pitch / theta angular speed
261 * @param yawspeed [rad/s] Body frame yaw / psi angular speed
262 * @param lat [degE7] Latitude
263 * @param lon [degE7] Longitude
264 * @param alt [mm] Altitude
265 * @param vx [cm/s] Ground X Speed (Latitude)
266 * @param vy [cm/s] Ground Y Speed (Longitude)
267 * @param vz [cm/s] Ground Z Speed (Altitude)
268 * @param ind_airspeed [cm/s] Indicated airspeed
269 * @param true_airspeed [cm/s] True airspeed
270 * @param xacc [mG] X acceleration
271 * @param yacc [mG] Y acceleration
272 * @param zacc [mG] Z acceleration
274 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
276 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)
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
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
324 static inline void mavlink_msg_hil_state_quaternion_send_struct(mavlink_channel_t chan, const mavlink_hil_state_quaternion_t* hil_state_quaternion)
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
333 #if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
341 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)
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
383 #endif
385 #endif
387 // MESSAGE HIL_STATE_QUATERNION UNPACKING
391 * @brief Get field time_usec from hil_state_quaternion message
393 * @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.
395 static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t* msg)
397 return _MAV_RETURN_uint64_t(msg, 0);
401 * @brief Get field attitude_quaternion from hil_state_quaternion message
403 * @return Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation)
405 static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t* msg, float *attitude_quaternion)
407 return _MAV_RETURN_float_array(msg, attitude_quaternion, 4, 8);
411 * @brief Get field rollspeed from hil_state_quaternion message
413 * @return [rad/s] Body frame roll / phi angular speed
415 static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t* msg)
417 return _MAV_RETURN_float(msg, 24);
421 * @brief Get field pitchspeed from hil_state_quaternion message
423 * @return [rad/s] Body frame pitch / theta angular speed
425 static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t* msg)
427 return _MAV_RETURN_float(msg, 28);
431 * @brief Get field yawspeed from hil_state_quaternion message
433 * @return [rad/s] Body frame yaw / psi angular speed
435 static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t* msg)
437 return _MAV_RETURN_float(msg, 32);
441 * @brief Get field lat from hil_state_quaternion message
443 * @return [degE7] Latitude
445 static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t* msg)
447 return _MAV_RETURN_int32_t(msg, 36);
451 * @brief Get field lon from hil_state_quaternion message
453 * @return [degE7] Longitude
455 static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t* msg)
457 return _MAV_RETURN_int32_t(msg, 40);
461 * @brief Get field alt from hil_state_quaternion message
463 * @return [mm] Altitude
465 static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t* msg)
467 return _MAV_RETURN_int32_t(msg, 44);
471 * @brief Get field vx from hil_state_quaternion message
473 * @return [cm/s] Ground X Speed (Latitude)
475 static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t* msg)
477 return _MAV_RETURN_int16_t(msg, 48);
481 * @brief Get field vy from hil_state_quaternion message
483 * @return [cm/s] Ground Y Speed (Longitude)
485 static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t* msg)
487 return _MAV_RETURN_int16_t(msg, 50);
491 * @brief Get field vz from hil_state_quaternion message
493 * @return [cm/s] Ground Z Speed (Altitude)
495 static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t* msg)
497 return _MAV_RETURN_int16_t(msg, 52);
501 * @brief Get field ind_airspeed from hil_state_quaternion message
503 * @return [cm/s] Indicated airspeed
505 static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t* msg)
507 return _MAV_RETURN_uint16_t(msg, 54);
511 * @brief Get field true_airspeed from hil_state_quaternion message
513 * @return [cm/s] True airspeed
515 static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t* msg)
517 return _MAV_RETURN_uint16_t(msg, 56);
521 * @brief Get field xacc from hil_state_quaternion message
523 * @return [mG] X acceleration
525 static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t* msg)
527 return _MAV_RETURN_int16_t(msg, 58);
531 * @brief Get field yacc from hil_state_quaternion message
533 * @return [mG] Y acceleration
535 static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t* msg)
537 return _MAV_RETURN_int16_t(msg, 60);
541 * @brief Get field zacc from hil_state_quaternion message
543 * @return [mG] Z acceleration
545 static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t* msg)
547 return _MAV_RETURN_int16_t(msg, 62);
551 * @brief Decode a hil_state_quaternion message into a struct
553 * @param msg The message to decode
554 * @param hil_state_quaternion C-struct to decode the message contents into
556 static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t* msg, mavlink_hil_state_quaternion_t* hil_state_quaternion)
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