mavlink_msg_gps2_rtk.h
Go to the documentation of this file.
1 // MESSAGE GPS2_RTK PACKING
2 
3 #define MAVLINK_MSG_ID_GPS2_RTK 128
4 
5 typedef struct __mavlink_gps2_rtk_t
6 {
7  uint32_t time_last_baseline_ms; /*< Time since boot of last baseline message received in ms.*/
8  uint32_t tow; /*< GPS Time of Week of last baseline*/
9  int32_t baseline_a_mm; /*< Current baseline in ECEF x or NED north component in mm.*/
10  int32_t baseline_b_mm; /*< Current baseline in ECEF y or NED east component in mm.*/
11  int32_t baseline_c_mm; /*< Current baseline in ECEF z or NED down component in mm.*/
12  uint32_t accuracy; /*< Current estimate of baseline accuracy.*/
13  int32_t iar_num_hypotheses; /*< Current number of integer ambiguity hypotheses.*/
14  uint16_t wn; /*< GPS Week Number of last baseline*/
15  uint8_t rtk_receiver_id; /*< Identification of connected RTK receiver.*/
16  uint8_t rtk_health; /*< GPS-specific health report for RTK data.*/
17  uint8_t rtk_rate; /*< Rate of baseline messages being received by GPS, in HZ*/
18  uint8_t nsats; /*< Current number of sats used for RTK calculation.*/
19  uint8_t baseline_coords_type; /*< Coordinate system of baseline. 0 == ECEF, 1 == NED*/
21 
22 #define MAVLINK_MSG_ID_GPS2_RTK_LEN 35
23 #define MAVLINK_MSG_ID_128_LEN 35
24 
25 #define MAVLINK_MSG_ID_GPS2_RTK_CRC 226
26 #define MAVLINK_MSG_ID_128_CRC 226
27 
28 
29 
30 #define MAVLINK_MESSAGE_INFO_GPS2_RTK { \
31  "GPS2_RTK", \
32  13, \
33  { { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps2_rtk_t, time_last_baseline_ms) }, \
34  { "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps2_rtk_t, tow) }, \
35  { "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_rtk_t, baseline_a_mm) }, \
36  { "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_rtk_t, baseline_b_mm) }, \
37  { "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_rtk_t, baseline_c_mm) }, \
38  { "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_rtk_t, accuracy) }, \
39  { "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps2_rtk_t, iar_num_hypotheses) }, \
40  { "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_rtk_t, wn) }, \
41  { "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps2_rtk_t, rtk_receiver_id) }, \
42  { "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps2_rtk_t, rtk_health) }, \
43  { "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_rtk_t, rtk_rate) }, \
44  { "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_rtk_t, nsats) }, \
45  { "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_rtk_t, baseline_coords_type) }, \
46  } \
47 }
48 
49 
71 static inline uint16_t mavlink_msg_gps2_rtk_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72  uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
73 {
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76  _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
77  _mav_put_uint32_t(buf, 4, tow);
78  _mav_put_int32_t(buf, 8, baseline_a_mm);
79  _mav_put_int32_t(buf, 12, baseline_b_mm);
80  _mav_put_int32_t(buf, 16, baseline_c_mm);
81  _mav_put_uint32_t(buf, 20, accuracy);
82  _mav_put_int32_t(buf, 24, iar_num_hypotheses);
83  _mav_put_uint16_t(buf, 28, wn);
84  _mav_put_uint8_t(buf, 30, rtk_receiver_id);
85  _mav_put_uint8_t(buf, 31, rtk_health);
86  _mav_put_uint8_t(buf, 32, rtk_rate);
87  _mav_put_uint8_t(buf, 33, nsats);
88  _mav_put_uint8_t(buf, 34, baseline_coords_type);
89 
91 #else
92  mavlink_gps2_rtk_t packet;
94  packet.tow = tow;
98  packet.accuracy = accuracy;
100  packet.wn = wn;
102  packet.rtk_health = rtk_health;
103  packet.rtk_rate = rtk_rate;
104  packet.nsats = nsats;
106 
108 #endif
109 
110  msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
111 #if MAVLINK_CRC_EXTRA
113 #else
114  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RTK_LEN);
115 #endif
116 }
117 
139 static inline uint16_t mavlink_msg_gps2_rtk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
140  mavlink_message_t* msg,
141  uint32_t time_last_baseline_ms,uint8_t rtk_receiver_id,uint16_t wn,uint32_t tow,uint8_t rtk_health,uint8_t rtk_rate,uint8_t nsats,uint8_t baseline_coords_type,int32_t baseline_a_mm,int32_t baseline_b_mm,int32_t baseline_c_mm,uint32_t accuracy,int32_t iar_num_hypotheses)
142 {
143 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
144  char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
145  _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
146  _mav_put_uint32_t(buf, 4, tow);
147  _mav_put_int32_t(buf, 8, baseline_a_mm);
148  _mav_put_int32_t(buf, 12, baseline_b_mm);
149  _mav_put_int32_t(buf, 16, baseline_c_mm);
150  _mav_put_uint32_t(buf, 20, accuracy);
151  _mav_put_int32_t(buf, 24, iar_num_hypotheses);
152  _mav_put_uint16_t(buf, 28, wn);
153  _mav_put_uint8_t(buf, 30, rtk_receiver_id);
154  _mav_put_uint8_t(buf, 31, rtk_health);
155  _mav_put_uint8_t(buf, 32, rtk_rate);
156  _mav_put_uint8_t(buf, 33, nsats);
157  _mav_put_uint8_t(buf, 34, baseline_coords_type);
158 
160 #else
161  mavlink_gps2_rtk_t packet;
163  packet.tow = tow;
164  packet.baseline_a_mm = baseline_a_mm;
165  packet.baseline_b_mm = baseline_b_mm;
166  packet.baseline_c_mm = baseline_c_mm;
167  packet.accuracy = accuracy;
169  packet.wn = wn;
171  packet.rtk_health = rtk_health;
172  packet.rtk_rate = rtk_rate;
173  packet.nsats = nsats;
175 
177 #endif
178 
179  msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
180 #if MAVLINK_CRC_EXTRA
182 #else
183  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RTK_LEN);
184 #endif
185 }
186 
195 static inline uint16_t mavlink_msg_gps2_rtk_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk)
196 {
197  return mavlink_msg_gps2_rtk_pack(system_id, component_id, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses);
198 }
199 
209 static inline uint16_t mavlink_msg_gps2_rtk_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk)
210 {
211  return mavlink_msg_gps2_rtk_pack_chan(system_id, component_id, chan, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses);
212 }
213 
232 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
233 
234 static inline void mavlink_msg_gps2_rtk_send(mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237  char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
239  _mav_put_uint32_t(buf, 4, tow);
243  _mav_put_uint32_t(buf, 20, accuracy);
244  _mav_put_int32_t(buf, 24, iar_num_hypotheses);
245  _mav_put_uint16_t(buf, 28, wn);
247  _mav_put_uint8_t(buf, 31, rtk_health);
248  _mav_put_uint8_t(buf, 32, rtk_rate);
249  _mav_put_uint8_t(buf, 33, nsats);
251 
252 #if MAVLINK_CRC_EXTRA
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
256 #endif
257 #else
258  mavlink_gps2_rtk_t packet;
260  packet.tow = tow;
261  packet.baseline_a_mm = baseline_a_mm;
262  packet.baseline_b_mm = baseline_b_mm;
263  packet.baseline_c_mm = baseline_c_mm;
264  packet.accuracy = accuracy;
266  packet.wn = wn;
268  packet.rtk_health = rtk_health;
269  packet.rtk_rate = rtk_rate;
270  packet.nsats = nsats;
272 
273 #if MAVLINK_CRC_EXTRA
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
275 #else
276  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
277 #endif
278 #endif
279 }
280 
281 #if MAVLINK_MSG_ID_GPS2_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
282 /*
283  This varient of _send() can be used to save stack space by re-using
284  memory from the receive buffer. The caller provides a
285  mavlink_message_t which is the size of a full mavlink message. This
286  is usually the receive buffer for the channel, and allows a reply to an
287  incoming message with minimum stack space usage.
288  */
289 static inline void mavlink_msg_gps2_rtk_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
290 {
291 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292  char *buf = (char *)msgbuf;
294  _mav_put_uint32_t(buf, 4, tow);
298  _mav_put_uint32_t(buf, 20, accuracy);
299  _mav_put_int32_t(buf, 24, iar_num_hypotheses);
300  _mav_put_uint16_t(buf, 28, wn);
302  _mav_put_uint8_t(buf, 31, rtk_health);
303  _mav_put_uint8_t(buf, 32, rtk_rate);
304  _mav_put_uint8_t(buf, 33, nsats);
306 
307 #if MAVLINK_CRC_EXTRA
308  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
309 #else
310  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
311 #endif
312 #else
313  mavlink_gps2_rtk_t *packet = (mavlink_gps2_rtk_t *)msgbuf;
315  packet->tow = tow;
316  packet->baseline_a_mm = baseline_a_mm;
317  packet->baseline_b_mm = baseline_b_mm;
318  packet->baseline_c_mm = baseline_c_mm;
319  packet->accuracy = accuracy;
321  packet->wn = wn;
323  packet->rtk_health = rtk_health;
324  packet->rtk_rate = rtk_rate;
325  packet->nsats = nsats;
327 
328 #if MAVLINK_CRC_EXTRA
329  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
330 #else
331  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
332 #endif
333 #endif
334 }
335 #endif
336 
337 #endif
338 
339 // MESSAGE GPS2_RTK UNPACKING
340 
341 
347 static inline uint32_t mavlink_msg_gps2_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_uint32_t(msg, 0);
350 }
351 
357 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_uint8_t(msg, 30);
360 }
361 
367 static inline uint16_t mavlink_msg_gps2_rtk_get_wn(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_uint16_t(msg, 28);
370 }
371 
377 static inline uint32_t mavlink_msg_gps2_rtk_get_tow(const mavlink_message_t* msg)
378 {
379  return _MAV_RETURN_uint32_t(msg, 4);
380 }
381 
387 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_health(const mavlink_message_t* msg)
388 {
389  return _MAV_RETURN_uint8_t(msg, 31);
390 }
391 
397 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_rate(const mavlink_message_t* msg)
398 {
399  return _MAV_RETURN_uint8_t(msg, 32);
400 }
401 
407 static inline uint8_t mavlink_msg_gps2_rtk_get_nsats(const mavlink_message_t* msg)
408 {
409  return _MAV_RETURN_uint8_t(msg, 33);
410 }
411 
417 static inline uint8_t mavlink_msg_gps2_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_uint8_t(msg, 34);
420 }
421 
427 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
428 {
429  return _MAV_RETURN_int32_t(msg, 8);
430 }
431 
437 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
438 {
439  return _MAV_RETURN_int32_t(msg, 12);
440 }
441 
447 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
448 {
449  return _MAV_RETURN_int32_t(msg, 16);
450 }
451 
457 static inline uint32_t mavlink_msg_gps2_rtk_get_accuracy(const mavlink_message_t* msg)
458 {
459  return _MAV_RETURN_uint32_t(msg, 20);
460 }
461 
467 static inline int32_t mavlink_msg_gps2_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
468 {
469  return _MAV_RETURN_int32_t(msg, 24);
470 }
471 
478 static inline void mavlink_msg_gps2_rtk_decode(const mavlink_message_t* msg, mavlink_gps2_rtk_t* gps2_rtk)
479 {
480 #if MAVLINK_NEED_BYTE_SWAP
482  gps2_rtk->tow = mavlink_msg_gps2_rtk_get_tow(msg);
488  gps2_rtk->wn = mavlink_msg_gps2_rtk_get_wn(msg);
492  gps2_rtk->nsats = mavlink_msg_gps2_rtk_get_nsats(msg);
494 #else
495  memcpy(gps2_rtk, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS2_RTK_LEN);
496 #endif
497 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46