2 // MESSAGE VISION_POSITION_ESTIMATE PACKING
4 #define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE 102
7 typedef struct __mavlink_vision_position_estimate_t
{
8 uint64_t usec
; /*< [us] Timestamp (UNIX time or time since system boot)*/
9 float x
; /*< [m] Local X position*/
10 float y
; /*< [m] Local Y position*/
11 float z
; /*< [m] Local Z position*/
12 float roll
; /*< [rad] Roll angle*/
13 float pitch
; /*< [rad] Pitch angle*/
14 float yaw
; /*< [rad] Yaw angle*/
15 float covariance
[21]; /*< Row-major representation of 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.*/
16 uint8_t reset_counter
; /*< Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.*/
17 } mavlink_vision_position_estimate_t
;
19 #define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN 117
20 #define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN 32
21 #define MAVLINK_MSG_ID_102_LEN 117
22 #define MAVLINK_MSG_ID_102_MIN_LEN 32
24 #define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC 158
25 #define MAVLINK_MSG_ID_102_CRC 158
27 #define MAVLINK_MSG_VISION_POSITION_ESTIMATE_FIELD_COVARIANCE_LEN 21
29 #if MAVLINK_COMMAND_24BIT
30 #define MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE { \
32 "VISION_POSITION_ESTIMATE", \
34 { { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_position_estimate_t, usec) }, \
35 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vision_position_estimate_t, x) }, \
36 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vision_position_estimate_t, y) }, \
37 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vision_position_estimate_t, z) }, \
38 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vision_position_estimate_t, roll) }, \
39 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_vision_position_estimate_t, pitch) }, \
40 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_vision_position_estimate_t, yaw) }, \
41 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 32, offsetof(mavlink_vision_position_estimate_t, covariance) }, \
42 { "reset_counter", NULL, MAVLINK_TYPE_UINT8_T, 0, 116, offsetof(mavlink_vision_position_estimate_t, reset_counter) }, \
46 #define MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE { \
47 "VISION_POSITION_ESTIMATE", \
49 { { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_position_estimate_t, usec) }, \
50 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vision_position_estimate_t, x) }, \
51 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vision_position_estimate_t, y) }, \
52 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vision_position_estimate_t, z) }, \
53 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vision_position_estimate_t, roll) }, \
54 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_vision_position_estimate_t, pitch) }, \
55 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_vision_position_estimate_t, yaw) }, \
56 { "covariance", NULL, MAVLINK_TYPE_FLOAT, 21, 32, offsetof(mavlink_vision_position_estimate_t, covariance) }, \
57 { "reset_counter", NULL, MAVLINK_TYPE_UINT8_T, 0, 116, offsetof(mavlink_vision_position_estimate_t, reset_counter) }, \
63 * @brief Pack a vision_position_estimate message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
68 * @param usec [us] Timestamp (UNIX time or time since system boot)
69 * @param x [m] Local X position
70 * @param y [m] Local Y position
71 * @param z [m] Local Z position
72 * @param roll [rad] Roll angle
73 * @param pitch [rad] Pitch angle
74 * @param yaw [rad] Yaw angle
75 * @param covariance Row-major representation of 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.
76 * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.
77 * @return length of the message in bytes (excluding serial stream start sign)
79 static inline uint16_t mavlink_msg_vision_position_estimate_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
80 uint64_t usec
, float x
, float y
, float z
, float roll
, float pitch
, float yaw
, const float *covariance
, uint8_t reset_counter
)
82 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf
[MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
];
84 _mav_put_uint64_t(buf
, 0, usec
);
85 _mav_put_float(buf
, 8, x
);
86 _mav_put_float(buf
, 12, y
);
87 _mav_put_float(buf
, 16, z
);
88 _mav_put_float(buf
, 20, roll
);
89 _mav_put_float(buf
, 24, pitch
);
90 _mav_put_float(buf
, 28, yaw
);
91 _mav_put_uint8_t(buf
, 116, reset_counter
);
92 _mav_put_float_array(buf
, 32, covariance
, 21);
93 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
);
95 mavlink_vision_position_estimate_t packet
;
101 packet
.pitch
= pitch
;
103 packet
.reset_counter
= reset_counter
;
104 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
);
108 msg
->msgid
= MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
;
109 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
113 * @brief Pack a vision_position_estimate message on a channel
114 * @param system_id ID of this system
115 * @param component_id ID of this component (e.g. 200 for IMU)
116 * @param chan The MAVLink channel this message will be sent over
117 * @param msg The MAVLink message to compress the data into
118 * @param usec [us] Timestamp (UNIX time or time since system boot)
119 * @param x [m] Local X position
120 * @param y [m] Local Y position
121 * @param z [m] Local Z position
122 * @param roll [rad] Roll angle
123 * @param pitch [rad] Pitch angle
124 * @param yaw [rad] Yaw angle
125 * @param covariance Row-major representation of 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.
126 * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.
127 * @return length of the message in bytes (excluding serial stream start sign)
129 static inline uint16_t mavlink_msg_vision_position_estimate_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
130 mavlink_message_t
* msg
,
131 uint64_t usec
,float x
,float y
,float z
,float roll
,float pitch
,float yaw
,const float *covariance
,uint8_t reset_counter
)
133 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
134 char buf
[MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
];
135 _mav_put_uint64_t(buf
, 0, usec
);
136 _mav_put_float(buf
, 8, x
);
137 _mav_put_float(buf
, 12, y
);
138 _mav_put_float(buf
, 16, z
);
139 _mav_put_float(buf
, 20, roll
);
140 _mav_put_float(buf
, 24, pitch
);
141 _mav_put_float(buf
, 28, yaw
);
142 _mav_put_uint8_t(buf
, 116, reset_counter
);
143 _mav_put_float_array(buf
, 32, covariance
, 21);
144 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
);
146 mavlink_vision_position_estimate_t packet
;
152 packet
.pitch
= pitch
;
154 packet
.reset_counter
= reset_counter
;
155 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
156 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
);
159 msg
->msgid
= MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
;
160 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
164 * @brief Encode a vision_position_estimate struct
166 * @param system_id ID of this system
167 * @param component_id ID of this component (e.g. 200 for IMU)
168 * @param msg The MAVLink message to compress the data into
169 * @param vision_position_estimate C-struct to read the message contents from
171 static inline uint16_t mavlink_msg_vision_position_estimate_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_vision_position_estimate_t
* vision_position_estimate
)
173 return mavlink_msg_vision_position_estimate_pack(system_id
, component_id
, msg
, vision_position_estimate
->usec
, vision_position_estimate
->x
, vision_position_estimate
->y
, vision_position_estimate
->z
, vision_position_estimate
->roll
, vision_position_estimate
->pitch
, vision_position_estimate
->yaw
, vision_position_estimate
->covariance
, vision_position_estimate
->reset_counter
);
177 * @brief Encode a vision_position_estimate struct on a channel
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param chan The MAVLink channel this message will be sent over
182 * @param msg The MAVLink message to compress the data into
183 * @param vision_position_estimate C-struct to read the message contents from
185 static inline uint16_t mavlink_msg_vision_position_estimate_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_vision_position_estimate_t
* vision_position_estimate
)
187 return mavlink_msg_vision_position_estimate_pack_chan(system_id
, component_id
, chan
, msg
, vision_position_estimate
->usec
, vision_position_estimate
->x
, vision_position_estimate
->y
, vision_position_estimate
->z
, vision_position_estimate
->roll
, vision_position_estimate
->pitch
, vision_position_estimate
->yaw
, vision_position_estimate
->covariance
, vision_position_estimate
->reset_counter
);
191 * @brief Send a vision_position_estimate message
192 * @param chan MAVLink channel to send the message
194 * @param usec [us] Timestamp (UNIX time or time since system boot)
195 * @param x [m] Local X position
196 * @param y [m] Local Y position
197 * @param z [m] Local Z position
198 * @param roll [rad] Roll angle
199 * @param pitch [rad] Pitch angle
200 * @param yaw [rad] Yaw angle
201 * @param covariance Row-major representation of 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.
202 * @param reset_counter Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.
204 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 static inline void mavlink_msg_vision_position_estimate_send(mavlink_channel_t chan
, uint64_t usec
, float x
, float y
, float z
, float roll
, float pitch
, float yaw
, const float *covariance
, uint8_t reset_counter
)
208 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
209 char buf
[MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
];
210 _mav_put_uint64_t(buf
, 0, usec
);
211 _mav_put_float(buf
, 8, x
);
212 _mav_put_float(buf
, 12, y
);
213 _mav_put_float(buf
, 16, z
);
214 _mav_put_float(buf
, 20, roll
);
215 _mav_put_float(buf
, 24, pitch
);
216 _mav_put_float(buf
, 28, yaw
);
217 _mav_put_uint8_t(buf
, 116, reset_counter
);
218 _mav_put_float_array(buf
, 32, covariance
, 21);
219 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
, buf
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
221 mavlink_vision_position_estimate_t packet
;
227 packet
.pitch
= pitch
;
229 packet
.reset_counter
= reset_counter
;
230 mav_array_memcpy(packet
.covariance
, covariance
, sizeof(float)*21);
231 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
, (const char *)&packet
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
236 * @brief Send a vision_position_estimate message
237 * @param chan MAVLink channel to send the message
238 * @param struct The MAVLink struct to serialize
240 static inline void mavlink_msg_vision_position_estimate_send_struct(mavlink_channel_t chan
, const mavlink_vision_position_estimate_t
* vision_position_estimate
)
242 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
243 mavlink_msg_vision_position_estimate_send(chan
, vision_position_estimate
->usec
, vision_position_estimate
->x
, vision_position_estimate
->y
, vision_position_estimate
->z
, vision_position_estimate
->roll
, vision_position_estimate
->pitch
, vision_position_estimate
->yaw
, vision_position_estimate
->covariance
, vision_position_estimate
->reset_counter
);
245 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
, (const char *)vision_position_estimate
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
249 #if MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
251 This varient of _send() can be used to save stack space by re-using
252 memory from the receive buffer. The caller provides a
253 mavlink_message_t which is the size of a full mavlink message. This
254 is usually the receive buffer for the channel, and allows a reply to an
255 incoming message with minimum stack space usage.
257 static inline void mavlink_msg_vision_position_estimate_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint64_t usec
, float x
, float y
, float z
, float roll
, float pitch
, float yaw
, const float *covariance
, uint8_t reset_counter
)
259 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
260 char *buf
= (char *)msgbuf
;
261 _mav_put_uint64_t(buf
, 0, usec
);
262 _mav_put_float(buf
, 8, x
);
263 _mav_put_float(buf
, 12, y
);
264 _mav_put_float(buf
, 16, z
);
265 _mav_put_float(buf
, 20, roll
);
266 _mav_put_float(buf
, 24, pitch
);
267 _mav_put_float(buf
, 28, yaw
);
268 _mav_put_uint8_t(buf
, 116, reset_counter
);
269 _mav_put_float_array(buf
, 32, covariance
, 21);
270 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
, buf
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
272 mavlink_vision_position_estimate_t
*packet
= (mavlink_vision_position_estimate_t
*)msgbuf
;
278 packet
->pitch
= pitch
;
280 packet
->reset_counter
= reset_counter
;
281 mav_array_memcpy(packet
->covariance
, covariance
, sizeof(float)*21);
282 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
, (const char *)packet
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC
);
289 // MESSAGE VISION_POSITION_ESTIMATE UNPACKING
293 * @brief Get field usec from vision_position_estimate message
295 * @return [us] Timestamp (UNIX time or time since system boot)
297 static inline uint64_t mavlink_msg_vision_position_estimate_get_usec(const mavlink_message_t
* msg
)
299 return _MAV_RETURN_uint64_t(msg
, 0);
303 * @brief Get field x from vision_position_estimate message
305 * @return [m] Local X position
307 static inline float mavlink_msg_vision_position_estimate_get_x(const mavlink_message_t
* msg
)
309 return _MAV_RETURN_float(msg
, 8);
313 * @brief Get field y from vision_position_estimate message
315 * @return [m] Local Y position
317 static inline float mavlink_msg_vision_position_estimate_get_y(const mavlink_message_t
* msg
)
319 return _MAV_RETURN_float(msg
, 12);
323 * @brief Get field z from vision_position_estimate message
325 * @return [m] Local Z position
327 static inline float mavlink_msg_vision_position_estimate_get_z(const mavlink_message_t
* msg
)
329 return _MAV_RETURN_float(msg
, 16);
333 * @brief Get field roll from vision_position_estimate message
335 * @return [rad] Roll angle
337 static inline float mavlink_msg_vision_position_estimate_get_roll(const mavlink_message_t
* msg
)
339 return _MAV_RETURN_float(msg
, 20);
343 * @brief Get field pitch from vision_position_estimate message
345 * @return [rad] Pitch angle
347 static inline float mavlink_msg_vision_position_estimate_get_pitch(const mavlink_message_t
* msg
)
349 return _MAV_RETURN_float(msg
, 24);
353 * @brief Get field yaw from vision_position_estimate message
355 * @return [rad] Yaw angle
357 static inline float mavlink_msg_vision_position_estimate_get_yaw(const mavlink_message_t
* msg
)
359 return _MAV_RETURN_float(msg
, 28);
363 * @brief Get field covariance from vision_position_estimate message
365 * @return Row-major representation of 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.
367 static inline uint16_t mavlink_msg_vision_position_estimate_get_covariance(const mavlink_message_t
* msg
, float *covariance
)
369 return _MAV_RETURN_float_array(msg
, covariance
, 21, 32);
373 * @brief Get field reset_counter from vision_position_estimate message
375 * @return Estimate reset counter. This should be incremented when the estimate resets in any of the dimensions (position, velocity, attitude, angular speed). This is designed to be used when e.g an external SLAM system detects a loop-closure and the estimate jumps.
377 static inline uint8_t mavlink_msg_vision_position_estimate_get_reset_counter(const mavlink_message_t
* msg
)
379 return _MAV_RETURN_uint8_t(msg
, 116);
383 * @brief Decode a vision_position_estimate message into a struct
385 * @param msg The message to decode
386 * @param vision_position_estimate C-struct to decode the message contents into
388 static inline void mavlink_msg_vision_position_estimate_decode(const mavlink_message_t
* msg
, mavlink_vision_position_estimate_t
* vision_position_estimate
)
390 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
391 vision_position_estimate
->usec
= mavlink_msg_vision_position_estimate_get_usec(msg
);
392 vision_position_estimate
->x
= mavlink_msg_vision_position_estimate_get_x(msg
);
393 vision_position_estimate
->y
= mavlink_msg_vision_position_estimate_get_y(msg
);
394 vision_position_estimate
->z
= mavlink_msg_vision_position_estimate_get_z(msg
);
395 vision_position_estimate
->roll
= mavlink_msg_vision_position_estimate_get_roll(msg
);
396 vision_position_estimate
->pitch
= mavlink_msg_vision_position_estimate_get_pitch(msg
);
397 vision_position_estimate
->yaw
= mavlink_msg_vision_position_estimate_get_yaw(msg
);
398 mavlink_msg_vision_position_estimate_get_covariance(msg
, vision_position_estimate
->covariance
);
399 vision_position_estimate
->reset_counter
= mavlink_msg_vision_position_estimate_get_reset_counter(msg
);
401 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
? msg
->len
: MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
;
402 memset(vision_position_estimate
, 0, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN
);
403 memcpy(vision_position_estimate
, _MAV_PAYLOAD(msg
), len
);