NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_global_position_int_cov.h
Go to the documentation of this file.
1 // MESSAGE GLOBAL_POSITION_INT_COV PACKING
2 
3 #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV 63
4 
6 {
7  uint64_t time_utc;
8  uint32_t time_boot_ms;
9  int32_t lat;
10  int32_t lon;
11  int32_t alt;
12  int32_t relative_alt;
13  float vx;
14  float vy;
15  float vz;
16  float covariance[36];
17  uint8_t estimator_type;
19 
20 #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN 185
21 #define MAVLINK_MSG_ID_63_LEN 185
22 
23 #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC 51
24 #define MAVLINK_MSG_ID_63_CRC 51
25 
26 #define MAVLINK_MSG_GLOBAL_POSITION_INT_COV_FIELD_COVARIANCE_LEN 36
27 
28 #define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV { \
29  "GLOBAL_POSITION_INT_COV", \
30  11, \
31  { { "time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_int_cov_t, time_utc) }, \
32  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_global_position_int_cov_t, time_boot_ms) }, \
33  { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_cov_t, lat) }, \
34  { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_cov_t, lon) }, \
35  { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_global_position_int_cov_t, alt) }, \
36  { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_global_position_int_cov_t, relative_alt) }, \
37  { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_int_cov_t, vx) }, \
38  { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_int_cov_t, vy) }, \
39  { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_global_position_int_cov_t, vz) }, \
40  { "covariance", NULL, MAVLINK_TYPE_FLOAT, 36, 40, offsetof(mavlink_global_position_int_cov_t, covariance) }, \
41  { "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 184, offsetof(mavlink_global_position_int_cov_t, estimator_type) }, \
42  } \
43 }
44 
45 
65 static inline uint16_t mavlink_msg_global_position_int_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66  uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
67 {
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70  _mav_put_uint64_t(buf, 0, time_utc);
71  _mav_put_uint32_t(buf, 8, time_boot_ms);
72  _mav_put_int32_t(buf, 12, lat);
73  _mav_put_int32_t(buf, 16, lon);
74  _mav_put_int32_t(buf, 20, alt);
75  _mav_put_int32_t(buf, 24, relative_alt);
76  _mav_put_float(buf, 28, vx);
77  _mav_put_float(buf, 32, vy);
78  _mav_put_float(buf, 36, vz);
79  _mav_put_uint8_t(buf, 184, estimator_type);
80  _mav_put_float_array(buf, 40, covariance, 36);
82 #else
84  packet.time_utc = time_utc;
85  packet.time_boot_ms = time_boot_ms;
86  packet.lat = lat;
87  packet.lon = lon;
88  packet.alt = alt;
89  packet.relative_alt = relative_alt;
90  packet.vx = vx;
91  packet.vy = vy;
92  packet.vz = vz;
93  packet.estimator_type = estimator_type;
94  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
96 #endif
97 
99 #if MAVLINK_CRC_EXTRA
101 #else
102  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
103 #endif
104 }
105 
125 static inline uint16_t mavlink_msg_global_position_int_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
126  mavlink_message_t* msg,
127  uint32_t time_boot_ms,uint64_t time_utc,uint8_t estimator_type,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,float vx,float vy,float vz,const float *covariance)
128 {
129 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
131  _mav_put_uint64_t(buf, 0, time_utc);
132  _mav_put_uint32_t(buf, 8, time_boot_ms);
133  _mav_put_int32_t(buf, 12, lat);
134  _mav_put_int32_t(buf, 16, lon);
135  _mav_put_int32_t(buf, 20, alt);
136  _mav_put_int32_t(buf, 24, relative_alt);
137  _mav_put_float(buf, 28, vx);
138  _mav_put_float(buf, 32, vy);
139  _mav_put_float(buf, 36, vz);
140  _mav_put_uint8_t(buf, 184, estimator_type);
141  _mav_put_float_array(buf, 40, covariance, 36);
143 #else
145  packet.time_utc = time_utc;
146  packet.time_boot_ms = time_boot_ms;
147  packet.lat = lat;
148  packet.lon = lon;
149  packet.alt = alt;
150  packet.relative_alt = relative_alt;
151  packet.vx = vx;
152  packet.vy = vy;
153  packet.vz = vz;
154  packet.estimator_type = estimator_type;
155  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
157 #endif
158 
160 #if MAVLINK_CRC_EXTRA
162 #else
163  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
164 #endif
165 }
166 
175 static inline uint16_t mavlink_msg_global_position_int_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
176 {
177  return mavlink_msg_global_position_int_cov_pack(system_id, component_id, msg, global_position_int_cov->time_boot_ms, global_position_int_cov->time_utc, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
178 }
179 
189 static inline uint16_t mavlink_msg_global_position_int_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
190 {
191  return mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, chan, msg, global_position_int_cov->time_boot_ms, global_position_int_cov->time_utc, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
192 }
193 
210 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
211 
212 static inline void mavlink_msg_global_position_int_cov_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
213 {
214 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
216  _mav_put_uint64_t(buf, 0, time_utc);
217  _mav_put_uint32_t(buf, 8, time_boot_ms);
218  _mav_put_int32_t(buf, 12, lat);
219  _mav_put_int32_t(buf, 16, lon);
220  _mav_put_int32_t(buf, 20, alt);
221  _mav_put_int32_t(buf, 24, relative_alt);
222  _mav_put_float(buf, 28, vx);
223  _mav_put_float(buf, 32, vy);
224  _mav_put_float(buf, 36, vz);
225  _mav_put_uint8_t(buf, 184, estimator_type);
226  _mav_put_float_array(buf, 40, covariance, 36);
227 #if MAVLINK_CRC_EXTRA
229 #else
230  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
231 #endif
232 #else
234  packet.time_utc = time_utc;
235  packet.time_boot_ms = time_boot_ms;
236  packet.lat = lat;
237  packet.lon = lon;
238  packet.alt = alt;
239  packet.relative_alt = relative_alt;
240  packet.vx = vx;
241  packet.vy = vy;
242  packet.vz = vz;
243  packet.estimator_type = estimator_type;
244  mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
245 #if MAVLINK_CRC_EXTRA
247 #else
248  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
249 #endif
250 #endif
251 }
252 
253 #if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
254 /*
255  This varient of _send() can be used to save stack space by re-using
256  memory from the receive buffer. The caller provides a
257  mavlink_message_t which is the size of a full mavlink message. This
258  is usually the receive buffer for the channel, and allows a reply to an
259  incoming message with minimum stack space usage.
260  */
261 static inline void mavlink_msg_global_position_int_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
262 {
263 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
264  char *buf = (char *)msgbuf;
265  _mav_put_uint64_t(buf, 0, time_utc);
266  _mav_put_uint32_t(buf, 8, time_boot_ms);
267  _mav_put_int32_t(buf, 12, lat);
268  _mav_put_int32_t(buf, 16, lon);
269  _mav_put_int32_t(buf, 20, alt);
270  _mav_put_int32_t(buf, 24, relative_alt);
271  _mav_put_float(buf, 28, vx);
272  _mav_put_float(buf, 32, vy);
273  _mav_put_float(buf, 36, vz);
274  _mav_put_uint8_t(buf, 184, estimator_type);
275  _mav_put_float_array(buf, 40, covariance, 36);
276 #if MAVLINK_CRC_EXTRA
278 #else
279  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
280 #endif
281 #else
283  packet->time_utc = time_utc;
284  packet->time_boot_ms = time_boot_ms;
285  packet->lat = lat;
286  packet->lon = lon;
287  packet->alt = alt;
288  packet->relative_alt = relative_alt;
289  packet->vx = vx;
290  packet->vy = vy;
291  packet->vz = vz;
292  packet->estimator_type = estimator_type;
293  mav_array_memcpy(packet->covariance, covariance, sizeof(float)*36);
294 #if MAVLINK_CRC_EXTRA
296 #else
297  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
298 #endif
299 #endif
300 }
301 #endif
302 
303 #endif
304 
305 // MESSAGE GLOBAL_POSITION_INT_COV UNPACKING
306 
307 
313 static inline uint32_t mavlink_msg_global_position_int_cov_get_time_boot_ms(const mavlink_message_t* msg)
314 {
315  return _MAV_RETURN_uint32_t(msg, 8);
316 }
317 
323 static inline uint64_t mavlink_msg_global_position_int_cov_get_time_utc(const mavlink_message_t* msg)
324 {
325  return _MAV_RETURN_uint64_t(msg, 0);
326 }
327 
333 static inline uint8_t mavlink_msg_global_position_int_cov_get_estimator_type(const mavlink_message_t* msg)
334 {
335  return _MAV_RETURN_uint8_t(msg, 184);
336 }
337 
343 static inline int32_t mavlink_msg_global_position_int_cov_get_lat(const mavlink_message_t* msg)
344 {
345  return _MAV_RETURN_int32_t(msg, 12);
346 }
347 
353 static inline int32_t mavlink_msg_global_position_int_cov_get_lon(const mavlink_message_t* msg)
354 {
355  return _MAV_RETURN_int32_t(msg, 16);
356 }
357 
363 static inline int32_t mavlink_msg_global_position_int_cov_get_alt(const mavlink_message_t* msg)
364 {
365  return _MAV_RETURN_int32_t(msg, 20);
366 }
367 
373 static inline int32_t mavlink_msg_global_position_int_cov_get_relative_alt(const mavlink_message_t* msg)
374 {
375  return _MAV_RETURN_int32_t(msg, 24);
376 }
377 
383 static inline float mavlink_msg_global_position_int_cov_get_vx(const mavlink_message_t* msg)
384 {
385  return _MAV_RETURN_float(msg, 28);
386 }
387 
393 static inline float mavlink_msg_global_position_int_cov_get_vy(const mavlink_message_t* msg)
394 {
395  return _MAV_RETURN_float(msg, 32);
396 }
397 
403 static inline float mavlink_msg_global_position_int_cov_get_vz(const mavlink_message_t* msg)
404 {
405  return _MAV_RETURN_float(msg, 36);
406 }
407 
413 static inline uint16_t mavlink_msg_global_position_int_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
414 {
415  return _MAV_RETURN_float_array(msg, covariance, 36, 40);
416 }
417 
424 static inline void mavlink_msg_global_position_int_cov_decode(const mavlink_message_t* msg, mavlink_global_position_int_cov_t* global_position_int_cov)
425 {
426 #if MAVLINK_NEED_BYTE_SWAP
427  global_position_int_cov->time_utc = mavlink_msg_global_position_int_cov_get_time_utc(msg);
428  global_position_int_cov->time_boot_ms = mavlink_msg_global_position_int_cov_get_time_boot_ms(msg);
429  global_position_int_cov->lat = mavlink_msg_global_position_int_cov_get_lat(msg);
430  global_position_int_cov->lon = mavlink_msg_global_position_int_cov_get_lon(msg);
431  global_position_int_cov->alt = mavlink_msg_global_position_int_cov_get_alt(msg);
432  global_position_int_cov->relative_alt = mavlink_msg_global_position_int_cov_get_relative_alt(msg);
433  global_position_int_cov->vx = mavlink_msg_global_position_int_cov_get_vx(msg);
434  global_position_int_cov->vy = mavlink_msg_global_position_int_cov_get_vy(msg);
435  global_position_int_cov->vz = mavlink_msg_global_position_int_cov_get_vz(msg);
436  mavlink_msg_global_position_int_cov_get_covariance(msg, global_position_int_cov->covariance);
437  global_position_int_cov->estimator_type = mavlink_msg_global_position_int_cov_get_estimator_type(msg);
438 #else
439  memcpy(global_position_int_cov, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
440 #endif
441 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_uint64_t(buf, wire_offset, b)
Definition: protocol.h:143
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:142
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141