1 // MESSAGE ATTITUDE_QUATERNION_COV PACKING
3 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV 61
5 typedef struct __mavlink_attitude_quaternion_cov_t
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
;
15 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN 68
16 #define MAVLINK_MSG_ID_61_LEN 68
18 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC 153
19 #define MAVLINK_MSG_ID_61_CRC 153
21 #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_Q_LEN 4
22 #define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_COVARIANCE_LEN 9
24 #define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
25 "ATTITUDE_QUATERNION_COV", \
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) }, \
38 * @brief Pack a attitude_quaternion_cov message
39 * @param system_id ID of this system
40 * @param component_id ID of this component (e.g. 200 for IMU)
41 * @param msg The MAVLink message to compress the data into
43 * @param time_boot_ms Timestamp (milliseconds since system boot)
44 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
45 * @param rollspeed Roll angular speed (rad/s)
46 * @param pitchspeed Pitch angular speed (rad/s)
47 * @param yawspeed Yaw angular speed (rad/s)
48 * @param covariance Attitude covariance
49 * @return length of the message in bytes (excluding serial stream start sign)
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
)
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf
[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
];
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);
62 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
64 mavlink_attitude_quaternion_cov_t packet
;
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);
71 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
74 msg
->msgid
= MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
;
76 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
78 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
83 * @brief Pack a attitude_quaternion_cov message on a channel
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param chan The MAVLink channel this message will be sent over
87 * @param msg The MAVLink message to compress the data into
88 * @param time_boot_ms Timestamp (milliseconds since system boot)
89 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
90 * @param rollspeed Roll angular speed (rad/s)
91 * @param pitchspeed Pitch angular speed (rad/s)
92 * @param yawspeed Yaw angular speed (rad/s)
93 * @param covariance Attitude covariance
94 * @return length of the message in bytes (excluding serial stream start sign)
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
)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf
[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
];
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);
108 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
110 mavlink_attitude_quaternion_cov_t packet
;
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);
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
120 msg
->msgid
= MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
;
121 #if MAVLINK_CRC_EXTRA
122 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
124 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
129 * @brief Encode a attitude_quaternion_cov struct
131 * @param system_id ID of this system
132 * @param component_id ID of this component (e.g. 200 for IMU)
133 * @param msg The MAVLink message to compress the data into
134 * @param attitude_quaternion_cov C-struct to read the message contents from
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
)
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
);
142 * @brief Encode a attitude_quaternion_cov struct on a channel
144 * @param system_id ID of this system
145 * @param component_id ID of this component (e.g. 200 for IMU)
146 * @param chan The MAVLink channel this message will be sent over
147 * @param msg The MAVLink message to compress the data into
148 * @param attitude_quaternion_cov C-struct to read the message contents from
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
)
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
);
156 * @brief Send a attitude_quaternion_cov message
157 * @param chan MAVLink channel to send the message
159 * @param time_boot_ms Timestamp (milliseconds since system boot)
160 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
161 * @param rollspeed Roll angular speed (rad/s)
162 * @param pitchspeed Pitch angular speed (rad/s)
163 * @param yawspeed Yaw angular speed (rad/s)
164 * @param covariance Attitude covariance
166 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
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
)
170 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171 char buf
[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
];
172 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
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
179 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
181 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
184 mavlink_attitude_quaternion_cov_t packet
;
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
192 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, (const char *)&packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
194 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, (const char *)&packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
199 #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
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
)
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 char *buf
= (char *)msgbuf
;
211 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
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
218 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
220 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, buf
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
223 mavlink_attitude_quaternion_cov_t
*packet
= (mavlink_attitude_quaternion_cov_t
*)msgbuf
;
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
231 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, (const char *)packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC
);
233 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
, (const char *)packet
, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);
241 // MESSAGE ATTITUDE_QUATERNION_COV UNPACKING
245 * @brief Get field time_boot_ms from attitude_quaternion_cov message
247 * @return Timestamp (milliseconds since system boot)
249 static inline uint32_t mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(const mavlink_message_t
* msg
)
251 return _MAV_RETURN_uint32_t(msg
, 0);
255 * @brief Get field q from attitude_quaternion_cov message
257 * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
259 static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_q(const mavlink_message_t
* msg
, float *q
)
261 return _MAV_RETURN_float_array(msg
, q
, 4, 4);
265 * @brief Get field rollspeed from attitude_quaternion_cov message
267 * @return Roll angular speed (rad/s)
269 static inline float mavlink_msg_attitude_quaternion_cov_get_rollspeed(const mavlink_message_t
* msg
)
271 return _MAV_RETURN_float(msg
, 20);
275 * @brief Get field pitchspeed from attitude_quaternion_cov message
277 * @return Pitch angular speed (rad/s)
279 static inline float mavlink_msg_attitude_quaternion_cov_get_pitchspeed(const mavlink_message_t
* msg
)
281 return _MAV_RETURN_float(msg
, 24);
285 * @brief Get field yawspeed from attitude_quaternion_cov message
287 * @return Yaw angular speed (rad/s)
289 static inline float mavlink_msg_attitude_quaternion_cov_get_yawspeed(const mavlink_message_t
* msg
)
291 return _MAV_RETURN_float(msg
, 28);
295 * @brief Get field covariance from attitude_quaternion_cov message
297 * @return Attitude covariance
299 static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_covariance(const mavlink_message_t
* msg
, float *covariance
)
301 return _MAV_RETURN_float_array(msg
, covariance
, 9, 32);
305 * @brief Decode a attitude_quaternion_cov message into a struct
307 * @param msg The message to decode
308 * @param attitude_quaternion_cov C-struct to decode the message contents into
310 static inline void mavlink_msg_attitude_quaternion_cov_decode(const mavlink_message_t
* msg
, mavlink_attitude_quaternion_cov_t
* attitude_quaternion_cov
)
312 #if MAVLINK_NEED_BYTE_SWAP
313 attitude_quaternion_cov
->time_boot_ms
= mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(msg
);
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
);
320 memcpy(attitude_quaternion_cov
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN
);