RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_gps_rtk.h
1#pragma once
2// MESSAGE GPS_RTK PACKING
3
4#define MAVLINK_MSG_ID_GPS_RTK 127
5
6MAVPACKED(
7typedef struct __mavlink_gps_rtk_t {
8 uint32_t time_last_baseline_ms; /*< Time since boot of last baseline message received in ms.*/
9 uint32_t tow; /*< GPS Time of Week of last baseline*/
10 int32_t baseline_a_mm; /*< Current baseline in ECEF x or NED north component in mm.*/
11 int32_t baseline_b_mm; /*< Current baseline in ECEF y or NED east component in mm.*/
12 int32_t baseline_c_mm; /*< Current baseline in ECEF z or NED down component in mm.*/
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; /*< Rate of baseline messages being received by GPS, in HZ*/
19 uint8_t nsats; /*< Current number of sats used for RTK calculation.*/
20 uint8_t baseline_coords_type; /*< Coordinate system of baseline. 0 == ECEF, 1 == NED*/
21}) mavlink_gps_rtk_t;
22
23#define MAVLINK_MSG_ID_GPS_RTK_LEN 35
24#define MAVLINK_MSG_ID_GPS_RTK_MIN_LEN 35
25#define MAVLINK_MSG_ID_127_LEN 35
26#define MAVLINK_MSG_ID_127_MIN_LEN 35
27
28#define MAVLINK_MSG_ID_GPS_RTK_CRC 25
29#define MAVLINK_MSG_ID_127_CRC 25
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_GPS_RTK { \
35 127, \
36 "GPS_RTK", \
37 13, \
38 { { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps_rtk_t, time_last_baseline_ms) }, \
39 { "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps_rtk_t, rtk_receiver_id) }, \
40 { "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps_rtk_t, wn) }, \
41 { "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps_rtk_t, tow) }, \
42 { "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps_rtk_t, rtk_health) }, \
43 { "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps_rtk_t, rtk_rate) }, \
44 { "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps_rtk_t, nsats) }, \
45 { "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps_rtk_t, baseline_coords_type) }, \
46 { "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_rtk_t, baseline_a_mm) }, \
47 { "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_rtk_t, baseline_b_mm) }, \
48 { "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_rtk_t, baseline_c_mm) }, \
49 { "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps_rtk_t, accuracy) }, \
50 { "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps_rtk_t, iar_num_hypotheses) }, \
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_GPS_RTK { \
55 "GPS_RTK", \
56 13, \
57 { { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps_rtk_t, time_last_baseline_ms) }, \
58 { "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps_rtk_t, rtk_receiver_id) }, \
59 { "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps_rtk_t, wn) }, \
60 { "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps_rtk_t, tow) }, \
61 { "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps_rtk_t, rtk_health) }, \
62 { "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps_rtk_t, rtk_rate) }, \
63 { "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps_rtk_t, nsats) }, \
64 { "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps_rtk_t, baseline_coords_type) }, \
65 { "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_rtk_t, baseline_a_mm) }, \
66 { "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_rtk_t, baseline_b_mm) }, \
67 { "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_rtk_t, baseline_c_mm) }, \
68 { "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps_rtk_t, accuracy) }, \
69 { "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps_rtk_t, iar_num_hypotheses) }, \
70 } \
71}
72#endif
73
74/**
75 * @brief Pack a gps_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 Time since boot of last baseline message received in ms.
81 * @param rtk_receiver_id Identification of connected RTK receiver.
82 * @param wn GPS Week Number of last baseline
83 * @param tow GPS Time of Week of last baseline
84 * @param rtk_health GPS-specific health report for RTK data.
85 * @param rtk_rate Rate of baseline messages being received by GPS, in HZ
86 * @param nsats Current number of sats used for RTK calculation.
87 * @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
88 * @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
89 * @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
90 * @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
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_gps_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
99 char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
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_GPS_RTK_LEN);
115#else
116 mavlink_gps_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_GPS_RTK_LEN);
132#endif
133
134 msg->msgid = MAVLINK_MSG_ID_GPS_RTK;
135 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
136}
137
138/**
139 * @brief Pack a gps_rtk message on a channel
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param chan The MAVLink channel this message will be sent over
143 * @param msg The MAVLink message to compress the data into
144 * @param time_last_baseline_ms Time since boot of last baseline message received in ms.
145 * @param rtk_receiver_id Identification of connected RTK receiver.
146 * @param wn GPS Week Number of last baseline
147 * @param tow GPS Time of Week of last baseline
148 * @param rtk_health GPS-specific health report for RTK data.
149 * @param rtk_rate Rate of baseline messages being received by GPS, in HZ
150 * @param nsats Current number of sats used for RTK calculation.
151 * @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
152 * @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
153 * @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
154 * @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
155 * @param accuracy Current estimate of baseline accuracy.
156 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
157 * @return length of the message in bytes (excluding serial stream start sign)
158 */
159static inline uint16_t mavlink_msg_gps_rtk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
160 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
164 char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
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_GPS_RTK_LEN);
180#else
181 mavlink_gps_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_GPS_RTK_LEN);
197#endif
198
199 msg->msgid = MAVLINK_MSG_ID_GPS_RTK;
200 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
201}
202
203/**
204 * @brief Encode a gps_rtk struct
205 *
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param msg The MAVLink message to compress the data into
209 * @param gps_rtk C-struct to read the message contents from
210 */
211static inline uint16_t mavlink_msg_gps_rtk_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_rtk_t* gps_rtk)
212{
213 return mavlink_msg_gps_rtk_pack(system_id, component_id, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses);
214}
215
216/**
217 * @brief Encode a gps_rtk struct on a channel
218 *
219 * @param system_id ID of this system
220 * @param component_id ID of this component (e.g. 200 for IMU)
221 * @param chan The MAVLink channel this message will be sent over
222 * @param msg The MAVLink message to compress the data into
223 * @param gps_rtk C-struct to read the message contents from
224 */
225static inline uint16_t mavlink_msg_gps_rtk_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_rtk_t* gps_rtk)
226{
227 return mavlink_msg_gps_rtk_pack_chan(system_id, component_id, chan, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses);
228}
229
230/**
231 * @brief Send a gps_rtk message
232 * @param chan MAVLink channel to send the message
233 *
234 * @param time_last_baseline_ms Time since boot of last baseline message received in ms.
235 * @param rtk_receiver_id Identification of connected RTK receiver.
236 * @param wn GPS Week Number of last baseline
237 * @param tow GPS Time of Week of last baseline
238 * @param rtk_health GPS-specific health report for RTK data.
239 * @param rtk_rate Rate of baseline messages being received by GPS, in HZ
240 * @param nsats Current number of sats used for RTK calculation.
241 * @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
242 * @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
243 * @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
244 * @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
245 * @param accuracy Current estimate of baseline accuracy.
246 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
247 */
248#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
249
250static inline void mavlink_msg_gps_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)
251{
252#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253 char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
254 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
255 _mav_put_uint32_t(buf, 4, tow);
256 _mav_put_int32_t(buf, 8, baseline_a_mm);
257 _mav_put_int32_t(buf, 12, baseline_b_mm);
258 _mav_put_int32_t(buf, 16, baseline_c_mm);
259 _mav_put_uint32_t(buf, 20, accuracy);
260 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
261 _mav_put_uint16_t(buf, 28, wn);
262 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
263 _mav_put_uint8_t(buf, 31, rtk_health);
264 _mav_put_uint8_t(buf, 32, rtk_rate);
265 _mav_put_uint8_t(buf, 33, nsats);
266 _mav_put_uint8_t(buf, 34, baseline_coords_type);
267
268 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
269#else
270 mavlink_gps_rtk_t packet;
271 packet.time_last_baseline_ms = time_last_baseline_ms;
272 packet.tow = tow;
273 packet.baseline_a_mm = baseline_a_mm;
274 packet.baseline_b_mm = baseline_b_mm;
275 packet.baseline_c_mm = baseline_c_mm;
276 packet.accuracy = accuracy;
277 packet.iar_num_hypotheses = iar_num_hypotheses;
278 packet.wn = wn;
279 packet.rtk_receiver_id = rtk_receiver_id;
280 packet.rtk_health = rtk_health;
281 packet.rtk_rate = rtk_rate;
282 packet.nsats = nsats;
283 packet.baseline_coords_type = baseline_coords_type;
284
285 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
286#endif
287}
288
289/**
290 * @brief Send a gps_rtk message
291 * @param chan MAVLink channel to send the message
292 * @param struct The MAVLink struct to serialize
293 */
294static inline void mavlink_msg_gps_rtk_send_struct(mavlink_channel_t chan, const mavlink_gps_rtk_t* gps_rtk)
295{
296#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
297 mavlink_msg_gps_rtk_send(chan, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses);
298#else
299 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)gps_rtk, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
300#endif
301}
302
303#if MAVLINK_MSG_ID_GPS_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
304/*
305 This varient of _send() can be used to save stack space by re-using
306 memory from the receive buffer. The caller provides a
307 mavlink_message_t which is the size of a full mavlink message. This
308 is usually the receive buffer for the channel, and allows a reply to an
309 incoming message with minimum stack space usage.
310 */
311static inline void mavlink_msg_gps_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)
312{
313#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
314 char *buf = (char *)msgbuf;
315 _mav_put_uint32_t(buf, 0, time_last_baseline_ms);
316 _mav_put_uint32_t(buf, 4, tow);
317 _mav_put_int32_t(buf, 8, baseline_a_mm);
318 _mav_put_int32_t(buf, 12, baseline_b_mm);
319 _mav_put_int32_t(buf, 16, baseline_c_mm);
320 _mav_put_uint32_t(buf, 20, accuracy);
321 _mav_put_int32_t(buf, 24, iar_num_hypotheses);
322 _mav_put_uint16_t(buf, 28, wn);
323 _mav_put_uint8_t(buf, 30, rtk_receiver_id);
324 _mav_put_uint8_t(buf, 31, rtk_health);
325 _mav_put_uint8_t(buf, 32, rtk_rate);
326 _mav_put_uint8_t(buf, 33, nsats);
327 _mav_put_uint8_t(buf, 34, baseline_coords_type);
328
329 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
330#else
331 mavlink_gps_rtk_t *packet = (mavlink_gps_rtk_t *)msgbuf;
332 packet->time_last_baseline_ms = time_last_baseline_ms;
333 packet->tow = tow;
334 packet->baseline_a_mm = baseline_a_mm;
335 packet->baseline_b_mm = baseline_b_mm;
336 packet->baseline_c_mm = baseline_c_mm;
337 packet->accuracy = accuracy;
338 packet->iar_num_hypotheses = iar_num_hypotheses;
339 packet->wn = wn;
340 packet->rtk_receiver_id = rtk_receiver_id;
341 packet->rtk_health = rtk_health;
342 packet->rtk_rate = rtk_rate;
343 packet->nsats = nsats;
344 packet->baseline_coords_type = baseline_coords_type;
345
346 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS_RTK_MIN_LEN, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
347#endif
348}
349#endif
350
351#endif
352
353// MESSAGE GPS_RTK UNPACKING
354
355
356/**
357 * @brief Get field time_last_baseline_ms from gps_rtk message
358 *
359 * @return Time since boot of last baseline message received in ms.
360 */
361static inline uint32_t mavlink_msg_gps_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
362{
363 return _MAV_RETURN_uint32_t(msg, 0);
364}
365
366/**
367 * @brief Get field rtk_receiver_id from gps_rtk message
368 *
369 * @return Identification of connected RTK receiver.
370 */
371static inline uint8_t mavlink_msg_gps_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
372{
373 return _MAV_RETURN_uint8_t(msg, 30);
374}
375
376/**
377 * @brief Get field wn from gps_rtk message
378 *
379 * @return GPS Week Number of last baseline
380 */
381static inline uint16_t mavlink_msg_gps_rtk_get_wn(const mavlink_message_t* msg)
382{
383 return _MAV_RETURN_uint16_t(msg, 28);
384}
385
386/**
387 * @brief Get field tow from gps_rtk message
388 *
389 * @return GPS Time of Week of last baseline
390 */
391static inline uint32_t mavlink_msg_gps_rtk_get_tow(const mavlink_message_t* msg)
392{
393 return _MAV_RETURN_uint32_t(msg, 4);
394}
395
396/**
397 * @brief Get field rtk_health from gps_rtk message
398 *
399 * @return GPS-specific health report for RTK data.
400 */
401static inline uint8_t mavlink_msg_gps_rtk_get_rtk_health(const mavlink_message_t* msg)
402{
403 return _MAV_RETURN_uint8_t(msg, 31);
404}
405
406/**
407 * @brief Get field rtk_rate from gps_rtk message
408 *
409 * @return Rate of baseline messages being received by GPS, in HZ
410 */
411static inline uint8_t mavlink_msg_gps_rtk_get_rtk_rate(const mavlink_message_t* msg)
412{
413 return _MAV_RETURN_uint8_t(msg, 32);
414}
415
416/**
417 * @brief Get field nsats from gps_rtk message
418 *
419 * @return Current number of sats used for RTK calculation.
420 */
421static inline uint8_t mavlink_msg_gps_rtk_get_nsats(const mavlink_message_t* msg)
422{
423 return _MAV_RETURN_uint8_t(msg, 33);
424}
425
426/**
427 * @brief Get field baseline_coords_type from gps_rtk message
428 *
429 * @return Coordinate system of baseline. 0 == ECEF, 1 == NED
430 */
431static inline uint8_t mavlink_msg_gps_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
432{
433 return _MAV_RETURN_uint8_t(msg, 34);
434}
435
436/**
437 * @brief Get field baseline_a_mm from gps_rtk message
438 *
439 * @return Current baseline in ECEF x or NED north component in mm.
440 */
441static inline int32_t mavlink_msg_gps_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
442{
443 return _MAV_RETURN_int32_t(msg, 8);
444}
445
446/**
447 * @brief Get field baseline_b_mm from gps_rtk message
448 *
449 * @return Current baseline in ECEF y or NED east component in mm.
450 */
451static inline int32_t mavlink_msg_gps_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
452{
453 return _MAV_RETURN_int32_t(msg, 12);
454}
455
456/**
457 * @brief Get field baseline_c_mm from gps_rtk message
458 *
459 * @return Current baseline in ECEF z or NED down component in mm.
460 */
461static inline int32_t mavlink_msg_gps_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
462{
463 return _MAV_RETURN_int32_t(msg, 16);
464}
465
466/**
467 * @brief Get field accuracy from gps_rtk message
468 *
469 * @return Current estimate of baseline accuracy.
470 */
471static inline uint32_t mavlink_msg_gps_rtk_get_accuracy(const mavlink_message_t* msg)
472{
473 return _MAV_RETURN_uint32_t(msg, 20);
474}
475
476/**
477 * @brief Get field iar_num_hypotheses from gps_rtk message
478 *
479 * @return Current number of integer ambiguity hypotheses.
480 */
481static inline int32_t mavlink_msg_gps_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
482{
483 return _MAV_RETURN_int32_t(msg, 24);
484}
485
486/**
487 * @brief Decode a gps_rtk message into a struct
488 *
489 * @param msg The message to decode
490 * @param gps_rtk C-struct to decode the message contents into
491 */
492static inline void mavlink_msg_gps_rtk_decode(const mavlink_message_t* msg, mavlink_gps_rtk_t* gps_rtk)
493{
494#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
495 gps_rtk->time_last_baseline_ms = mavlink_msg_gps_rtk_get_time_last_baseline_ms(msg);
496 gps_rtk->tow = mavlink_msg_gps_rtk_get_tow(msg);
497 gps_rtk->baseline_a_mm = mavlink_msg_gps_rtk_get_baseline_a_mm(msg);
498 gps_rtk->baseline_b_mm = mavlink_msg_gps_rtk_get_baseline_b_mm(msg);
499 gps_rtk->baseline_c_mm = mavlink_msg_gps_rtk_get_baseline_c_mm(msg);
500 gps_rtk->accuracy = mavlink_msg_gps_rtk_get_accuracy(msg);
501 gps_rtk->iar_num_hypotheses = mavlink_msg_gps_rtk_get_iar_num_hypotheses(msg);
502 gps_rtk->wn = mavlink_msg_gps_rtk_get_wn(msg);
503 gps_rtk->rtk_receiver_id = mavlink_msg_gps_rtk_get_rtk_receiver_id(msg);
504 gps_rtk->rtk_health = mavlink_msg_gps_rtk_get_rtk_health(msg);
505 gps_rtk->rtk_rate = mavlink_msg_gps_rtk_get_rtk_rate(msg);
506 gps_rtk->nsats = mavlink_msg_gps_rtk_get_nsats(msg);
507 gps_rtk->baseline_coords_type = mavlink_msg_gps_rtk_get_baseline_coords_type(msg);
508#else
509 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS_RTK_LEN? msg->len : MAVLINK_MSG_ID_GPS_RTK_LEN;
510 memset(gps_rtk, 0, MAVLINK_MSG_ID_GPS_RTK_LEN);
511 memcpy(gps_rtk, _MAV_PAYLOAD(msg), len);
512#endif
513}