2 // MESSAGE ATT_POS_MOCAP PACKING
4 #define MAVLINK_MSG_ID_ATT_POS_MOCAP 138
7 typedef struct __mavlink_att_pos_mocap_t
{
8 uint64_t time_usec
; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 float q
[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
10 float x
; /*< [m] X position (NED)*/
11 float y
; /*< [m] Y position (NED)*/
12 float z
; /*< [m] Z position (NED)*/
13 float covariance
[21]; /*< Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.*/
14 } mavlink_att_pos_mocap_t
;
16 #define MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN 120
17 #define MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN 36
18 #define MAVLINK_MSG_ID_138_LEN 120
19 #define MAVLINK_MSG_ID_138_MIN_LEN 36
21 #define MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC 109
22 #define MAVLINK_MSG_ID_138_CRC 109
24 #define MAVLINK_MSG_ATT_POS_MOCAP_FIELD_Q_LEN 4
25 #define MAVLINK_MSG_ATT_POS_MOCAP_FIELD_COVARIANCE_LEN 21
27 #if MAVLINK_COMMAND_24BIT
28 #define MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP { \
32 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_att_pos_mocap_t, time_usec) }, \
33 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_att_pos_mocap_t, q) }, \
34 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_att_pos_mocap_t, x) }, \
35 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_att_pos_mocap_t, y) }, \
36 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_att_pos_mocap_t, z) }, \
37 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 36, offsetof(mavlink_att_pos_mocap_t, covariance) }, \
41 #define MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP { \
44 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_att_pos_mocap_t, time_usec) }, \
45 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_att_pos_mocap_t, q) }, \
46 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_att_pos_mocap_t, x) }, \
47 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_att_pos_mocap_t, y) }, \
48 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_att_pos_mocap_t, z) }, \
49 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 36, offsetof(mavlink_att_pos_mocap_t, covariance) }, \
55 * @brief Pack a att_pos_mocap message
56 * @param system_id ID of this system
57 * @param component_id ID of this component (e.g. 200 for IMU)
58 * @param msg The MAVLink message to compress the data into
60 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
61 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
62 * @param x [m] X position (NED)
63 * @param y [m] Y position (NED)
64 * @param z [m] Z position (NED)
65 * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.
66 * @return length of the message in bytes (excluding serial stream start sign)
68 static inline uint16_t mavlink_msg_att_pos_mocap_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
69 uint64_t time_usec
, const float *q
, float x
, float y
, float z
, const float *covariance
)
71 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
72 char buf
[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
];
73 _mav_put_uint64_t(buf
, 0, time_usec
);
74 _mav_put_float(buf
, 24, x
);
75 _mav_put_float(buf
, 28, y
);
76 _mav_put_float(buf
, 32, z
);
77 _mav_put_float_array(buf
, 8, q
, 4);
78 _mav_put_float_array(buf
, 36, covariance
, 21);
79 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
);
81 mavlink_att_pos_mocap_t packet
;
82 packet
.time_usec
= time_usec
;
86 mav_array_memcpy(packet
.q
, q
, sizeof(float)*4);
87 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
88 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
);
91 msg
->msgid
= MAVLINK_MSG_ID_ATT_POS_MOCAP
;
92 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
96 * @brief Pack a att_pos_mocap message on a channel
97 * @param system_id ID of this system
98 * @param component_id ID of this component (e.g. 200 for IMU)
99 * @param chan The MAVLink channel this message will be sent over
100 * @param msg The MAVLink message to compress the data into
101 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
102 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
103 * @param x [m] X position (NED)
104 * @param y [m] Y position (NED)
105 * @param z [m] Z position (NED)
106 * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.
107 * @return length of the message in bytes (excluding serial stream start sign)
109 static inline uint16_t mavlink_msg_att_pos_mocap_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
110 mavlink_message_t
* msg
,
111 uint64_t time_usec
,const float *q
,float x
,float y
,float z
,const float *covariance
)
113 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
114 char buf
[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
];
115 _mav_put_uint64_t(buf
, 0, time_usec
);
116 _mav_put_float(buf
, 24, x
);
117 _mav_put_float(buf
, 28, y
);
118 _mav_put_float(buf
, 32, z
);
119 _mav_put_float_array(buf
, 8, q
, 4);
120 _mav_put_float_array(buf
, 36, covariance
, 21);
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
);
123 mavlink_att_pos_mocap_t packet
;
124 packet
.time_usec
= time_usec
;
128 mav_array_memcpy(packet
.q
, q
, sizeof(float)*4);
129 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
130 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
);
133 msg
->msgid
= MAVLINK_MSG_ID_ATT_POS_MOCAP
;
134 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
138 * @brief Encode a att_pos_mocap struct
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param msg The MAVLink message to compress the data into
143 * @param att_pos_mocap C-struct to read the message contents from
145 static inline uint16_t mavlink_msg_att_pos_mocap_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_att_pos_mocap_t
* att_pos_mocap
)
147 return mavlink_msg_att_pos_mocap_pack(system_id
, component_id
, msg
, att_pos_mocap
->time_usec
, att_pos_mocap
->q
, att_pos_mocap
->x
, att_pos_mocap
->y
, att_pos_mocap
->z
, att_pos_mocap
->covariance
);
151 * @brief Encode a att_pos_mocap struct on a channel
153 * @param system_id ID of this system
154 * @param component_id ID of this component (e.g. 200 for IMU)
155 * @param chan The MAVLink channel this message will be sent over
156 * @param msg The MAVLink message to compress the data into
157 * @param att_pos_mocap C-struct to read the message contents from
159 static inline uint16_t mavlink_msg_att_pos_mocap_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_att_pos_mocap_t
* att_pos_mocap
)
161 return mavlink_msg_att_pos_mocap_pack_chan(system_id
, component_id
, chan
, msg
, att_pos_mocap
->time_usec
, att_pos_mocap
->q
, att_pos_mocap
->x
, att_pos_mocap
->y
, att_pos_mocap
->z
, att_pos_mocap
->covariance
);
165 * @brief Send a att_pos_mocap message
166 * @param chan MAVLink channel to send the message
168 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
169 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
170 * @param x [m] X position (NED)
171 * @param y [m] Y position (NED)
172 * @param z [m] Z position (NED)
173 * @param covariance Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.
175 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
177 static inline void mavlink_msg_att_pos_mocap_send(mavlink_channel_t chan
, uint64_t time_usec
, const float *q
, float x
, float y
, float z
, const float *covariance
)
179 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
180 char buf
[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
];
181 _mav_put_uint64_t(buf
, 0, time_usec
);
182 _mav_put_float(buf
, 24, x
);
183 _mav_put_float(buf
, 28, y
);
184 _mav_put_float(buf
, 32, z
);
185 _mav_put_float_array(buf
, 8, q
, 4);
186 _mav_put_float_array(buf
, 36, covariance
, 21);
187 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP
, buf
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
189 mavlink_att_pos_mocap_t packet
;
190 packet
.time_usec
= time_usec
;
194 mav_array_memcpy(packet
.q
, q
, sizeof(float)*4);
195 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
196 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP
, (const char *)&packet
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
201 * @brief Send a att_pos_mocap message
202 * @param chan MAVLink channel to send the message
203 * @param struct The MAVLink struct to serialize
205 static inline void mavlink_msg_att_pos_mocap_send_struct(mavlink_channel_t chan
, const mavlink_att_pos_mocap_t
* att_pos_mocap
)
207 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
208 mavlink_msg_att_pos_mocap_send(chan
, att_pos_mocap
->time_usec
, att_pos_mocap
->q
, att_pos_mocap
->x
, att_pos_mocap
->y
, att_pos_mocap
->z
, att_pos_mocap
->covariance
);
210 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP
, (const char *)att_pos_mocap
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
214 #if MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 This varient of _send() can be used to save stack space by re-using
217 memory from the receive buffer. The caller provides a
218 mavlink_message_t which is the size of a full mavlink message. This
219 is usually the receive buffer for the channel, and allows a reply to an
220 incoming message with minimum stack space usage.
222 static inline void mavlink_msg_att_pos_mocap_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint64_t time_usec
, const float *q
, float x
, float y
, float z
, const float *covariance
)
224 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 char *buf
= (char *)msgbuf
;
226 _mav_put_uint64_t(buf
, 0, time_usec
);
227 _mav_put_float(buf
, 24, x
);
228 _mav_put_float(buf
, 28, y
);
229 _mav_put_float(buf
, 32, z
);
230 _mav_put_float_array(buf
, 8, q
, 4);
231 _mav_put_float_array(buf
, 36, covariance
, 21);
232 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP
, buf
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
234 mavlink_att_pos_mocap_t
*packet
= (mavlink_att_pos_mocap_t
*)msgbuf
;
235 packet
->time_usec
= time_usec
;
239 mav_array_memcpy(packet
->q
, q
, sizeof(float)*4);
240 mav_array_memcpy(packet
->covariance
, covariance
, sizeof(float)*21);
241 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_ATT_POS_MOCAP
, (const char *)packet
, MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC
);
248 // MESSAGE ATT_POS_MOCAP UNPACKING
252 * @brief Get field time_usec from att_pos_mocap message
254 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
256 static inline uint64_t mavlink_msg_att_pos_mocap_get_time_usec(const mavlink_message_t
* msg
)
258 return _MAV_RETURN_uint64_t(msg
, 0);
262 * @brief Get field q from att_pos_mocap message
264 * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
266 static inline uint16_t mavlink_msg_att_pos_mocap_get_q(const mavlink_message_t
* msg
, float *q
)
268 return _MAV_RETURN_float_array(msg
, q
, 4, 8);
272 * @brief Get field x from att_pos_mocap message
274 * @return [m] X position (NED)
276 static inline float mavlink_msg_att_pos_mocap_get_x(const mavlink_message_t
* msg
)
278 return _MAV_RETURN_float(msg
, 24);
282 * @brief Get field y from att_pos_mocap message
284 * @return [m] Y position (NED)
286 static inline float mavlink_msg_att_pos_mocap_get_y(const mavlink_message_t
* msg
)
288 return _MAV_RETURN_float(msg
, 28);
292 * @brief Get field z from att_pos_mocap message
294 * @return [m] Z position (NED)
296 static inline float mavlink_msg_att_pos_mocap_get_z(const mavlink_message_t
* msg
)
298 return _MAV_RETURN_float(msg
, 32);
302 * @brief Get field covariance from att_pos_mocap message
304 * @return Row-major representation of a pose 6x6 cross-covariance matrix upper right triangle (states: x, y, z, roll, pitch, yaw; first six entries are the first ROW, next five entries are the second ROW, etc.). If unknown, assign NaN value to first element in the array.
306 static inline uint16_t mavlink_msg_att_pos_mocap_get_covariance(const mavlink_message_t
* msg
, float *covariance
)
308 return _MAV_RETURN_float_array(msg
, covariance
, 21, 36);
312 * @brief Decode a att_pos_mocap message into a struct
314 * @param msg The message to decode
315 * @param att_pos_mocap C-struct to decode the message contents into
317 static inline void mavlink_msg_att_pos_mocap_decode(const mavlink_message_t
* msg
, mavlink_att_pos_mocap_t
* att_pos_mocap
)
319 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
320 att_pos_mocap
->time_usec
= mavlink_msg_att_pos_mocap_get_time_usec(msg
);
321 mavlink_msg_att_pos_mocap_get_q(msg
, att_pos_mocap
->q
);
322 att_pos_mocap
->x
= mavlink_msg_att_pos_mocap_get_x(msg
);
323 att_pos_mocap
->y
= mavlink_msg_att_pos_mocap_get_y(msg
);
324 att_pos_mocap
->z
= mavlink_msg_att_pos_mocap_get_z(msg
);
325 mavlink_msg_att_pos_mocap_get_covariance(msg
, att_pos_mocap
->covariance
);
327 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
? msg
->len
: MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
;
328 memset(att_pos_mocap
, 0, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN
);
329 memcpy(att_pos_mocap
, _MAV_PAYLOAD(msg
), len
);