Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_vision_position_estimate.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE VISION_POSITION_ESTIMATE PACKING
3
4#define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE 102
5
6
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;
18
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
23
24#define MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC 158
25#define MAVLINK_MSG_ID_102_CRC 158
26
27#define MAVLINK_MSG_VISION_POSITION_ESTIMATE_FIELD_COVARIANCE_LEN 21
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE {
31 102,
32 "VISION_POSITION_ESTIMATE",
33 9,
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) },
43 } \
44}
45#else
46#define MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE {
47 "VISION_POSITION_ESTIMATE",
48 9,
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) },
58 } \
59}
60#endif
61
62/**
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
67 *
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)
78 */
79static 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)
81{
82#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
94#else
95 mavlink_vision_position_estimate_t packet;
96 packet.usec = usec;
97 packet.x = x;
98 packet.y = y;
99 packet.z = z;
100 packet.roll = roll;
101 packet.pitch = pitch;
102 packet.yaw = yaw;
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);
106#endif
107
110}
111
112/**
113 * @brief Pack a vision_position_estimate message
114 * @param system_id ID of this system
115 * @param component_id ID of this component (e.g. 200 for IMU)
116 * @param status MAVLink status structure
117 * @param msg The MAVLink message to compress the data into
118 *
119 * @param usec [us] Timestamp (UNIX time or time since system boot)
120 * @param x [m] Local X position
121 * @param y [m] Local Y position
122 * @param z [m] Local Z position
123 * @param roll [rad] Roll angle
124 * @param pitch [rad] Pitch angle
125 * @param yaw [rad] Yaw angle
126 * @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.
127 * @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.
128 * @return length of the message in bytes (excluding serial stream start sign)
129 */
130static inline uint16_t mavlink_msg_vision_position_estimate_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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)
132{
133#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
145#else
146 mavlink_vision_position_estimate_t packet;
147 packet.usec = usec;
148 packet.x = x;
149 packet.y = y;
150 packet.z = z;
151 packet.roll = roll;
152 packet.pitch = pitch;
153 packet.yaw = yaw;
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);
157#endif
158
160#if MAVLINK_CRC_EXTRA
161 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_CRC);
162#else
163 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN);
164#endif
165}
166
167/**
168 * @brief Pack a vision_position_estimate message on a channel
169 * @param system_id ID of this system
170 * @param component_id ID of this component (e.g. 200 for IMU)
171 * @param chan The MAVLink channel this message will be sent over
172 * @param msg The MAVLink message to compress the data into
173 * @param usec [us] Timestamp (UNIX time or time since system boot)
174 * @param x [m] Local X position
175 * @param y [m] Local Y position
176 * @param z [m] Local Z position
177 * @param roll [rad] Roll angle
178 * @param pitch [rad] Pitch angle
179 * @param yaw [rad] Yaw angle
180 * @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.
181 * @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.
182 * @return length of the message in bytes (excluding serial stream start sign)
183 */
184static inline uint16_t mavlink_msg_vision_position_estimate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
185 mavlink_message_t* msg,
186 uint64_t usec,float x,float y,float z,float roll,float pitch,float yaw,const float *covariance,uint8_t reset_counter)
187{
188#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
190 _mav_put_uint64_t(buf, 0, usec);
191 _mav_put_float(buf, 8, x);
192 _mav_put_float(buf, 12, y);
193 _mav_put_float(buf, 16, z);
194 _mav_put_float(buf, 20, roll);
195 _mav_put_float(buf, 24, pitch);
196 _mav_put_float(buf, 28, yaw);
197 _mav_put_uint8_t(buf, 116, reset_counter);
198 _mav_put_float_array(buf, 32, covariance, 21);
199 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN);
200#else
201 mavlink_vision_position_estimate_t packet;
202 packet.usec = usec;
203 packet.x = x;
204 packet.y = y;
205 packet.z = z;
206 packet.roll = roll;
207 packet.pitch = pitch;
208 packet.yaw = yaw;
209 packet.reset_counter = reset_counter;
210 mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
211 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN);
212#endif
213
216}
217
218/**
219 * @brief Encode a vision_position_estimate struct
220 *
221 * @param system_id ID of this system
222 * @param component_id ID of this component (e.g. 200 for IMU)
223 * @param msg The MAVLink message to compress the data into
224 * @param vision_position_estimate C-struct to read the message contents from
225 */
226static 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)
227{
228 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);
229}
230
231/**
232 * @brief Encode a vision_position_estimate struct on a channel
233 *
234 * @param system_id ID of this system
235 * @param component_id ID of this component (e.g. 200 for IMU)
236 * @param chan The MAVLink channel this message will be sent over
237 * @param msg The MAVLink message to compress the data into
238 * @param vision_position_estimate C-struct to read the message contents from
239 */
240static 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)
241{
242 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);
243}
244
245/**
246 * @brief Encode a vision_position_estimate struct with provided status structure
247 *
248 * @param system_id ID of this system
249 * @param component_id ID of this component (e.g. 200 for IMU)
250 * @param status MAVLink status structure
251 * @param msg The MAVLink message to compress the data into
252 * @param vision_position_estimate C-struct to read the message contents from
253 */
254static inline uint16_t mavlink_msg_vision_position_estimate_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vision_position_estimate_t* vision_position_estimate)
255{
256 return mavlink_msg_vision_position_estimate_pack_status(system_id, component_id, _status, 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);
257}
258
259/**
260 * @brief Send a vision_position_estimate message
261 * @param chan MAVLink channel to send the message
262 *
263 * @param usec [us] Timestamp (UNIX time or time since system boot)
264 * @param x [m] Local X position
265 * @param y [m] Local Y position
266 * @param z [m] Local Z position
267 * @param roll [rad] Roll angle
268 * @param pitch [rad] Pitch angle
269 * @param yaw [rad] Yaw angle
270 * @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.
271 * @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.
272 */
273#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
274
275static 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)
276{
277#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 char buf[MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN];
279 _mav_put_uint64_t(buf, 0, usec);
280 _mav_put_float(buf, 8, x);
281 _mav_put_float(buf, 12, y);
282 _mav_put_float(buf, 16, z);
283 _mav_put_float(buf, 20, roll);
284 _mav_put_float(buf, 24, pitch);
285 _mav_put_float(buf, 28, yaw);
286 _mav_put_uint8_t(buf, 116, reset_counter);
287 _mav_put_float_array(buf, 32, covariance, 21);
288 _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);
289#else
290 mavlink_vision_position_estimate_t packet;
291 packet.usec = usec;
292 packet.x = x;
293 packet.y = y;
294 packet.z = z;
295 packet.roll = roll;
296 packet.pitch = pitch;
297 packet.yaw = yaw;
298 packet.reset_counter = reset_counter;
299 mav_array_memcpy(packet.covariance, covariance, sizeof(float)*21);
300 _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);
301#endif
302}
303
304/**
305 * @brief Send a vision_position_estimate message
306 * @param chan MAVLink channel to send the message
307 * @param struct The MAVLink struct to serialize
308 */
309static inline void mavlink_msg_vision_position_estimate_send_struct(mavlink_channel_t chan, const mavlink_vision_position_estimate_t* vision_position_estimate)
310{
311#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
312 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);
313#else
314 _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);
315#endif
316}
317
318#if MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
319/*
320 This variant of _send() can be used to save stack space by reusing
321 memory from the receive buffer. The caller provides a
322 mavlink_message_t which is the size of a full mavlink message. This
323 is usually the receive buffer for the channel, and allows a reply to an
324 incoming message with minimum stack space usage.
325 */
326static 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)
327{
328#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
329 char *buf = (char *)msgbuf;
330 _mav_put_uint64_t(buf, 0, usec);
331 _mav_put_float(buf, 8, x);
332 _mav_put_float(buf, 12, y);
333 _mav_put_float(buf, 16, z);
334 _mav_put_float(buf, 20, roll);
335 _mav_put_float(buf, 24, pitch);
336 _mav_put_float(buf, 28, yaw);
337 _mav_put_uint8_t(buf, 116, reset_counter);
338 _mav_put_float_array(buf, 32, covariance, 21);
339 _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);
340#else
341 mavlink_vision_position_estimate_t *packet = (mavlink_vision_position_estimate_t *)msgbuf;
342 packet->usec = usec;
343 packet->x = x;
344 packet->y = y;
345 packet->z = z;
346 packet->roll = roll;
347 packet->pitch = pitch;
348 packet->yaw = yaw;
349 packet->reset_counter = reset_counter;
350 mav_array_memcpy(packet->covariance, covariance, sizeof(float)*21);
351 _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);
352#endif
353}
354#endif
355
356#endif
357
358// MESSAGE VISION_POSITION_ESTIMATE UNPACKING
359
360
361/**
362 * @brief Get field usec from vision_position_estimate message
363 *
364 * @return [us] Timestamp (UNIX time or time since system boot)
365 */
366static inline uint64_t mavlink_msg_vision_position_estimate_get_usec(const mavlink_message_t* msg)
367{
368 return _MAV_RETURN_uint64_t(msg, 0);
369}
370
371/**
372 * @brief Get field x from vision_position_estimate message
373 *
374 * @return [m] Local X position
375 */
376static inline float mavlink_msg_vision_position_estimate_get_x(const mavlink_message_t* msg)
377{
378 return _MAV_RETURN_float(msg, 8);
379}
380
381/**
382 * @brief Get field y from vision_position_estimate message
383 *
384 * @return [m] Local Y position
385 */
386static inline float mavlink_msg_vision_position_estimate_get_y(const mavlink_message_t* msg)
387{
388 return _MAV_RETURN_float(msg, 12);
389}
390
391/**
392 * @brief Get field z from vision_position_estimate message
393 *
394 * @return [m] Local Z position
395 */
396static inline float mavlink_msg_vision_position_estimate_get_z(const mavlink_message_t* msg)
397{
398 return _MAV_RETURN_float(msg, 16);
399}
400
401/**
402 * @brief Get field roll from vision_position_estimate message
403 *
404 * @return [rad] Roll angle
405 */
406static inline float mavlink_msg_vision_position_estimate_get_roll(const mavlink_message_t* msg)
407{
408 return _MAV_RETURN_float(msg, 20);
409}
410
411/**
412 * @brief Get field pitch from vision_position_estimate message
413 *
414 * @return [rad] Pitch angle
415 */
416static inline float mavlink_msg_vision_position_estimate_get_pitch(const mavlink_message_t* msg)
417{
418 return _MAV_RETURN_float(msg, 24);
419}
420
421/**
422 * @brief Get field yaw from vision_position_estimate message
423 *
424 * @return [rad] Yaw angle
425 */
426static inline float mavlink_msg_vision_position_estimate_get_yaw(const mavlink_message_t* msg)
427{
428 return _MAV_RETURN_float(msg, 28);
429}
430
431/**
432 * @brief Get field covariance from vision_position_estimate message
433 *
434 * @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.
435 */
436static inline uint16_t mavlink_msg_vision_position_estimate_get_covariance(const mavlink_message_t* msg, float *covariance)
437{
438 return _MAV_RETURN_float_array(msg, covariance, 21, 32);
439}
440
441/**
442 * @brief Get field reset_counter from vision_position_estimate message
443 *
444 * @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.
445 */
446static inline uint8_t mavlink_msg_vision_position_estimate_get_reset_counter(const mavlink_message_t* msg)
447{
448 return _MAV_RETURN_uint8_t(msg, 116);
449}
450
451/**
452 * @brief Decode a vision_position_estimate message into a struct
453 *
454 * @param msg The message to decode
455 * @param vision_position_estimate C-struct to decode the message contents into
456 */
457static inline void mavlink_msg_vision_position_estimate_decode(const mavlink_message_t* msg, mavlink_vision_position_estimate_t* vision_position_estimate)
458{
459#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
460 vision_position_estimate->usec = mavlink_msg_vision_position_estimate_get_usec(msg);
461 vision_position_estimate->x = mavlink_msg_vision_position_estimate_get_x(msg);
462 vision_position_estimate->y = mavlink_msg_vision_position_estimate_get_y(msg);
463 vision_position_estimate->z = mavlink_msg_vision_position_estimate_get_z(msg);
464 vision_position_estimate->roll = mavlink_msg_vision_position_estimate_get_roll(msg);
465 vision_position_estimate->pitch = mavlink_msg_vision_position_estimate_get_pitch(msg);
466 vision_position_estimate->yaw = mavlink_msg_vision_position_estimate_get_yaw(msg);
467 mavlink_msg_vision_position_estimate_get_covariance(msg, vision_position_estimate->covariance);
468 vision_position_estimate->reset_counter = mavlink_msg_vision_position_estimate_get_reset_counter(msg);
469#else
470 uint8_t len = msg->len < MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN? msg->len : MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN;
471 memset(vision_position_estimate, 0, MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN);
472 memcpy(vision_position_estimate, _MAV_PAYLOAD(msg), len);
473#endif
474}