Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_gps2_rtk.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GPS2_RTK PACKING
3
4#define MAVLINK_MSG_ID_GPS2_RTK 128
5
6
7typedef struct __mavlink_gps2_rtk_t {
8 uint32_t time_last_baseline_ms; /*< [ms] Time since boot of last baseline message received.*/
9 uint32_t tow; /*< [ms] GPS Time of Week of last baseline*/
10 int32_t baseline_a_mm; /*< [mm] Current baseline in ECEF x or NED north component.*/
11 int32_t baseline_b_mm; /*< [mm] Current baseline in ECEF y or NED east component.*/
12 int32_t baseline_c_mm; /*< [mm] Current baseline in ECEF z or NED down component.*/
13 uint32_t accuracy; /*< Current estimate of baseline accuracy.*/
14 int32_t iar_num_hypotheses; /*< Current number of integer ambiguity hypotheses.*/
15 uint16_t wn; /*< GPS Week Number of last baseline*/
16 uint8_t rtk_receiver_id; /*< Identification of connected RTK receiver.*/
17 uint8_t rtk_health; /*< GPS-specific health report for RTK data.*/
18 uint8_t rtk_rate; /*< [Hz] Rate of baseline messages being received by GPS*/
19 uint8_t nsats; /*< Current number of sats used for RTK calculation.*/
20 uint8_t baseline_coords_type; /*< Coordinate system of baseline*/
21} mavlink_gps2_rtk_t;
22
23#define MAVLINK_MSG_ID_GPS2_RTK_LEN 35
24#define MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN 35
25#define MAVLINK_MSG_ID_128_LEN 35
26#define MAVLINK_MSG_ID_128_MIN_LEN 35
27
28#define MAVLINK_MSG_ID_GPS2_RTK_CRC 226
29#define MAVLINK_MSG_ID_128_CRC 226
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_GPS2_RTK {
35 128,
36 "GPS2_RTK",
37 13,
38 { { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps2_rtk_t, time_last_baseline_ms) },
39 { "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps2_rtk_t, rtk_receiver_id) },
40 { "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_rtk_t, wn) },
41 { "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps2_rtk_t, tow) },
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 { "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_rtk_t, baseline_a_mm) },
47 { "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_rtk_t, baseline_b_mm) },
48 { "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_rtk_t, baseline_c_mm) },
49 { "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_rtk_t, accuracy) },
50 { "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps2_rtk_t, iar_num_hypotheses) },
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_GPS2_RTK {
55 "GPS2_RTK",
56 13,
57 { { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps2_rtk_t, time_last_baseline_ms) },
58 { "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps2_rtk_t, rtk_receiver_id) },
59 { "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_rtk_t, wn) },
60 { "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps2_rtk_t, tow) },
61 { "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps2_rtk_t, rtk_health) },
62 { "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_rtk_t, rtk_rate) },
63 { "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_rtk_t, nsats) },
64 { "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_rtk_t, baseline_coords_type) },
65 { "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_rtk_t, baseline_a_mm) },
66 { "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_rtk_t, baseline_b_mm) },
67 { "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_rtk_t, baseline_c_mm) },
68 { "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_rtk_t, accuracy) },
69 { "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps2_rtk_t, iar_num_hypotheses) },
70 } \
71}
72#endif
73
74/**
75 * @brief Pack a gps2_rtk message
76 * @param system_id ID of this system
77 * @param component_id ID of this component (e.g. 200 for IMU)
78 * @param msg The MAVLink message to compress the data into
79 *
80 * @param time_last_baseline_ms [ms] Time since boot of last baseline message received.
81 * @param rtk_receiver_id Identification of connected RTK receiver.
82 * @param wn GPS Week Number of last baseline
83 * @param tow [ms] GPS Time of Week of last baseline
84 * @param rtk_health GPS-specific health report for RTK data.
85 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
86 * @param nsats Current number of sats used for RTK calculation.
87 * @param baseline_coords_type Coordinate system of baseline
88 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
89 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
90 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
91 * @param accuracy Current estimate of baseline accuracy.
92 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_gps2_rtk_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 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)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
101 _mav_put_uint32_t(buf, 4, tow);
102 _mav_put_int32_t(buf, 8, baseline_a_mm);
103 _mav_put_int32_t(buf, 12, baseline_b_mm);
104 _mav_put_int32_t(buf, 16, baseline_c_mm);
105 _mav_put_uint32_t(buf, 20, accuracy);
106 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
107 _mav_put_uint16_t(buf, 28, wn);
108 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
109 _mav_put_uint8_t(buf, 31, rtk_health);
110 _mav_put_uint8_t(buf, 32, rtk_rate);
111 _mav_put_uint8_t(buf, 33, nsats);
112 _mav_put_uint8_t(buf, 34, baseline_coords_type);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
115#else
116 mavlink_gps2_rtk_t packet;
117 packet.time_last_baseline_ms = time_last_baseline_ms;
118 packet.tow = tow;
119 packet.baseline_a_mm = baseline_a_mm;
120 packet.baseline_b_mm = baseline_b_mm;
121 packet.baseline_c_mm = baseline_c_mm;
122 packet.accuracy = accuracy;
123 packet.iar_num_hypotheses = iar_num_hypotheses;
124 packet.wn = wn;
125 packet.rtk_receiver_id = rtk_receiver_id;
126 packet.rtk_health = rtk_health;
127 packet.rtk_rate = rtk_rate;
128 packet.nsats = nsats;
129 packet.baseline_coords_type = baseline_coords_type;
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
132#endif
133
134 msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
135 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
136}
137
138/**
139 * @brief Pack a gps2_rtk message
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param status MAVLink status structure
143 * @param msg The MAVLink message to compress the data into
144 *
145 * @param time_last_baseline_ms [ms] Time since boot of last baseline message received.
146 * @param rtk_receiver_id Identification of connected RTK receiver.
147 * @param wn GPS Week Number of last baseline
148 * @param tow [ms] GPS Time of Week of last baseline
149 * @param rtk_health GPS-specific health report for RTK data.
150 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
151 * @param nsats Current number of sats used for RTK calculation.
152 * @param baseline_coords_type Coordinate system of baseline
153 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
154 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
155 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
156 * @param accuracy Current estimate of baseline accuracy.
157 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
158 * @return length of the message in bytes (excluding serial stream start sign)
159 */
160static inline uint16_t mavlink_msg_gps2_rtk_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
161 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)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
166 _mav_put_uint32_t(buf, 4, tow);
167 _mav_put_int32_t(buf, 8, baseline_a_mm);
168 _mav_put_int32_t(buf, 12, baseline_b_mm);
169 _mav_put_int32_t(buf, 16, baseline_c_mm);
170 _mav_put_uint32_t(buf, 20, accuracy);
171 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
172 _mav_put_uint16_t(buf, 28, wn);
173 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
174 _mav_put_uint8_t(buf, 31, rtk_health);
175 _mav_put_uint8_t(buf, 32, rtk_rate);
176 _mav_put_uint8_t(buf, 33, nsats);
177 _mav_put_uint8_t(buf, 34, baseline_coords_type);
178
179 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
180#else
181 mavlink_gps2_rtk_t packet;
182 packet.time_last_baseline_ms = time_last_baseline_ms;
183 packet.tow = tow;
184 packet.baseline_a_mm = baseline_a_mm;
185 packet.baseline_b_mm = baseline_b_mm;
186 packet.baseline_c_mm = baseline_c_mm;
187 packet.accuracy = accuracy;
188 packet.iar_num_hypotheses = iar_num_hypotheses;
189 packet.wn = wn;
190 packet.rtk_receiver_id = rtk_receiver_id;
191 packet.rtk_health = rtk_health;
192 packet.rtk_rate = rtk_rate;
193 packet.nsats = nsats;
194 packet.baseline_coords_type = baseline_coords_type;
195
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
197#endif
198
199 msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
200#if MAVLINK_CRC_EXTRA
201 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
202#else
203 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN);
204#endif
205}
206
207/**
208 * @brief Pack a gps2_rtk message on a channel
209 * @param system_id ID of this system
210 * @param component_id ID of this component (e.g. 200 for IMU)
211 * @param chan The MAVLink channel this message will be sent over
212 * @param msg The MAVLink message to compress the data into
213 * @param time_last_baseline_ms [ms] Time since boot of last baseline message received.
214 * @param rtk_receiver_id Identification of connected RTK receiver.
215 * @param wn GPS Week Number of last baseline
216 * @param tow [ms] GPS Time of Week of last baseline
217 * @param rtk_health GPS-specific health report for RTK data.
218 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
219 * @param nsats Current number of sats used for RTK calculation.
220 * @param baseline_coords_type Coordinate system of baseline
221 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
222 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
223 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
224 * @param accuracy Current estimate of baseline accuracy.
225 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
226 * @return length of the message in bytes (excluding serial stream start sign)
227 */
228static inline uint16_t mavlink_msg_gps2_rtk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
229 mavlink_message_t* msg,
230 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)
231{
232#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
234 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
235 _mav_put_uint32_t(buf, 4, tow);
236 _mav_put_int32_t(buf, 8, baseline_a_mm);
237 _mav_put_int32_t(buf, 12, baseline_b_mm);
238 _mav_put_int32_t(buf, 16, baseline_c_mm);
239 _mav_put_uint32_t(buf, 20, accuracy);
240 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
241 _mav_put_uint16_t(buf, 28, wn);
242 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
243 _mav_put_uint8_t(buf, 31, rtk_health);
244 _mav_put_uint8_t(buf, 32, rtk_rate);
245 _mav_put_uint8_t(buf, 33, nsats);
246 _mav_put_uint8_t(buf, 34, baseline_coords_type);
247
248 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
249#else
250 mavlink_gps2_rtk_t packet;
251 packet.time_last_baseline_ms = time_last_baseline_ms;
252 packet.tow = tow;
253 packet.baseline_a_mm = baseline_a_mm;
254 packet.baseline_b_mm = baseline_b_mm;
255 packet.baseline_c_mm = baseline_c_mm;
256 packet.accuracy = accuracy;
257 packet.iar_num_hypotheses = iar_num_hypotheses;
258 packet.wn = wn;
259 packet.rtk_receiver_id = rtk_receiver_id;
260 packet.rtk_health = rtk_health;
261 packet.rtk_rate = rtk_rate;
262 packet.nsats = nsats;
263 packet.baseline_coords_type = baseline_coords_type;
264
265 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
266#endif
267
268 msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
269 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
270}
271
272/**
273 * @brief Encode a gps2_rtk struct
274 *
275 * @param system_id ID of this system
276 * @param component_id ID of this component (e.g. 200 for IMU)
277 * @param msg The MAVLink message to compress the data into
278 * @param gps2_rtk C-struct to read the message contents from
279 */
280static 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)
281{
282 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);
283}
284
285/**
286 * @brief Encode a gps2_rtk struct on a channel
287 *
288 * @param system_id ID of this system
289 * @param component_id ID of this component (e.g. 200 for IMU)
290 * @param chan The MAVLink channel this message will be sent over
291 * @param msg The MAVLink message to compress the data into
292 * @param gps2_rtk C-struct to read the message contents from
293 */
294static 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)
295{
296 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);
297}
298
299/**
300 * @brief Encode a gps2_rtk struct with provided status structure
301 *
302 * @param system_id ID of this system
303 * @param component_id ID of this component (e.g. 200 for IMU)
304 * @param status MAVLink status structure
305 * @param msg The MAVLink message to compress the data into
306 * @param gps2_rtk C-struct to read the message contents from
307 */
308static inline uint16_t mavlink_msg_gps2_rtk_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk)
309{
310 return mavlink_msg_gps2_rtk_pack_status(system_id, component_id, _status, 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);
311}
312
313/**
314 * @brief Send a gps2_rtk message
315 * @param chan MAVLink channel to send the message
316 *
317 * @param time_last_baseline_ms [ms] Time since boot of last baseline message received.
318 * @param rtk_receiver_id Identification of connected RTK receiver.
319 * @param wn GPS Week Number of last baseline
320 * @param tow [ms] GPS Time of Week of last baseline
321 * @param rtk_health GPS-specific health report for RTK data.
322 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
323 * @param nsats Current number of sats used for RTK calculation.
324 * @param baseline_coords_type Coordinate system of baseline
325 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
326 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
327 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
328 * @param accuracy Current estimate of baseline accuracy.
329 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
330 */
331#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
332
333static 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)
334{
335#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
336 char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
337 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
338 _mav_put_uint32_t(buf, 4, tow);
339 _mav_put_int32_t(buf, 8, baseline_a_mm);
340 _mav_put_int32_t(buf, 12, baseline_b_mm);
341 _mav_put_int32_t(buf, 16, baseline_c_mm);
342 _mav_put_uint32_t(buf, 20, accuracy);
343 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
344 _mav_put_uint16_t(buf, 28, wn);
345 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
346 _mav_put_uint8_t(buf, 31, rtk_health);
347 _mav_put_uint8_t(buf, 32, rtk_rate);
348 _mav_put_uint8_t(buf, 33, nsats);
349 _mav_put_uint8_t(buf, 34, baseline_coords_type);
350
351 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
352#else
353 mavlink_gps2_rtk_t packet;
354 packet.time_last_baseline_ms = time_last_baseline_ms;
355 packet.tow = tow;
356 packet.baseline_a_mm = baseline_a_mm;
357 packet.baseline_b_mm = baseline_b_mm;
358 packet.baseline_c_mm = baseline_c_mm;
359 packet.accuracy = accuracy;
360 packet.iar_num_hypotheses = iar_num_hypotheses;
361 packet.wn = wn;
362 packet.rtk_receiver_id = rtk_receiver_id;
363 packet.rtk_health = rtk_health;
364 packet.rtk_rate = rtk_rate;
365 packet.nsats = nsats;
366 packet.baseline_coords_type = baseline_coords_type;
367
368 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
369#endif
370}
371
372/**
373 * @brief Send a gps2_rtk message
374 * @param chan MAVLink channel to send the message
375 * @param struct The MAVLink struct to serialize
376 */
377static inline void mavlink_msg_gps2_rtk_send_struct(mavlink_channel_t chan, const mavlink_gps2_rtk_t* gps2_rtk)
378{
379#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
380 mavlink_msg_gps2_rtk_send(chan, 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);
381#else
382 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)gps2_rtk, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
383#endif
384}
385
386#if MAVLINK_MSG_ID_GPS2_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
387/*
388 This variant of _send() can be used to save stack space by reusing
389 memory from the receive buffer. The caller provides a
390 mavlink_message_t which is the size of a full mavlink message. This
391 is usually the receive buffer for the channel, and allows a reply to an
392 incoming message with minimum stack space usage.
393 */
394static 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)
395{
396#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
397 char *buf = (char *)msgbuf;
398 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
399 _mav_put_uint32_t(buf, 4, tow);
400 _mav_put_int32_t(buf, 8, baseline_a_mm);
401 _mav_put_int32_t(buf, 12, baseline_b_mm);
402 _mav_put_int32_t(buf, 16, baseline_c_mm);
403 _mav_put_uint32_t(buf, 20, accuracy);
404 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
405 _mav_put_uint16_t(buf, 28, wn);
406 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
407 _mav_put_uint8_t(buf, 31, rtk_health);
408 _mav_put_uint8_t(buf, 32, rtk_rate);
409 _mav_put_uint8_t(buf, 33, nsats);
410 _mav_put_uint8_t(buf, 34, baseline_coords_type);
411
412 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
413#else
414 mavlink_gps2_rtk_t *packet = (mavlink_gps2_rtk_t *)msgbuf;
415 packet->time_last_baseline_ms = time_last_baseline_ms;
416 packet->tow = tow;
417 packet->baseline_a_mm = baseline_a_mm;
418 packet->baseline_b_mm = baseline_b_mm;
419 packet->baseline_c_mm = baseline_c_mm;
420 packet->accuracy = accuracy;
421 packet->iar_num_hypotheses = iar_num_hypotheses;
422 packet->wn = wn;
423 packet->rtk_receiver_id = rtk_receiver_id;
424 packet->rtk_health = rtk_health;
425 packet->rtk_rate = rtk_rate;
426 packet->nsats = nsats;
427 packet->baseline_coords_type = baseline_coords_type;
428
429 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
430#endif
431}
432#endif
433
434#endif
435
436// MESSAGE GPS2_RTK UNPACKING
437
438
439/**
440 * @brief Get field time_last_baseline_ms from gps2_rtk message
441 *
442 * @return [ms] Time since boot of last baseline message received.
443 */
444static inline uint32_t mavlink_msg_gps2_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_uint32_t(msg, 0);
447}
448
449/**
450 * @brief Get field rtk_receiver_id from gps2_rtk message
451 *
452 * @return Identification of connected RTK receiver.
453 */
454static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
455{
456 return _MAV_RETURN_uint8_t(msg, 30);
457}
458
459/**
460 * @brief Get field wn from gps2_rtk message
461 *
462 * @return GPS Week Number of last baseline
463 */
464static inline uint16_t mavlink_msg_gps2_rtk_get_wn(const mavlink_message_t* msg)
465{
466 return _MAV_RETURN_uint16_t(msg, 28);
467}
468
469/**
470 * @brief Get field tow from gps2_rtk message
471 *
472 * @return [ms] GPS Time of Week of last baseline
473 */
474static inline uint32_t mavlink_msg_gps2_rtk_get_tow(const mavlink_message_t* msg)
475{
476 return _MAV_RETURN_uint32_t(msg, 4);
477}
478
479/**
480 * @brief Get field rtk_health from gps2_rtk message
481 *
482 * @return GPS-specific health report for RTK data.
483 */
484static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_health(const mavlink_message_t* msg)
485{
486 return _MAV_RETURN_uint8_t(msg, 31);
487}
488
489/**
490 * @brief Get field rtk_rate from gps2_rtk message
491 *
492 * @return [Hz] Rate of baseline messages being received by GPS
493 */
494static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_rate(const mavlink_message_t* msg)
495{
496 return _MAV_RETURN_uint8_t(msg, 32);
497}
498
499/**
500 * @brief Get field nsats from gps2_rtk message
501 *
502 * @return Current number of sats used for RTK calculation.
503 */
504static inline uint8_t mavlink_msg_gps2_rtk_get_nsats(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_uint8_t(msg, 33);
507}
508
509/**
510 * @brief Get field baseline_coords_type from gps2_rtk message
511 *
512 * @return Coordinate system of baseline
513 */
514static inline uint8_t mavlink_msg_gps2_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
515{
516 return _MAV_RETURN_uint8_t(msg, 34);
517}
518
519/**
520 * @brief Get field baseline_a_mm from gps2_rtk message
521 *
522 * @return [mm] Current baseline in ECEF x or NED north component.
523 */
524static inline int32_t mavlink_msg_gps2_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
525{
526 return _MAV_RETURN_int32_t(msg, 8);
527}
528
529/**
530 * @brief Get field baseline_b_mm from gps2_rtk message
531 *
532 * @return [mm] Current baseline in ECEF y or NED east component.
533 */
534static inline int32_t mavlink_msg_gps2_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
535{
536 return _MAV_RETURN_int32_t(msg, 12);
537}
538
539/**
540 * @brief Get field baseline_c_mm from gps2_rtk message
541 *
542 * @return [mm] Current baseline in ECEF z or NED down component.
543 */
544static inline int32_t mavlink_msg_gps2_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
545{
546 return _MAV_RETURN_int32_t(msg, 16);
547}
548
549/**
550 * @brief Get field accuracy from gps2_rtk message
551 *
552 * @return Current estimate of baseline accuracy.
553 */
554static inline uint32_t mavlink_msg_gps2_rtk_get_accuracy(const mavlink_message_t* msg)
555{
556 return _MAV_RETURN_uint32_t(msg, 20);
557}
558
559/**
560 * @brief Get field iar_num_hypotheses from gps2_rtk message
561 *
562 * @return Current number of integer ambiguity hypotheses.
563 */
564static inline int32_t mavlink_msg_gps2_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
565{
566 return _MAV_RETURN_int32_t(msg, 24);
567}
568
569/**
570 * @brief Decode a gps2_rtk message into a struct
571 *
572 * @param msg The message to decode
573 * @param gps2_rtk C-struct to decode the message contents into
574 */
575static inline void mavlink_msg_gps2_rtk_decode(const mavlink_message_t* msg, mavlink_gps2_rtk_t* gps2_rtk)
576{
577#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
578 gps2_rtk->time_last_baseline_ms = mavlink_msg_gps2_rtk_get_time_last_baseline_ms(msg);
579 gps2_rtk->tow = mavlink_msg_gps2_rtk_get_tow(msg);
580 gps2_rtk->baseline_a_mm = mavlink_msg_gps2_rtk_get_baseline_a_mm(msg);
581 gps2_rtk->baseline_b_mm = mavlink_msg_gps2_rtk_get_baseline_b_mm(msg);
582 gps2_rtk->baseline_c_mm = mavlink_msg_gps2_rtk_get_baseline_c_mm(msg);
583 gps2_rtk->accuracy = mavlink_msg_gps2_rtk_get_accuracy(msg);
584 gps2_rtk->iar_num_hypotheses = mavlink_msg_gps2_rtk_get_iar_num_hypotheses(msg);
585 gps2_rtk->wn = mavlink_msg_gps2_rtk_get_wn(msg);
586 gps2_rtk->rtk_receiver_id = mavlink_msg_gps2_rtk_get_rtk_receiver_id(msg);
587 gps2_rtk->rtk_health = mavlink_msg_gps2_rtk_get_rtk_health(msg);
588 gps2_rtk->rtk_rate = mavlink_msg_gps2_rtk_get_rtk_rate(msg);
589 gps2_rtk->nsats = mavlink_msg_gps2_rtk_get_nsats(msg);
590 gps2_rtk->baseline_coords_type = mavlink_msg_gps2_rtk_get_baseline_coords_type(msg);
591#else
592 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS2_RTK_LEN? msg->len : MAVLINK_MSG_ID_GPS2_RTK_LEN;
593 memset(gps2_rtk, 0, MAVLINK_MSG_ID_GPS2_RTK_LEN);
594 memcpy(gps2_rtk, _MAV_PAYLOAD(msg), len);
595#endif
596}