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

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

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

File size: 15.5 KB
Line 
1// MESSAGE ATTITUDE_QUATERNION_COV PACKING
2
3#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV 61
4
5typedef struct MAVLINK_PACKED __mavlink_attitude_quaternion_cov_t
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*/
13} mavlink_attitude_quaternion_cov_t;
14
15#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN 68
16#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN 68
17#define MAVLINK_MSG_ID_61_LEN 68
18#define MAVLINK_MSG_ID_61_MIN_LEN 68
19
20#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC 153
21#define MAVLINK_MSG_ID_61_CRC 153
22
23#define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_Q_LEN 4
24#define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_COVARIANCE_LEN 9
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
28 61, \
29 "ATTITUDE_QUATERNION_COV", \
30 6, \
31 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_boot_ms) }, \
32 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
33 { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
34 { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
35 { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
36 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
41 "ATTITUDE_QUATERNION_COV", \
42 6, \
43 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_boot_ms) }, \
44 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
45 { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
46 { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
47 { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
48 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
49 } \
50}
51#endif
52
53/**
54 * @brief Pack a attitude_quaternion_cov message
55 * @param system_id ID of this system
56 * @param component_id ID of this component (e.g. 200 for IMU)
57 * @param msg The MAVLink message to compress the data into
58 *
59 * @param time_boot_ms Timestamp (milliseconds since system boot)
60 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
61 * @param rollspeed Roll angular speed (rad/s)
62 * @param pitchspeed Pitch angular speed (rad/s)
63 * @param yawspeed Yaw angular speed (rad/s)
64 * @param covariance Attitude covariance
65 * @return length of the message in bytes (excluding serial stream start sign)
66 */
67static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
72 _mav_put_uint32_t(buf, 0, time_boot_ms);
73 _mav_put_float(buf, 20, rollspeed);
74 _mav_put_float(buf, 24, pitchspeed);
75 _mav_put_float(buf, 28, yawspeed);
76 _mav_put_float_array(buf, 4, q, 4);
77 _mav_put_float_array(buf, 32, covariance, 9);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
79#else
80 mavlink_attitude_quaternion_cov_t packet;
81 packet.time_boot_ms = time_boot_ms;
82 packet.rollspeed = rollspeed;
83 packet.pitchspeed = pitchspeed;
84 packet.yawspeed = yawspeed;
85 mav_array_memcpy(packet.q, q, sizeof(float)*4);
86 mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
88#endif
89
90 msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
91 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
92}
93
94/**
95 * @brief Pack a attitude_quaternion_cov message on a channel
96 * @param system_id ID of this system
97 * @param component_id ID of this component (e.g. 200 for IMU)
98 * @param chan The MAVLink channel this message will be sent over
99 * @param msg The MAVLink message to compress the data into
100 * @param time_boot_ms Timestamp (milliseconds since system boot)
101 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
102 * @param rollspeed Roll angular speed (rad/s)
103 * @param pitchspeed Pitch angular speed (rad/s)
104 * @param yawspeed Yaw angular speed (rad/s)
105 * @param covariance Attitude covariance
106 * @return length of the message in bytes (excluding serial stream start sign)
107 */
108static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
109 mavlink_message_t* msg,
110 uint32_t time_boot_ms,const float *q,float rollspeed,float pitchspeed,float yawspeed,const float *covariance)
111{
112#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113 char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
114 _mav_put_uint32_t(buf, 0, time_boot_ms);
115 _mav_put_float(buf, 20, rollspeed);
116 _mav_put_float(buf, 24, pitchspeed);
117 _mav_put_float(buf, 28, yawspeed);
118 _mav_put_float_array(buf, 4, q, 4);
119 _mav_put_float_array(buf, 32, covariance, 9);
120 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
121#else
122 mavlink_attitude_quaternion_cov_t packet;
123 packet.time_boot_ms = time_boot_ms;
124 packet.rollspeed = rollspeed;
125 packet.pitchspeed = pitchspeed;
126 packet.yawspeed = yawspeed;
127 mav_array_memcpy(packet.q, q, sizeof(float)*4);
128 mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
130#endif
131
132 msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
133 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
134}
135
136/**
137 * @brief Encode a attitude_quaternion_cov struct
138 *
139 * @param system_id ID of this system
140 * @param component_id ID of this component (e.g. 200 for IMU)
141 * @param msg The MAVLink message to compress the data into
142 * @param attitude_quaternion_cov C-struct to read the message contents from
143 */
144static 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)
145{
146 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);
147}
148
149/**
150 * @brief Encode a attitude_quaternion_cov struct on a channel
151 *
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param chan The MAVLink channel this message will be sent over
155 * @param msg The MAVLink message to compress the data into
156 * @param attitude_quaternion_cov C-struct to read the message contents from
157 */
158static 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)
159{
160 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);
161}
162
163/**
164 * @brief Send a attitude_quaternion_cov message
165 * @param chan MAVLink channel to send the message
166 *
167 * @param time_boot_ms Timestamp (milliseconds since system boot)
168 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
169 * @param rollspeed Roll angular speed (rad/s)
170 * @param pitchspeed Pitch angular speed (rad/s)
171 * @param yawspeed Yaw angular speed (rad/s)
172 * @param covariance Attitude covariance
173 */
174#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
175
176static 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)
177{
178#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
180 _mav_put_uint32_t(buf, 0, time_boot_ms);
181 _mav_put_float(buf, 20, rollspeed);
182 _mav_put_float(buf, 24, pitchspeed);
183 _mav_put_float(buf, 28, yawspeed);
184 _mav_put_float_array(buf, 4, q, 4);
185 _mav_put_float_array(buf, 32, covariance, 9);
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
187#else
188 mavlink_attitude_quaternion_cov_t packet;
189 packet.time_boot_ms = time_boot_ms;
190 packet.rollspeed = rollspeed;
191 packet.pitchspeed = pitchspeed;
192 packet.yawspeed = yawspeed;
193 mav_array_memcpy(packet.q, q, sizeof(float)*4);
194 mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
196#endif
197}
198
199/**
200 * @brief Send a attitude_quaternion_cov message
201 * @param chan MAVLink channel to send the message
202 * @param struct The MAVLink struct to serialize
203 */
204static inline void mavlink_msg_attitude_quaternion_cov_send_struct(mavlink_channel_t chan, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
205{
206#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
207 mavlink_msg_attitude_quaternion_cov_send(chan, 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);
208#else
209 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)attitude_quaternion_cov, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
210#endif
211}
212
213#if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
214/*
215 This varient of _send() can be used to save stack space by re-using
216 memory from the receive buffer. The caller provides a
217 mavlink_message_t which is the size of a full mavlink message. This
218 is usually the receive buffer for the channel, and allows a reply to an
219 incoming message with minimum stack space usage.
220 */
221static 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)
222{
223#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
224 char *buf = (char *)msgbuf;
225 _mav_put_uint32_t(buf, 0, time_boot_ms);
226 _mav_put_float(buf, 20, rollspeed);
227 _mav_put_float(buf, 24, pitchspeed);
228 _mav_put_float(buf, 28, yawspeed);
229 _mav_put_float_array(buf, 4, q, 4);
230 _mav_put_float_array(buf, 32, covariance, 9);
231 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
232#else
233 mavlink_attitude_quaternion_cov_t *packet = (mavlink_attitude_quaternion_cov_t *)msgbuf;
234 packet->time_boot_ms = time_boot_ms;
235 packet->rollspeed = rollspeed;
236 packet->pitchspeed = pitchspeed;
237 packet->yawspeed = yawspeed;
238 mav_array_memcpy(packet->q, q, sizeof(float)*4);
239 mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9);
240 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
241#endif
242}
243#endif
244
245#endif
246
247// MESSAGE ATTITUDE_QUATERNION_COV UNPACKING
248
249
250/**
251 * @brief Get field time_boot_ms from attitude_quaternion_cov message
252 *
253 * @return Timestamp (milliseconds since system boot)
254 */
255static inline uint32_t mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(const mavlink_message_t* msg)
256{
257 return _MAV_RETURN_uint32_t(msg, 0);
258}
259
260/**
261 * @brief Get field q from attitude_quaternion_cov message
262 *
263 * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
264 */
265static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_q(const mavlink_message_t* msg, float *q)
266{
267 return _MAV_RETURN_float_array(msg, q, 4, 4);
268}
269
270/**
271 * @brief Get field rollspeed from attitude_quaternion_cov message
272 *
273 * @return Roll angular speed (rad/s)
274 */
275static inline float mavlink_msg_attitude_quaternion_cov_get_rollspeed(const mavlink_message_t* msg)
276{
277 return _MAV_RETURN_float(msg, 20);
278}
279
280/**
281 * @brief Get field pitchspeed from attitude_quaternion_cov message
282 *
283 * @return Pitch angular speed (rad/s)
284 */
285static inline float mavlink_msg_attitude_quaternion_cov_get_pitchspeed(const mavlink_message_t* msg)
286{
287 return _MAV_RETURN_float(msg, 24);
288}
289
290/**
291 * @brief Get field yawspeed from attitude_quaternion_cov message
292 *
293 * @return Yaw angular speed (rad/s)
294 */
295static inline float mavlink_msg_attitude_quaternion_cov_get_yawspeed(const mavlink_message_t* msg)
296{
297 return _MAV_RETURN_float(msg, 28);
298}
299
300/**
301 * @brief Get field covariance from attitude_quaternion_cov message
302 *
303 * @return Attitude covariance
304 */
305static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
306{
307 return _MAV_RETURN_float_array(msg, covariance, 9, 32);
308}
309
310/**
311 * @brief Decode a attitude_quaternion_cov message into a struct
312 *
313 * @param msg The message to decode
314 * @param attitude_quaternion_cov C-struct to decode the message contents into
315 */
316static inline void mavlink_msg_attitude_quaternion_cov_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
317{
318#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
319 attitude_quaternion_cov->time_boot_ms = mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(msg);
320 mavlink_msg_attitude_quaternion_cov_get_q(msg, attitude_quaternion_cov->q);
321 attitude_quaternion_cov->rollspeed = mavlink_msg_attitude_quaternion_cov_get_rollspeed(msg);
322 attitude_quaternion_cov->pitchspeed = mavlink_msg_attitude_quaternion_cov_get_pitchspeed(msg);
323 attitude_quaternion_cov->yawspeed = mavlink_msg_attitude_quaternion_cov_get_yawspeed(msg);
324 mavlink_msg_attitude_quaternion_cov_get_covariance(msg, attitude_quaternion_cov->covariance);
325#else
326 uint8_t len = msg->len < MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN? msg->len : MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN;
327 memset(attitude_quaternion_cov, 0, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
328 memcpy(attitude_quaternion_cov, _MAV_PAYLOAD(msg), len);
329#endif
330}
Note: See TracBrowser for help on using the repository browser.