Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_gps2_rtk.h
blob2af9b53ca72979116d2dba7cfbed4aa280250e08
1 #pragma once
2 // MESSAGE GPS2_RTK PACKING
4 #define MAVLINK_MSG_ID_GPS2_RTK 128
7 typedef 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;
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
28 #define MAVLINK_MSG_ID_GPS2_RTK_CRC 226
29 #define MAVLINK_MSG_ID_128_CRC 226
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 } \
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 } \
72 #endif
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
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)
95 static 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)
98 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_GPS2_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);
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;
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
132 #endif
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);
139 * @brief Pack a gps2_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 [ms] Time since boot of last baseline message received.
145 * @param rtk_receiver_id Identification of connected RTK receiver.
146 * @param wn GPS Week Number of last baseline
147 * @param tow [ms] GPS Time of Week of last baseline
148 * @param rtk_health GPS-specific health report for RTK data.
149 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
150 * @param nsats Current number of sats used for RTK calculation.
151 * @param baseline_coords_type Coordinate system of baseline
152 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
153 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
154 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
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)
159 static inline uint16_t mavlink_msg_gps2_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)
163 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
164 char buf[MAVLINK_MSG_ID_GPS2_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);
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;
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
197 #endif
199 msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
200 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);
204 * @brief Encode a gps2_rtk struct
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 gps2_rtk C-struct to read the message contents from
211 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)
213 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);
217 * @brief Encode a gps2_rtk struct on a channel
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 gps2_rtk C-struct to read the message contents from
225 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)
227 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);
231 * @brief Send a gps2_rtk message
232 * @param chan MAVLink channel to send the message
234 * @param time_last_baseline_ms [ms] Time since boot of last baseline message received.
235 * @param rtk_receiver_id Identification of connected RTK receiver.
236 * @param wn GPS Week Number of last baseline
237 * @param tow [ms] GPS Time of Week of last baseline
238 * @param rtk_health GPS-specific health report for RTK data.
239 * @param rtk_rate [Hz] Rate of baseline messages being received by GPS
240 * @param nsats Current number of sats used for RTK calculation.
241 * @param baseline_coords_type Coordinate system of baseline
242 * @param baseline_a_mm [mm] Current baseline in ECEF x or NED north component.
243 * @param baseline_b_mm [mm] Current baseline in ECEF y or NED east component.
244 * @param baseline_c_mm [mm] Current baseline in ECEF z or NED down component.
245 * @param accuracy Current estimate of baseline accuracy.
246 * @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
248 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
250 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)
252 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253 char buf[MAVLINK_MSG_ID_GPS2_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);
268 _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);
269 #else
270 mavlink_gps2_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;
285 _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);
286 #endif
290 * @brief Send a gps2_rtk message
291 * @param chan MAVLink channel to send the message
292 * @param struct The MAVLink struct to serialize
294 static inline void mavlink_msg_gps2_rtk_send_struct(mavlink_channel_t chan, const mavlink_gps2_rtk_t* gps2_rtk)
296 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
297 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);
298 #else
299 _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);
300 #endif
303 #if MAVLINK_MSG_ID_GPS2_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
311 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)
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);
329 _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);
330 #else
331 mavlink_gps2_rtk_t *packet = (mavlink_gps2_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;
346 _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);
347 #endif
349 #endif
351 #endif
353 // MESSAGE GPS2_RTK UNPACKING
357 * @brief Get field time_last_baseline_ms from gps2_rtk message
359 * @return [ms] Time since boot of last baseline message received.
361 static inline uint32_t mavlink_msg_gps2_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
363 return _MAV_RETURN_uint32_t(msg, 0);
367 * @brief Get field rtk_receiver_id from gps2_rtk message
369 * @return Identification of connected RTK receiver.
371 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
373 return _MAV_RETURN_uint8_t(msg, 30);
377 * @brief Get field wn from gps2_rtk message
379 * @return GPS Week Number of last baseline
381 static inline uint16_t mavlink_msg_gps2_rtk_get_wn(const mavlink_message_t* msg)
383 return _MAV_RETURN_uint16_t(msg, 28);
387 * @brief Get field tow from gps2_rtk message
389 * @return [ms] GPS Time of Week of last baseline
391 static inline uint32_t mavlink_msg_gps2_rtk_get_tow(const mavlink_message_t* msg)
393 return _MAV_RETURN_uint32_t(msg, 4);
397 * @brief Get field rtk_health from gps2_rtk message
399 * @return GPS-specific health report for RTK data.
401 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_health(const mavlink_message_t* msg)
403 return _MAV_RETURN_uint8_t(msg, 31);
407 * @brief Get field rtk_rate from gps2_rtk message
409 * @return [Hz] Rate of baseline messages being received by GPS
411 static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_rate(const mavlink_message_t* msg)
413 return _MAV_RETURN_uint8_t(msg, 32);
417 * @brief Get field nsats from gps2_rtk message
419 * @return Current number of sats used for RTK calculation.
421 static inline uint8_t mavlink_msg_gps2_rtk_get_nsats(const mavlink_message_t* msg)
423 return _MAV_RETURN_uint8_t(msg, 33);
427 * @brief Get field baseline_coords_type from gps2_rtk message
429 * @return Coordinate system of baseline
431 static inline uint8_t mavlink_msg_gps2_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
433 return _MAV_RETURN_uint8_t(msg, 34);
437 * @brief Get field baseline_a_mm from gps2_rtk message
439 * @return [mm] Current baseline in ECEF x or NED north component.
441 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
443 return _MAV_RETURN_int32_t(msg, 8);
447 * @brief Get field baseline_b_mm from gps2_rtk message
449 * @return [mm] Current baseline in ECEF y or NED east component.
451 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
453 return _MAV_RETURN_int32_t(msg, 12);
457 * @brief Get field baseline_c_mm from gps2_rtk message
459 * @return [mm] Current baseline in ECEF z or NED down component.
461 static inline int32_t mavlink_msg_gps2_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
463 return _MAV_RETURN_int32_t(msg, 16);
467 * @brief Get field accuracy from gps2_rtk message
469 * @return Current estimate of baseline accuracy.
471 static inline uint32_t mavlink_msg_gps2_rtk_get_accuracy(const mavlink_message_t* msg)
473 return _MAV_RETURN_uint32_t(msg, 20);
477 * @brief Get field iar_num_hypotheses from gps2_rtk message
479 * @return Current number of integer ambiguity hypotheses.
481 static inline int32_t mavlink_msg_gps2_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
483 return _MAV_RETURN_int32_t(msg, 24);
487 * @brief Decode a gps2_rtk message into a struct
489 * @param msg The message to decode
490 * @param gps2_rtk C-struct to decode the message contents into
492 static inline void mavlink_msg_gps2_rtk_decode(const mavlink_message_t* msg, mavlink_gps2_rtk_t* gps2_rtk)
494 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
495 gps2_rtk->time_last_baseline_ms = mavlink_msg_gps2_rtk_get_time_last_baseline_ms(msg);
496 gps2_rtk->tow = mavlink_msg_gps2_rtk_get_tow(msg);
497 gps2_rtk->baseline_a_mm = mavlink_msg_gps2_rtk_get_baseline_a_mm(msg);
498 gps2_rtk->baseline_b_mm = mavlink_msg_gps2_rtk_get_baseline_b_mm(msg);
499 gps2_rtk->baseline_c_mm = mavlink_msg_gps2_rtk_get_baseline_c_mm(msg);
500 gps2_rtk->accuracy = mavlink_msg_gps2_rtk_get_accuracy(msg);
501 gps2_rtk->iar_num_hypotheses = mavlink_msg_gps2_rtk_get_iar_num_hypotheses(msg);
502 gps2_rtk->wn = mavlink_msg_gps2_rtk_get_wn(msg);
503 gps2_rtk->rtk_receiver_id = mavlink_msg_gps2_rtk_get_rtk_receiver_id(msg);
504 gps2_rtk->rtk_health = mavlink_msg_gps2_rtk_get_rtk_health(msg);
505 gps2_rtk->rtk_rate = mavlink_msg_gps2_rtk_get_rtk_rate(msg);
506 gps2_rtk->nsats = mavlink_msg_gps2_rtk_get_nsats(msg);
507 gps2_rtk->baseline_coords_type = mavlink_msg_gps2_rtk_get_baseline_coords_type(msg);
508 #else
509 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS2_RTK_LEN? msg->len : MAVLINK_MSG_ID_GPS2_RTK_LEN;
510 memset(gps2_rtk, 0, MAVLINK_MSG_ID_GPS2_RTK_LEN);
511 memcpy(gps2_rtk, _MAV_PAYLOAD(msg), len);
512 #endif