mavlink_msg_attitude_quaternion_cov.h
Go to the documentation of this file.
1 // MESSAGE ATTITUDE_QUATERNION_COV PACKING
2 
3 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV 61
4 
6 {
7  uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
8  float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)*/
9  float rollspeed; /*< Roll angular speed (rad/s)*/
10  float pitchspeed; /*< Pitch angular speed (rad/s)*/
11  float yawspeed; /*< Yaw angular speed (rad/s)*/
12  float covariance[9]; /*< Attitude covariance*/
14 
15 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN 68
16 #define MAVLINK_MSG_ID_61_LEN 68
17 
18 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC 153
19 #define MAVLINK_MSG_ID_61_CRC 153
20 
21 #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_Q_LEN 4
22 #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_COVARIANCE_LEN 9
23 
24 #define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
25  "ATTITUDE_QUATERNION_COV", \
26  6, \
27  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_boot_ms) }, \
28  { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
29  { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
30  { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
31  { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
32  { "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
33  } \
34 }
35 
36 
51 static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
52  uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
53 {
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
56  _mav_put_uint32_t(buf, 0, time_boot_ms);
57  _mav_put_float(buf, 20, rollspeed);
58  _mav_put_float(buf, 24, pitchspeed);
59  _mav_put_float(buf, 28, yawspeed);
60  _mav_put_float_array(buf, 4, q, 4);
61  _mav_put_float_array(buf, 32, covariance, 9);
63 #else
65  packet.time_boot_ms = time_boot_ms;
66  packet.rollspeed = rollspeed;
67  packet.pitchspeed = pitchspeed;
68  packet.yawspeed = yawspeed;
69  mav_array_memcpy(packet.q, q, sizeof(float)*4);
70  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
72 #endif
73 
75 #if MAVLINK_CRC_EXTRA
77 #else
78  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
79 #endif
80 }
81 
96 static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
97  mavlink_message_t* msg,
98  uint32_t time_boot_ms,const float *q,float rollspeed,float pitchspeed,float yawspeed,const float *covariance)
99 {
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
102  _mav_put_uint32_t(buf, 0, time_boot_ms);
103  _mav_put_float(buf, 20, rollspeed);
104  _mav_put_float(buf, 24, pitchspeed);
105  _mav_put_float(buf, 28, yawspeed);
106  _mav_put_float_array(buf, 4, q, 4);
107  _mav_put_float_array(buf, 32, covariance, 9);
109 #else
111  packet.time_boot_ms = time_boot_ms;
112  packet.rollspeed = rollspeed;
113  packet.pitchspeed = pitchspeed;
114  packet.yawspeed = yawspeed;
115  mav_array_memcpy(packet.q, q, sizeof(float)*4);
116  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
118 #endif
119 
121 #if MAVLINK_CRC_EXTRA
123 #else
124  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
125 #endif
126 }
127 
136 static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
137 {
138  return mavlink_msg_attitude_quaternion_cov_pack(system_id, component_id, msg, attitude_quaternion_cov->time_boot_ms, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
139 }
140 
150 static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
151 {
152  return mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, chan, msg, attitude_quaternion_cov->time_boot_ms, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
153 }
154 
166 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
167 
168 static inline void mavlink_msg_attitude_quaternion_cov_send(mavlink_channel_t chan, uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
169 {
170 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
173  _mav_put_float(buf, 20, rollspeed);
174  _mav_put_float(buf, 24, pitchspeed);
175  _mav_put_float(buf, 28, yawspeed);
176  _mav_put_float_array(buf, 4, q, 4);
177  _mav_put_float_array(buf, 32, covariance, 9);
178 #if MAVLINK_CRC_EXTRA
180 #else
181  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
182 #endif
183 #else
185  packet.time_boot_ms = time_boot_ms;
186  packet.rollspeed = rollspeed;
187  packet.pitchspeed = pitchspeed;
188  packet.yawspeed = yawspeed;
189  mav_array_memcpy(packet.q, q, sizeof(float)*4);
190  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
191 #if MAVLINK_CRC_EXTRA
193 #else
194  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
195 #endif
196 #endif
197 }
198 
199 #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
200 /*
201  This varient of _send() can be used to save stack space by re-using
202  memory from the receive buffer. The caller provides a
203  mavlink_message_t which is the size of a full mavlink message. This
204  is usually the receive buffer for the channel, and allows a reply to an
205  incoming message with minimum stack space usage.
206  */
207 static inline void mavlink_msg_attitude_quaternion_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210  char *buf = (char *)msgbuf;
212  _mav_put_float(buf, 20, rollspeed);
213  _mav_put_float(buf, 24, pitchspeed);
214  _mav_put_float(buf, 28, yawspeed);
215  _mav_put_float_array(buf, 4, q, 4);
216  _mav_put_float_array(buf, 32, covariance, 9);
217 #if MAVLINK_CRC_EXTRA
219 #else
220  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
221 #endif
222 #else
224  packet->time_boot_ms = time_boot_ms;
225  packet->rollspeed = rollspeed;
226  packet->pitchspeed = pitchspeed;
227  packet->yawspeed = yawspeed;
228  mav_array_memcpy(packet->q, q, sizeof(float)*4);
229  mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9);
230 #if MAVLINK_CRC_EXTRA
232 #else
233  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
234 #endif
235 #endif
236 }
237 #endif
238 
239 #endif
240 
241 // MESSAGE ATTITUDE_QUATERNION_COV UNPACKING
242 
243 
249 static inline uint32_t mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(const mavlink_message_t* msg)
250 {
251  return _MAV_RETURN_uint32_t(msg, 0);
252 }
253 
259 static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_q(const mavlink_message_t* msg, float *q)
260 {
261  return _MAV_RETURN_float_array(msg, q, 4, 4);
262 }
263 
269 static inline float mavlink_msg_attitude_quaternion_cov_get_rollspeed(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_float(msg, 20);
272 }
273 
279 static inline float mavlink_msg_attitude_quaternion_cov_get_pitchspeed(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_float(msg, 24);
282 }
283 
289 static inline float mavlink_msg_attitude_quaternion_cov_get_yawspeed(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_float(msg, 28);
292 }
293 
299 static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
300 {
301  return _MAV_RETURN_float_array(msg, covariance, 9, 32);
302 }
303 
310 static inline void mavlink_msg_attitude_quaternion_cov_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
311 {
312 #if MAVLINK_NEED_BYTE_SWAP
314  mavlink_msg_attitude_quaternion_cov_get_q(msg, attitude_quaternion_cov->q);
315  attitude_quaternion_cov->rollspeed = mavlink_msg_attitude_quaternion_cov_get_rollspeed(msg);
316  attitude_quaternion_cov->pitchspeed = mavlink_msg_attitude_quaternion_cov_get_pitchspeed(msg);
317  attitude_quaternion_cov->yawspeed = mavlink_msg_attitude_quaternion_cov_get_yawspeed(msg);
318  mavlink_msg_attitude_quaternion_cov_get_covariance(msg, attitude_quaternion_cov->covariance);
319 #else
320  memcpy(attitude_quaternion_cov, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
321 #endif
322 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


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