MAV'RIC
mavlink_msg_local_position_ned_cov.h
1 // MESSAGE LOCAL_POSITION_NED_COV PACKING
2 
3 #define MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV 64
4 
6 {
7  uint64_t time_utc;
8  uint32_t time_boot_ms;
9  float x;
10  float y;
11  float z;
12  float vx;
13  float vy;
14  float vz;
15  float covariance[36];
16  uint8_t estimator_type;
18 
19 #define MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN 181
20 #define MAVLINK_MSG_ID_64_LEN 181
21 
22 #define MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC 82
23 #define MAVLINK_MSG_ID_64_CRC 82
24 
25 #define MAVLINK_MSG_LOCAL_POSITION_NED_COV_FIELD_COVARIANCE_LEN 36
26 
27 #define MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_COV { \
28  "LOCAL_POSITION_NED_COV", \
29  10, \
30  { { "time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_local_position_ned_cov_t, time_utc) }, \
31  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_local_position_ned_cov_t, time_boot_ms) }, \
32  { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_local_position_ned_cov_t, x) }, \
33  { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_local_position_ned_cov_t, y) }, \
34  { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_local_position_ned_cov_t, z) }, \
35  { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_local_position_ned_cov_t, vx) }, \
36  { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_local_position_ned_cov_t, vy) }, \
37  { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_local_position_ned_cov_t, vz) }, \
38  { "covariance", NULL, MAVLINK_TYPE_FLOAT, 36, 36, offsetof(mavlink_local_position_ned_cov_t, covariance) }, \
39  { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 180, offsetof(mavlink_local_position_ned_cov_t, estimator_type) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_local_position_ned_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, float x, float y, float z, float vx, float vy, float vz, const float *covariance)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66  char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN];
67  _mav_put_uint64_t(buf, 0, time_utc);
68  _mav_put_uint32_t(buf, 8, time_boot_ms);
69  _mav_put_float(buf, 12, x);
70  _mav_put_float(buf, 16, y);
71  _mav_put_float(buf, 20, z);
72  _mav_put_float(buf, 24, vx);
73  _mav_put_float(buf, 28, vy);
74  _mav_put_float(buf, 32, vz);
75  _mav_put_uint8_t(buf, 180, estimator_type);
76  _mav_put_float_array(buf, 36, covariance, 36);
77  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
78 #else
80  packet.time_utc = time_utc;
81  packet.time_boot_ms = time_boot_ms;
82  packet.x = x;
83  packet.y = y;
84  packet.z = z;
85  packet.vx = vx;
86  packet.vy = vy;
87  packet.vz = vz;
88  packet.estimator_type = estimator_type;
89  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
90  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
91 #endif
92 
93  msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV;
94 #if MAVLINK_CRC_EXTRA
95  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
96 #else
97  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
98 #endif
99 }
100 
119 static inline uint16_t mavlink_msg_local_position_ned_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
120  mavlink_message_t* msg,
121  uint32_t time_boot_ms,uint64_t time_utc,uint8_t estimator_type,float x,float y,float z,float vx,float vy,float vz,const float *covariance)
122 {
123 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
124  char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN];
125  _mav_put_uint64_t(buf, 0, time_utc);
126  _mav_put_uint32_t(buf, 8, time_boot_ms);
127  _mav_put_float(buf, 12, x);
128  _mav_put_float(buf, 16, y);
129  _mav_put_float(buf, 20, z);
130  _mav_put_float(buf, 24, vx);
131  _mav_put_float(buf, 28, vy);
132  _mav_put_float(buf, 32, vz);
133  _mav_put_uint8_t(buf, 180, estimator_type);
134  _mav_put_float_array(buf, 36, covariance, 36);
135  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
136 #else
138  packet.time_utc = time_utc;
139  packet.time_boot_ms = time_boot_ms;
140  packet.x = x;
141  packet.y = y;
142  packet.z = z;
143  packet.vx = vx;
144  packet.vy = vy;
145  packet.vz = vz;
146  packet.estimator_type = estimator_type;
147  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
148  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
149 #endif
150 
151  msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV;
152 #if MAVLINK_CRC_EXTRA
153  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
154 #else
155  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
156 #endif
157 }
158 
167 static inline uint16_t mavlink_msg_local_position_ned_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_ned_cov_t* local_position_ned_cov)
168 {
169  return mavlink_msg_local_position_ned_cov_pack(system_id, component_id, msg, local_position_ned_cov->time_boot_ms, local_position_ned_cov->time_utc, local_position_ned_cov->estimator_type, local_position_ned_cov->x, local_position_ned_cov->y, local_position_ned_cov->z, local_position_ned_cov->vx, local_position_ned_cov->vy, local_position_ned_cov->vz, local_position_ned_cov->covariance);
170 }
171 
181 static inline uint16_t mavlink_msg_local_position_ned_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_local_position_ned_cov_t* local_position_ned_cov)
182 {
183  return mavlink_msg_local_position_ned_cov_pack_chan(system_id, component_id, chan, msg, local_position_ned_cov->time_boot_ms, local_position_ned_cov->time_utc, local_position_ned_cov->estimator_type, local_position_ned_cov->x, local_position_ned_cov->y, local_position_ned_cov->z, local_position_ned_cov->vx, local_position_ned_cov->vy, local_position_ned_cov->vz, local_position_ned_cov->covariance);
184 }
185 
201 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
202 
203 static inline void mavlink_msg_local_position_ned_cov_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, float x, float y, float z, float vx, float vy, float vz, const float *covariance)
204 {
205 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206  char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN];
207  _mav_put_uint64_t(buf, 0, time_utc);
208  _mav_put_uint32_t(buf, 8, time_boot_ms);
209  _mav_put_float(buf, 12, x);
210  _mav_put_float(buf, 16, y);
211  _mav_put_float(buf, 20, z);
212  _mav_put_float(buf, 24, vx);
213  _mav_put_float(buf, 28, vy);
214  _mav_put_float(buf, 32, vz);
215  _mav_put_uint8_t(buf, 180, estimator_type);
216  _mav_put_float_array(buf, 36, covariance, 36);
217 #if MAVLINK_CRC_EXTRA
218  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
219 #else
220  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
221 #endif
222 #else
224  packet.time_utc = time_utc;
225  packet.time_boot_ms = time_boot_ms;
226  packet.x = x;
227  packet.y = y;
228  packet.z = z;
229  packet.vx = vx;
230  packet.vy = vy;
231  packet.vz = vz;
232  packet.estimator_type = estimator_type;
233  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
234 #if MAVLINK_CRC_EXTRA
235  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)&packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
236 #else
237  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)&packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
238 #endif
239 #endif
240 }
241 
242 #if MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
243 /*
244  This varient of _send() can be used to save stack space by re-using
245  memory from the receive buffer. The caller provides a
246  mavlink_message_t which is the size of a full mavlink message. This
247  is usually the receive buffer for the channel, and allows a reply to an
248  incoming message with minimum stack space usage.
249  */
250 static inline void mavlink_msg_local_position_ned_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, float x, float y, float z, float vx, float vy, float vz, const float *covariance)
251 {
252 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253  char *buf = (char *)msgbuf;
254  _mav_put_uint64_t(buf, 0, time_utc);
255  _mav_put_uint32_t(buf, 8, time_boot_ms);
256  _mav_put_float(buf, 12, x);
257  _mav_put_float(buf, 16, y);
258  _mav_put_float(buf, 20, z);
259  _mav_put_float(buf, 24, vx);
260  _mav_put_float(buf, 28, vy);
261  _mav_put_float(buf, 32, vz);
262  _mav_put_uint8_t(buf, 180, estimator_type);
263  _mav_put_float_array(buf, 36, covariance, 36);
264 #if MAVLINK_CRC_EXTRA
265  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
266 #else
267  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
268 #endif
269 #else
271  packet->time_utc = time_utc;
272  packet->time_boot_ms = time_boot_ms;
273  packet->x = x;
274  packet->y = y;
275  packet->z = z;
276  packet->vx = vx;
277  packet->vy = vy;
278  packet->vz = vz;
279  packet->estimator_type = estimator_type;
280  mav_array_memcpy(packet->covariance, covariance, sizeof(float)*36);
281 #if MAVLINK_CRC_EXTRA
282  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_CRC);
283 #else
284  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV, (const char *)packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
285 #endif
286 #endif
287 }
288 #endif
289 
290 #endif
291 
292 // MESSAGE LOCAL_POSITION_NED_COV UNPACKING
293 
294 
300 static inline uint32_t mavlink_msg_local_position_ned_cov_get_time_boot_ms(const mavlink_message_t* msg)
301 {
302  return _MAV_RETURN_uint32_t(msg, 8);
303 }
304 
310 static inline uint64_t mavlink_msg_local_position_ned_cov_get_time_utc(const mavlink_message_t* msg)
311 {
312  return _MAV_RETURN_uint64_t(msg, 0);
313 }
314 
320 static inline uint8_t mavlink_msg_local_position_ned_cov_get_estimator_type(const mavlink_message_t* msg)
321 {
322  return _MAV_RETURN_uint8_t(msg, 180);
323 }
324 
330 static inline float mavlink_msg_local_position_ned_cov_get_x(const mavlink_message_t* msg)
331 {
332  return _MAV_RETURN_float(msg, 12);
333 }
334 
340 static inline float mavlink_msg_local_position_ned_cov_get_y(const mavlink_message_t* msg)
341 {
342  return _MAV_RETURN_float(msg, 16);
343 }
344 
350 static inline float mavlink_msg_local_position_ned_cov_get_z(const mavlink_message_t* msg)
351 {
352  return _MAV_RETURN_float(msg, 20);
353 }
354 
360 static inline float mavlink_msg_local_position_ned_cov_get_vx(const mavlink_message_t* msg)
361 {
362  return _MAV_RETURN_float(msg, 24);
363 }
364 
370 static inline float mavlink_msg_local_position_ned_cov_get_vy(const mavlink_message_t* msg)
371 {
372  return _MAV_RETURN_float(msg, 28);
373 }
374 
380 static inline float mavlink_msg_local_position_ned_cov_get_vz(const mavlink_message_t* msg)
381 {
382  return _MAV_RETURN_float(msg, 32);
383 }
384 
390 static inline uint16_t mavlink_msg_local_position_ned_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
391 {
392  return _MAV_RETURN_float_array(msg, covariance, 36, 36);
393 }
394 
401 static inline void mavlink_msg_local_position_ned_cov_decode(const mavlink_message_t* msg, mavlink_local_position_ned_cov_t* local_position_ned_cov)
402 {
403 #if MAVLINK_NEED_BYTE_SWAP
404  local_position_ned_cov->time_utc = mavlink_msg_local_position_ned_cov_get_time_utc(msg);
405  local_position_ned_cov->time_boot_ms = mavlink_msg_local_position_ned_cov_get_time_boot_ms(msg);
406  local_position_ned_cov->x = mavlink_msg_local_position_ned_cov_get_x(msg);
407  local_position_ned_cov->y = mavlink_msg_local_position_ned_cov_get_y(msg);
408  local_position_ned_cov->z = mavlink_msg_local_position_ned_cov_get_z(msg);
409  local_position_ned_cov->vx = mavlink_msg_local_position_ned_cov_get_vx(msg);
410  local_position_ned_cov->vy = mavlink_msg_local_position_ned_cov_get_vy(msg);
411  local_position_ned_cov->vz = mavlink_msg_local_position_ned_cov_get_vz(msg);
412  mavlink_msg_local_position_ned_cov_get_covariance(msg, local_position_ned_cov->covariance);
413  local_position_ned_cov->estimator_type = mavlink_msg_local_position_ned_cov_get_estimator_type(msg);
414 #else
415  memcpy(local_position_ned_cov, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_LEN);
416 #endif
417 }