mavlink_msg_hil_state_quaternion.h
Go to the documentation of this file.
1 // MESSAGE HIL_STATE_QUATERNION PACKING
2 
3 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115
4 
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)*/
24 
25 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN 64
26 #define MAVLINK_MSG_ID_115_LEN 64
27 
28 #define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4
29 #define MAVLINK_MSG_ID_115_CRC 4
30 
31 #define MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_ATTITUDE_QUATERNION_LEN 4
32 
33 #define MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION { \
34  "HIL_STATE_QUATERNION", \
35  16, \
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) }, \
52  } \
53 }
54 
55 
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)
82 {
83 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
102 #else
104  packet.time_usec = time_usec;
105  packet.rollspeed = rollspeed;
106  packet.pitchspeed = pitchspeed;
107  packet.yawspeed = yawspeed;
108  packet.lat = lat;
109  packet.lon = lon;
110  packet.alt = alt;
111  packet.vx = vx;
112  packet.vy = vy;
113  packet.vz = vz;
114  packet.ind_airspeed = ind_airspeed;
115  packet.true_airspeed = true_airspeed;
116  packet.xacc = xacc;
117  packet.yacc = yacc;
118  packet.zacc = zacc;
119  mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
121 #endif
122 
124 #if MAVLINK_CRC_EXTRA
126 #else
127  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
128 #endif
129 }
130 
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)
158 {
159 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
178 #else
180  packet.time_usec = time_usec;
181  packet.rollspeed = rollspeed;
182  packet.pitchspeed = pitchspeed;
183  packet.yawspeed = yawspeed;
184  packet.lat = lat;
185  packet.lon = lon;
186  packet.alt = alt;
187  packet.vx = vx;
188  packet.vy = vy;
189  packet.vz = vz;
190  packet.ind_airspeed = ind_airspeed;
191  packet.true_airspeed = true_airspeed;
192  packet.xacc = xacc;
193  packet.yacc = yacc;
194  packet.zacc = zacc;
195  mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
197 #endif
198 
200 #if MAVLINK_CRC_EXTRA
202 #else
203  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
204 #endif
205 }
206 
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)
216 {
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);
218 }
219 
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)
230 {
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);
232 }
233 
255 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
256 
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)
258 {
259 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
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
279 #else
280  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
281 #endif
282 #else
284  packet.time_usec = time_usec;
285  packet.rollspeed = rollspeed;
286  packet.pitchspeed = pitchspeed;
287  packet.yawspeed = yawspeed;
288  packet.lat = lat;
289  packet.lon = lon;
290  packet.alt = alt;
291  packet.vx = vx;
292  packet.vy = vy;
293  packet.vz = vz;
294  packet.ind_airspeed = ind_airspeed;
295  packet.true_airspeed = true_airspeed;
296  packet.xacc = xacc;
297  packet.yacc = yacc;
298  packet.zacc = zacc;
299  mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4);
300 #if MAVLINK_CRC_EXTRA
302 #else
303  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
304 #endif
305 #endif
306 }
307 
308 #if MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
309 /*
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.
315  */
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)
317 {
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);
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
338 #else
339  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
340 #endif
341 #else
343  packet->time_usec = time_usec;
344  packet->rollspeed = rollspeed;
345  packet->pitchspeed = pitchspeed;
346  packet->yawspeed = yawspeed;
347  packet->lat = lat;
348  packet->lon = lon;
349  packet->alt = alt;
350  packet->vx = vx;
351  packet->vy = vy;
352  packet->vz = vz;
353  packet->ind_airspeed = ind_airspeed;
354  packet->true_airspeed = true_airspeed;
355  packet->xacc = xacc;
356  packet->yacc = yacc;
357  packet->zacc = zacc;
358  mav_array_memcpy(packet->attitude_quaternion, attitude_quaternion, sizeof(float)*4);
359 #if MAVLINK_CRC_EXTRA
361 #else
362  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
363 #endif
364 #endif
365 }
366 #endif
367 
368 #endif
369 
370 // MESSAGE HIL_STATE_QUATERNION UNPACKING
371 
372 
378 static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_uint64_t(msg, 0);
381 }
382 
388 static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t* msg, float *attitude_quaternion)
389 {
390  return _MAV_RETURN_float_array(msg, attitude_quaternion, 4, 8);
391 }
392 
398 static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_float(msg, 24);
401 }
402 
408 static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t* msg)
409 {
410  return _MAV_RETURN_float(msg, 28);
411 }
412 
418 static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t* msg)
419 {
420  return _MAV_RETURN_float(msg, 32);
421 }
422 
428 static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t* msg)
429 {
430  return _MAV_RETURN_int32_t(msg, 36);
431 }
432 
438 static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t* msg)
439 {
440  return _MAV_RETURN_int32_t(msg, 40);
441 }
442 
448 static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t* msg)
449 {
450  return _MAV_RETURN_int32_t(msg, 44);
451 }
452 
458 static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t* msg)
459 {
460  return _MAV_RETURN_int16_t(msg, 48);
461 }
462 
468 static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t* msg)
469 {
470  return _MAV_RETURN_int16_t(msg, 50);
471 }
472 
478 static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t* msg)
479 {
480  return _MAV_RETURN_int16_t(msg, 52);
481 }
482 
488 static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t* msg)
489 {
490  return _MAV_RETURN_uint16_t(msg, 54);
491 }
492 
498 static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t* msg)
499 {
500  return _MAV_RETURN_uint16_t(msg, 56);
501 }
502 
508 static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t* msg)
509 {
510  return _MAV_RETURN_int16_t(msg, 58);
511 }
512 
518 static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t* msg)
519 {
520  return _MAV_RETURN_int16_t(msg, 60);
521 }
522 
528 static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t* msg)
529 {
530  return _MAV_RETURN_int16_t(msg, 62);
531 }
532 
539 static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t* msg, mavlink_hil_state_quaternion_t* hil_state_quaternion)
540 {
541 #if MAVLINK_NEED_BYTE_SWAP
542  hil_state_quaternion->time_usec = mavlink_msg_hil_state_quaternion_get_time_usec(msg);
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);
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);
558 #else
559  memcpy(hil_state_quaternion, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN);
560 #endif
561 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _mav_put_uint64_t(buf, wire_offset, b)
Definition: protocol.h:149
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:146


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:47