source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_hil_state_quaternion.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

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