mavlink_msg_control_system_state.h
Go to the documentation of this file.
1 // MESSAGE CONTROL_SYSTEM_STATE PACKING
2 
3 #define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE 146
4 
6 {
7  uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
8  float x_acc; /*< X acceleration in body frame*/
9  float y_acc; /*< Y acceleration in body frame*/
10  float z_acc; /*< Z acceleration in body frame*/
11  float x_vel; /*< X velocity in body frame*/
12  float y_vel; /*< Y velocity in body frame*/
13  float z_vel; /*< Z velocity in body frame*/
14  float x_pos; /*< X position in local frame*/
15  float y_pos; /*< Y position in local frame*/
16  float z_pos; /*< Z position in local frame*/
17  float airspeed; /*< Airspeed, set to -1 if unknown*/
18  float vel_variance[3]; /*< Variance of body velocity estimate*/
19  float pos_variance[3]; /*< Variance in local position*/
20  float q[4]; /*< The attitude, represented as Quaternion*/
21  float roll_rate; /*< Angular rate in roll axis*/
22  float pitch_rate; /*< Angular rate in pitch axis*/
23  float yaw_rate; /*< Angular rate in yaw axis*/
25 
26 #define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN 100
27 #define MAVLINK_MSG_ID_146_LEN 100
28 
29 #define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC 103
30 #define MAVLINK_MSG_ID_146_CRC 103
31 
32 #define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_VEL_VARIANCE_LEN 3
33 #define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_POS_VARIANCE_LEN 3
34 #define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_Q_LEN 4
35 
36 #define MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE { \
37  "CONTROL_SYSTEM_STATE", \
38  17, \
39  { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_control_system_state_t, time_usec) }, \
40  { "x_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_control_system_state_t, x_acc) }, \
41  { "y_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_control_system_state_t, y_acc) }, \
42  { "z_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_control_system_state_t, z_acc) }, \
43  { "x_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_control_system_state_t, x_vel) }, \
44  { "y_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_control_system_state_t, y_vel) }, \
45  { "z_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_control_system_state_t, z_vel) }, \
46  { "x_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_control_system_state_t, x_pos) }, \
47  { "y_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_control_system_state_t, y_pos) }, \
48  { "z_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_control_system_state_t, z_pos) }, \
49  { "airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_control_system_state_t, airspeed) }, \
50  { "vel_variance", NULL, MAVLINK_TYPE_FLOAT, 3, 48, offsetof(mavlink_control_system_state_t, vel_variance) }, \
51  { "pos_variance", NULL, MAVLINK_TYPE_FLOAT, 3, 60, offsetof(mavlink_control_system_state_t, pos_variance) }, \
52  { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 72, offsetof(mavlink_control_system_state_t, q) }, \
53  { "roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_control_system_state_t, roll_rate) }, \
54  { "pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_control_system_state_t, pitch_rate) }, \
55  { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_control_system_state_t, yaw_rate) }, \
56  } \
57 }
58 
59 
85 static inline uint16_t mavlink_msg_control_system_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
86  uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
87 {
88 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90  _mav_put_uint64_t(buf, 0, time_usec);
91  _mav_put_float(buf, 8, x_acc);
92  _mav_put_float(buf, 12, y_acc);
93  _mav_put_float(buf, 16, z_acc);
94  _mav_put_float(buf, 20, x_vel);
95  _mav_put_float(buf, 24, y_vel);
96  _mav_put_float(buf, 28, z_vel);
97  _mav_put_float(buf, 32, x_pos);
98  _mav_put_float(buf, 36, y_pos);
99  _mav_put_float(buf, 40, z_pos);
100  _mav_put_float(buf, 44, airspeed);
101  _mav_put_float(buf, 88, roll_rate);
102  _mav_put_float(buf, 92, pitch_rate);
103  _mav_put_float(buf, 96, yaw_rate);
104  _mav_put_float_array(buf, 48, vel_variance, 3);
105  _mav_put_float_array(buf, 60, pos_variance, 3);
106  _mav_put_float_array(buf, 72, q, 4);
108 #else
110  packet.time_usec = time_usec;
111  packet.x_acc = x_acc;
112  packet.y_acc = y_acc;
113  packet.z_acc = z_acc;
114  packet.x_vel = x_vel;
115  packet.y_vel = y_vel;
116  packet.z_vel = z_vel;
117  packet.x_pos = x_pos;
118  packet.y_pos = y_pos;
119  packet.z_pos = z_pos;
120  packet.airspeed = airspeed;
121  packet.roll_rate = roll_rate;
122  packet.pitch_rate = pitch_rate;
123  packet.yaw_rate = yaw_rate;
124  mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
125  mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
126  mav_array_memcpy(packet.q, q, sizeof(float)*4);
128 #endif
129 
131 #if MAVLINK_CRC_EXTRA
133 #else
134  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
135 #endif
136 }
137 
163 static inline uint16_t mavlink_msg_control_system_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
164  mavlink_message_t* msg,
165  uint64_t time_usec,float x_acc,float y_acc,float z_acc,float x_vel,float y_vel,float z_vel,float x_pos,float y_pos,float z_pos,float airspeed,const float *vel_variance,const float *pos_variance,const float *q,float roll_rate,float pitch_rate,float yaw_rate)
166 {
167 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
169  _mav_put_uint64_t(buf, 0, time_usec);
170  _mav_put_float(buf, 8, x_acc);
171  _mav_put_float(buf, 12, y_acc);
172  _mav_put_float(buf, 16, z_acc);
173  _mav_put_float(buf, 20, x_vel);
174  _mav_put_float(buf, 24, y_vel);
175  _mav_put_float(buf, 28, z_vel);
176  _mav_put_float(buf, 32, x_pos);
177  _mav_put_float(buf, 36, y_pos);
178  _mav_put_float(buf, 40, z_pos);
179  _mav_put_float(buf, 44, airspeed);
180  _mav_put_float(buf, 88, roll_rate);
181  _mav_put_float(buf, 92, pitch_rate);
182  _mav_put_float(buf, 96, yaw_rate);
183  _mav_put_float_array(buf, 48, vel_variance, 3);
184  _mav_put_float_array(buf, 60, pos_variance, 3);
185  _mav_put_float_array(buf, 72, q, 4);
187 #else
189  packet.time_usec = time_usec;
190  packet.x_acc = x_acc;
191  packet.y_acc = y_acc;
192  packet.z_acc = z_acc;
193  packet.x_vel = x_vel;
194  packet.y_vel = y_vel;
195  packet.z_vel = z_vel;
196  packet.x_pos = x_pos;
197  packet.y_pos = y_pos;
198  packet.z_pos = z_pos;
199  packet.airspeed = airspeed;
200  packet.roll_rate = roll_rate;
201  packet.pitch_rate = pitch_rate;
202  packet.yaw_rate = yaw_rate;
203  mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
204  mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
205  mav_array_memcpy(packet.q, q, sizeof(float)*4);
207 #endif
208 
210 #if MAVLINK_CRC_EXTRA
212 #else
213  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
214 #endif
215 }
216 
225 static inline uint16_t mavlink_msg_control_system_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_control_system_state_t* control_system_state)
226 {
227  return mavlink_msg_control_system_state_pack(system_id, component_id, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate);
228 }
229 
239 static inline uint16_t mavlink_msg_control_system_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_control_system_state_t* control_system_state)
240 {
241  return mavlink_msg_control_system_state_pack_chan(system_id, component_id, chan, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate);
242 }
243 
266 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
267 
268 static inline void mavlink_msg_control_system_state_send(mavlink_channel_t chan, uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
269 {
270 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272  _mav_put_uint64_t(buf, 0, time_usec);
273  _mav_put_float(buf, 8, x_acc);
274  _mav_put_float(buf, 12, y_acc);
275  _mav_put_float(buf, 16, z_acc);
276  _mav_put_float(buf, 20, x_vel);
277  _mav_put_float(buf, 24, y_vel);
278  _mav_put_float(buf, 28, z_vel);
279  _mav_put_float(buf, 32, x_pos);
280  _mav_put_float(buf, 36, y_pos);
281  _mav_put_float(buf, 40, z_pos);
282  _mav_put_float(buf, 44, airspeed);
283  _mav_put_float(buf, 88, roll_rate);
284  _mav_put_float(buf, 92, pitch_rate);
285  _mav_put_float(buf, 96, yaw_rate);
286  _mav_put_float_array(buf, 48, vel_variance, 3);
287  _mav_put_float_array(buf, 60, pos_variance, 3);
288  _mav_put_float_array(buf, 72, q, 4);
289 #if MAVLINK_CRC_EXTRA
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
293 #endif
294 #else
296  packet.time_usec = time_usec;
297  packet.x_acc = x_acc;
298  packet.y_acc = y_acc;
299  packet.z_acc = z_acc;
300  packet.x_vel = x_vel;
301  packet.y_vel = y_vel;
302  packet.z_vel = z_vel;
303  packet.x_pos = x_pos;
304  packet.y_pos = y_pos;
305  packet.z_pos = z_pos;
306  packet.airspeed = airspeed;
307  packet.roll_rate = roll_rate;
308  packet.pitch_rate = pitch_rate;
309  packet.yaw_rate = yaw_rate;
310  mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
311  mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
312  mav_array_memcpy(packet.q, q, sizeof(float)*4);
313 #if MAVLINK_CRC_EXTRA
315 #else
316  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
317 #endif
318 #endif
319 }
320 
321 #if MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
322 /*
323  This varient of _send() can be used to save stack space by re-using
324  memory from the receive buffer. The caller provides a
325  mavlink_message_t which is the size of a full mavlink message. This
326  is usually the receive buffer for the channel, and allows a reply to an
327  incoming message with minimum stack space usage.
328  */
329 static inline void mavlink_msg_control_system_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
330 {
331 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
332  char *buf = (char *)msgbuf;
333  _mav_put_uint64_t(buf, 0, time_usec);
334  _mav_put_float(buf, 8, x_acc);
335  _mav_put_float(buf, 12, y_acc);
336  _mav_put_float(buf, 16, z_acc);
337  _mav_put_float(buf, 20, x_vel);
338  _mav_put_float(buf, 24, y_vel);
339  _mav_put_float(buf, 28, z_vel);
340  _mav_put_float(buf, 32, x_pos);
341  _mav_put_float(buf, 36, y_pos);
342  _mav_put_float(buf, 40, z_pos);
343  _mav_put_float(buf, 44, airspeed);
344  _mav_put_float(buf, 88, roll_rate);
345  _mav_put_float(buf, 92, pitch_rate);
346  _mav_put_float(buf, 96, yaw_rate);
347  _mav_put_float_array(buf, 48, vel_variance, 3);
348  _mav_put_float_array(buf, 60, pos_variance, 3);
349  _mav_put_float_array(buf, 72, q, 4);
350 #if MAVLINK_CRC_EXTRA
352 #else
353  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
354 #endif
355 #else
357  packet->time_usec = time_usec;
358  packet->x_acc = x_acc;
359  packet->y_acc = y_acc;
360  packet->z_acc = z_acc;
361  packet->x_vel = x_vel;
362  packet->y_vel = y_vel;
363  packet->z_vel = z_vel;
364  packet->x_pos = x_pos;
365  packet->y_pos = y_pos;
366  packet->z_pos = z_pos;
367  packet->airspeed = airspeed;
368  packet->roll_rate = roll_rate;
369  packet->pitch_rate = pitch_rate;
370  packet->yaw_rate = yaw_rate;
371  mav_array_memcpy(packet->vel_variance, vel_variance, sizeof(float)*3);
372  mav_array_memcpy(packet->pos_variance, pos_variance, sizeof(float)*3);
373  mav_array_memcpy(packet->q, q, sizeof(float)*4);
374 #if MAVLINK_CRC_EXTRA
376 #else
377  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
378 #endif
379 #endif
380 }
381 #endif
382 
383 #endif
384 
385 // MESSAGE CONTROL_SYSTEM_STATE UNPACKING
386 
387 
393 static inline uint64_t mavlink_msg_control_system_state_get_time_usec(const mavlink_message_t* msg)
394 {
395  return _MAV_RETURN_uint64_t(msg, 0);
396 }
397 
403 static inline float mavlink_msg_control_system_state_get_x_acc(const mavlink_message_t* msg)
404 {
405  return _MAV_RETURN_float(msg, 8);
406 }
407 
413 static inline float mavlink_msg_control_system_state_get_y_acc(const mavlink_message_t* msg)
414 {
415  return _MAV_RETURN_float(msg, 12);
416 }
417 
423 static inline float mavlink_msg_control_system_state_get_z_acc(const mavlink_message_t* msg)
424 {
425  return _MAV_RETURN_float(msg, 16);
426 }
427 
433 static inline float mavlink_msg_control_system_state_get_x_vel(const mavlink_message_t* msg)
434 {
435  return _MAV_RETURN_float(msg, 20);
436 }
437 
443 static inline float mavlink_msg_control_system_state_get_y_vel(const mavlink_message_t* msg)
444 {
445  return _MAV_RETURN_float(msg, 24);
446 }
447 
453 static inline float mavlink_msg_control_system_state_get_z_vel(const mavlink_message_t* msg)
454 {
455  return _MAV_RETURN_float(msg, 28);
456 }
457 
463 static inline float mavlink_msg_control_system_state_get_x_pos(const mavlink_message_t* msg)
464 {
465  return _MAV_RETURN_float(msg, 32);
466 }
467 
473 static inline float mavlink_msg_control_system_state_get_y_pos(const mavlink_message_t* msg)
474 {
475  return _MAV_RETURN_float(msg, 36);
476 }
477 
483 static inline float mavlink_msg_control_system_state_get_z_pos(const mavlink_message_t* msg)
484 {
485  return _MAV_RETURN_float(msg, 40);
486 }
487 
493 static inline float mavlink_msg_control_system_state_get_airspeed(const mavlink_message_t* msg)
494 {
495  return _MAV_RETURN_float(msg, 44);
496 }
497 
503 static inline uint16_t mavlink_msg_control_system_state_get_vel_variance(const mavlink_message_t* msg, float *vel_variance)
504 {
505  return _MAV_RETURN_float_array(msg, vel_variance, 3, 48);
506 }
507 
513 static inline uint16_t mavlink_msg_control_system_state_get_pos_variance(const mavlink_message_t* msg, float *pos_variance)
514 {
515  return _MAV_RETURN_float_array(msg, pos_variance, 3, 60);
516 }
517 
523 static inline uint16_t mavlink_msg_control_system_state_get_q(const mavlink_message_t* msg, float *q)
524 {
525  return _MAV_RETURN_float_array(msg, q, 4, 72);
526 }
527 
533 static inline float mavlink_msg_control_system_state_get_roll_rate(const mavlink_message_t* msg)
534 {
535  return _MAV_RETURN_float(msg, 88);
536 }
537 
543 static inline float mavlink_msg_control_system_state_get_pitch_rate(const mavlink_message_t* msg)
544 {
545  return _MAV_RETURN_float(msg, 92);
546 }
547 
553 static inline float mavlink_msg_control_system_state_get_yaw_rate(const mavlink_message_t* msg)
554 {
555  return _MAV_RETURN_float(msg, 96);
556 }
557 
564 static inline void mavlink_msg_control_system_state_decode(const mavlink_message_t* msg, mavlink_control_system_state_t* control_system_state)
565 {
566 #if MAVLINK_NEED_BYTE_SWAP
567  control_system_state->time_usec = mavlink_msg_control_system_state_get_time_usec(msg);
568  control_system_state->x_acc = mavlink_msg_control_system_state_get_x_acc(msg);
569  control_system_state->y_acc = mavlink_msg_control_system_state_get_y_acc(msg);
570  control_system_state->z_acc = mavlink_msg_control_system_state_get_z_acc(msg);
571  control_system_state->x_vel = mavlink_msg_control_system_state_get_x_vel(msg);
572  control_system_state->y_vel = mavlink_msg_control_system_state_get_y_vel(msg);
573  control_system_state->z_vel = mavlink_msg_control_system_state_get_z_vel(msg);
574  control_system_state->x_pos = mavlink_msg_control_system_state_get_x_pos(msg);
575  control_system_state->y_pos = mavlink_msg_control_system_state_get_y_pos(msg);
576  control_system_state->z_pos = mavlink_msg_control_system_state_get_z_pos(msg);
577  control_system_state->airspeed = mavlink_msg_control_system_state_get_airspeed(msg);
580  mavlink_msg_control_system_state_get_q(msg, control_system_state->q);
581  control_system_state->roll_rate = mavlink_msg_control_system_state_get_roll_rate(msg);
582  control_system_state->pitch_rate = mavlink_msg_control_system_state_get_pitch_rate(msg);
583  control_system_state->yaw_rate = mavlink_msg_control_system_state_get_yaw_rate(msg);
584 #else
585  memcpy(control_system_state, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
586 #endif
587 }
#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
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:09:25