Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_gps2_raw.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GPS2_RAW PACKING
3
4#define MAVLINK_MSG_ID_GPS2_RAW 124
5
6MAVPACKED(
7typedef struct __mavlink_gps2_raw_t {
8 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 int32_t lat; /*< [degE7] Latitude (WGS84)*/
10 int32_t lon; /*< [degE7] Longitude (WGS84)*/
11 int32_t alt; /*< [mm] Altitude (MSL). Positive for up.*/
12 uint32_t dgps_age; /*< [ms] Age of DGPS info*/
13 uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/
14 uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/
15 uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX*/
16 uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
17 uint8_t fix_type; /*< GPS fix type.*/
18 uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/
19 uint8_t dgps_numch; /*< Number of DGPS satellites*/
20 uint16_t yaw; /*< [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.*/
21 int32_t alt_ellipsoid; /*< [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.*/
22 uint32_t h_acc; /*< [mm] Position uncertainty.*/
23 uint32_t v_acc; /*< [mm] Altitude uncertainty.*/
24 uint32_t vel_acc; /*< [mm/s] Speed uncertainty.*/
25 uint32_t hdg_acc; /*< [degE5] Heading / track uncertainty*/
26}) mavlink_gps2_raw_t;
27
28#define MAVLINK_MSG_ID_GPS2_RAW_LEN 57
29#define MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN 35
30#define MAVLINK_MSG_ID_124_LEN 57
31#define MAVLINK_MSG_ID_124_MIN_LEN 35
32
33#define MAVLINK_MSG_ID_GPS2_RAW_CRC 87
34#define MAVLINK_MSG_ID_124_CRC 87
35
36
37
38#if MAVLINK_COMMAND_24BIT
39#define MAVLINK_MESSAGE_INFO_GPS2_RAW {
40 124,
41 "GPS2_RAW",
42 18,
43 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) },
44 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) },
45 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) },
46 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) },
47 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) },
48 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) },
49 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) },
50 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) },
51 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) },
52 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) },
53 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) },
54 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) },
55 { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 35, offsetof(mavlink_gps2_raw_t, yaw) },
56 { "alt_ellipsoid", NULL, MAVLINK_TYPE_INT32_T, 0, 37, offsetof(mavlink_gps2_raw_t, alt_ellipsoid) },
57 { "h_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 41, offsetof(mavlink_gps2_raw_t, h_acc) },
58 { "v_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 45, offsetof(mavlink_gps2_raw_t, v_acc) },
59 { "vel_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 49, offsetof(mavlink_gps2_raw_t, vel_acc) },
60 { "hdg_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 53, offsetof(mavlink_gps2_raw_t, hdg_acc) },
61 } \
62}
63#else
64#define MAVLINK_MESSAGE_INFO_GPS2_RAW {
65 "GPS2_RAW",
66 18,
67 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) },
68 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) },
69 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) },
70 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) },
71 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) },
72 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) },
73 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) },
74 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) },
75 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) },
76 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) },
77 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) },
78 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) },
79 { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 35, offsetof(mavlink_gps2_raw_t, yaw) },
80 { "alt_ellipsoid", NULL, MAVLINK_TYPE_INT32_T, 0, 37, offsetof(mavlink_gps2_raw_t, alt_ellipsoid) },
81 { "h_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 41, offsetof(mavlink_gps2_raw_t, h_acc) },
82 { "v_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 45, offsetof(mavlink_gps2_raw_t, v_acc) },
83 { "vel_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 49, offsetof(mavlink_gps2_raw_t, vel_acc) },
84 { "hdg_acc", NULL, MAVLINK_TYPE_UINT32_T, 0, 53, offsetof(mavlink_gps2_raw_t, hdg_acc) },
85 } \
86}
87#endif
88
89/**
90 * @brief Pack a gps2_raw message
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param msg The MAVLink message to compress the data into
94 *
95 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
96 * @param fix_type GPS fix type.
97 * @param lat [degE7] Latitude (WGS84)
98 * @param lon [degE7] Longitude (WGS84)
99 * @param alt [mm] Altitude (MSL). Positive for up.
100 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
101 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
102 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
103 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
104 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
105 * @param dgps_numch Number of DGPS satellites
106 * @param dgps_age [ms] Age of DGPS info
107 * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.
108 * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.
109 * @param h_acc [mm] Position uncertainty.
110 * @param v_acc [mm] Altitude uncertainty.
111 * @param vel_acc [mm/s] Speed uncertainty.
112 * @param hdg_acc [degE5] Heading / track uncertainty
113 * @return length of the message in bytes (excluding serial stream start sign)
114 */
115static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
116 uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc)
117{
118#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
120 _mav_put_uint64_t(buf, 0, time_usec);
121 _mav_put_int32_t(buf, 8, lat);
122 _mav_put_int32_t(buf, 12, lon);
123 _mav_put_int32_t(buf, 16, alt);
124 _mav_put_uint32_t(buf, 20, dgps_age);
125 _mav_put_uint16_t(buf, 24, eph);
126 _mav_put_uint16_t(buf, 26, epv);
127 _mav_put_uint16_t(buf, 28, vel);
128 _mav_put_uint16_t(buf, 30, cog);
129 _mav_put_uint8_t(buf, 32, fix_type);
130 _mav_put_uint8_t(buf, 33, satellites_visible);
131 _mav_put_uint8_t(buf, 34, dgps_numch);
132 _mav_put_uint16_t(buf, 35, yaw);
133 _mav_put_int32_t(buf, 37, alt_ellipsoid);
134 _mav_put_uint32_t(buf, 41, h_acc);
135 _mav_put_uint32_t(buf, 45, v_acc);
136 _mav_put_uint32_t(buf, 49, vel_acc);
137 _mav_put_uint32_t(buf, 53, hdg_acc);
138
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
140#else
141 mavlink_gps2_raw_t packet;
142 packet.time_usec = time_usec;
143 packet.lat = lat;
144 packet.lon = lon;
145 packet.alt = alt;
146 packet.dgps_age = dgps_age;
147 packet.eph = eph;
148 packet.epv = epv;
149 packet.vel = vel;
150 packet.cog = cog;
151 packet.fix_type = fix_type;
152 packet.satellites_visible = satellites_visible;
153 packet.dgps_numch = dgps_numch;
154 packet.yaw = yaw;
155 packet.alt_ellipsoid = alt_ellipsoid;
156 packet.h_acc = h_acc;
157 packet.v_acc = v_acc;
158 packet.vel_acc = vel_acc;
159 packet.hdg_acc = hdg_acc;
160
161 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
162#endif
163
164 msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
165 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
166}
167
168/**
169 * @brief Pack a gps2_raw message
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param status MAVLink status structure
173 * @param msg The MAVLink message to compress the data into
174 *
175 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
176 * @param fix_type GPS fix type.
177 * @param lat [degE7] Latitude (WGS84)
178 * @param lon [degE7] Longitude (WGS84)
179 * @param alt [mm] Altitude (MSL). Positive for up.
180 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
181 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
182 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
183 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
184 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
185 * @param dgps_numch Number of DGPS satellites
186 * @param dgps_age [ms] Age of DGPS info
187 * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.
188 * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.
189 * @param h_acc [mm] Position uncertainty.
190 * @param v_acc [mm] Altitude uncertainty.
191 * @param vel_acc [mm/s] Speed uncertainty.
192 * @param hdg_acc [degE5] Heading / track uncertainty
193 * @return length of the message in bytes (excluding serial stream start sign)
194 */
195static inline uint16_t mavlink_msg_gps2_raw_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
196 uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc)
197{
198#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 _mav_put_uint64_t(buf, 0, time_usec);
201 _mav_put_int32_t(buf, 8, lat);
202 _mav_put_int32_t(buf, 12, lon);
203 _mav_put_int32_t(buf, 16, alt);
204 _mav_put_uint32_t(buf, 20, dgps_age);
205 _mav_put_uint16_t(buf, 24, eph);
206 _mav_put_uint16_t(buf, 26, epv);
207 _mav_put_uint16_t(buf, 28, vel);
208 _mav_put_uint16_t(buf, 30, cog);
209 _mav_put_uint8_t(buf, 32, fix_type);
210 _mav_put_uint8_t(buf, 33, satellites_visible);
211 _mav_put_uint8_t(buf, 34, dgps_numch);
212 _mav_put_uint16_t(buf, 35, yaw);
213 _mav_put_int32_t(buf, 37, alt_ellipsoid);
214 _mav_put_uint32_t(buf, 41, h_acc);
215 _mav_put_uint32_t(buf, 45, v_acc);
216 _mav_put_uint32_t(buf, 49, vel_acc);
217 _mav_put_uint32_t(buf, 53, hdg_acc);
218
219 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
220#else
221 mavlink_gps2_raw_t packet;
222 packet.time_usec = time_usec;
223 packet.lat = lat;
224 packet.lon = lon;
225 packet.alt = alt;
226 packet.dgps_age = dgps_age;
227 packet.eph = eph;
228 packet.epv = epv;
229 packet.vel = vel;
230 packet.cog = cog;
231 packet.fix_type = fix_type;
232 packet.satellites_visible = satellites_visible;
233 packet.dgps_numch = dgps_numch;
234 packet.yaw = yaw;
235 packet.alt_ellipsoid = alt_ellipsoid;
236 packet.h_acc = h_acc;
237 packet.v_acc = v_acc;
238 packet.vel_acc = vel_acc;
239 packet.hdg_acc = hdg_acc;
240
241 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
242#endif
243
244 msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
245#if MAVLINK_CRC_EXTRA
246 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
247#else
248 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN);
249#endif
250}
251
252/**
253 * @brief Pack a gps2_raw message on a channel
254 * @param system_id ID of this system
255 * @param component_id ID of this component (e.g. 200 for IMU)
256 * @param chan The MAVLink channel this message will be sent over
257 * @param msg The MAVLink message to compress the data into
258 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
259 * @param fix_type GPS fix type.
260 * @param lat [degE7] Latitude (WGS84)
261 * @param lon [degE7] Longitude (WGS84)
262 * @param alt [mm] Altitude (MSL). Positive for up.
263 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
264 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
265 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
266 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
267 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
268 * @param dgps_numch Number of DGPS satellites
269 * @param dgps_age [ms] Age of DGPS info
270 * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.
271 * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.
272 * @param h_acc [mm] Position uncertainty.
273 * @param v_acc [mm] Altitude uncertainty.
274 * @param vel_acc [mm/s] Speed uncertainty.
275 * @param hdg_acc [degE5] Heading / track uncertainty
276 * @return length of the message in bytes (excluding serial stream start sign)
277 */
278static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
279 mavlink_message_t* msg,
280 uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible,uint8_t dgps_numch,uint32_t dgps_age,uint16_t yaw,int32_t alt_ellipsoid,uint32_t h_acc,uint32_t v_acc,uint32_t vel_acc,uint32_t hdg_acc)
281{
282#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 _mav_put_uint64_t(buf, 0, time_usec);
285 _mav_put_int32_t(buf, 8, lat);
286 _mav_put_int32_t(buf, 12, lon);
287 _mav_put_int32_t(buf, 16, alt);
288 _mav_put_uint32_t(buf, 20, dgps_age);
289 _mav_put_uint16_t(buf, 24, eph);
290 _mav_put_uint16_t(buf, 26, epv);
291 _mav_put_uint16_t(buf, 28, vel);
292 _mav_put_uint16_t(buf, 30, cog);
293 _mav_put_uint8_t(buf, 32, fix_type);
294 _mav_put_uint8_t(buf, 33, satellites_visible);
295 _mav_put_uint8_t(buf, 34, dgps_numch);
296 _mav_put_uint16_t(buf, 35, yaw);
297 _mav_put_int32_t(buf, 37, alt_ellipsoid);
298 _mav_put_uint32_t(buf, 41, h_acc);
299 _mav_put_uint32_t(buf, 45, v_acc);
300 _mav_put_uint32_t(buf, 49, vel_acc);
301 _mav_put_uint32_t(buf, 53, hdg_acc);
302
303 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
304#else
305 mavlink_gps2_raw_t packet;
306 packet.time_usec = time_usec;
307 packet.lat = lat;
308 packet.lon = lon;
309 packet.alt = alt;
310 packet.dgps_age = dgps_age;
311 packet.eph = eph;
312 packet.epv = epv;
313 packet.vel = vel;
314 packet.cog = cog;
315 packet.fix_type = fix_type;
316 packet.satellites_visible = satellites_visible;
317 packet.dgps_numch = dgps_numch;
318 packet.yaw = yaw;
319 packet.alt_ellipsoid = alt_ellipsoid;
320 packet.h_acc = h_acc;
321 packet.v_acc = v_acc;
322 packet.vel_acc = vel_acc;
323 packet.hdg_acc = hdg_acc;
324
325 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
326#endif
327
328 msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
329 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
330}
331
332/**
333 * @brief Encode a gps2_raw struct
334 *
335 * @param system_id ID of this system
336 * @param component_id ID of this component (e.g. 200 for IMU)
337 * @param msg The MAVLink message to compress the data into
338 * @param gps2_raw C-struct to read the message contents from
339 */
340static inline uint16_t mavlink_msg_gps2_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw)
341{
342 return mavlink_msg_gps2_raw_pack(system_id, component_id, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc);
343}
344
345/**
346 * @brief Encode a gps2_raw struct on a channel
347 *
348 * @param system_id ID of this system
349 * @param component_id ID of this component (e.g. 200 for IMU)
350 * @param chan The MAVLink channel this message will be sent over
351 * @param msg The MAVLink message to compress the data into
352 * @param gps2_raw C-struct to read the message contents from
353 */
354static inline uint16_t mavlink_msg_gps2_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw)
355{
356 return mavlink_msg_gps2_raw_pack_chan(system_id, component_id, chan, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc);
357}
358
359/**
360 * @brief Encode a gps2_raw struct with provided status structure
361 *
362 * @param system_id ID of this system
363 * @param component_id ID of this component (e.g. 200 for IMU)
364 * @param status MAVLink status structure
365 * @param msg The MAVLink message to compress the data into
366 * @param gps2_raw C-struct to read the message contents from
367 */
368static inline uint16_t mavlink_msg_gps2_raw_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw)
369{
370 return mavlink_msg_gps2_raw_pack_status(system_id, component_id, _status, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc);
371}
372
373/**
374 * @brief Send a gps2_raw message
375 * @param chan MAVLink channel to send the message
376 *
377 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
378 * @param fix_type GPS fix type.
379 * @param lat [degE7] Latitude (WGS84)
380 * @param lon [degE7] Longitude (WGS84)
381 * @param alt [mm] Altitude (MSL). Positive for up.
382 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
383 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
384 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
385 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
386 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
387 * @param dgps_numch Number of DGPS satellites
388 * @param dgps_age [ms] Age of DGPS info
389 * @param yaw [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.
390 * @param alt_ellipsoid [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.
391 * @param h_acc [mm] Position uncertainty.
392 * @param v_acc [mm] Altitude uncertainty.
393 * @param vel_acc [mm/s] Speed uncertainty.
394 * @param hdg_acc [degE5] Heading / track uncertainty
395 */
396#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
397
398static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc)
399{
400#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
401 char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
402 _mav_put_uint64_t(buf, 0, time_usec);
403 _mav_put_int32_t(buf, 8, lat);
404 _mav_put_int32_t(buf, 12, lon);
405 _mav_put_int32_t(buf, 16, alt);
406 _mav_put_uint32_t(buf, 20, dgps_age);
407 _mav_put_uint16_t(buf, 24, eph);
408 _mav_put_uint16_t(buf, 26, epv);
409 _mav_put_uint16_t(buf, 28, vel);
410 _mav_put_uint16_t(buf, 30, cog);
411 _mav_put_uint8_t(buf, 32, fix_type);
412 _mav_put_uint8_t(buf, 33, satellites_visible);
413 _mav_put_uint8_t(buf, 34, dgps_numch);
414 _mav_put_uint16_t(buf, 35, yaw);
415 _mav_put_int32_t(buf, 37, alt_ellipsoid);
416 _mav_put_uint32_t(buf, 41, h_acc);
417 _mav_put_uint32_t(buf, 45, v_acc);
418 _mav_put_uint32_t(buf, 49, vel_acc);
419 _mav_put_uint32_t(buf, 53, hdg_acc);
420
421 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
422#else
423 mavlink_gps2_raw_t packet;
424 packet.time_usec = time_usec;
425 packet.lat = lat;
426 packet.lon = lon;
427 packet.alt = alt;
428 packet.dgps_age = dgps_age;
429 packet.eph = eph;
430 packet.epv = epv;
431 packet.vel = vel;
432 packet.cog = cog;
433 packet.fix_type = fix_type;
434 packet.satellites_visible = satellites_visible;
435 packet.dgps_numch = dgps_numch;
436 packet.yaw = yaw;
437 packet.alt_ellipsoid = alt_ellipsoid;
438 packet.h_acc = h_acc;
439 packet.v_acc = v_acc;
440 packet.vel_acc = vel_acc;
441 packet.hdg_acc = hdg_acc;
442
443 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
444#endif
445}
446
447/**
448 * @brief Send a gps2_raw message
449 * @param chan MAVLink channel to send the message
450 * @param struct The MAVLink struct to serialize
451 */
452static inline void mavlink_msg_gps2_raw_send_struct(mavlink_channel_t chan, const mavlink_gps2_raw_t* gps2_raw)
453{
454#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
455 mavlink_msg_gps2_raw_send(chan, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age, gps2_raw->yaw, gps2_raw->alt_ellipsoid, gps2_raw->h_acc, gps2_raw->v_acc, gps2_raw->vel_acc, gps2_raw->hdg_acc);
456#else
457 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)gps2_raw, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
458#endif
459}
460
461#if MAVLINK_MSG_ID_GPS2_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
462/*
463 This variant of _send() can be used to save stack space by reusing
464 memory from the receive buffer. The caller provides a
465 mavlink_message_t which is the size of a full mavlink message. This
466 is usually the receive buffer for the channel, and allows a reply to an
467 incoming message with minimum stack space usage.
468 */
469static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age, uint16_t yaw, int32_t alt_ellipsoid, uint32_t h_acc, uint32_t v_acc, uint32_t vel_acc, uint32_t hdg_acc)
470{
471#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
472 char *buf = (char *)msgbuf;
473 _mav_put_uint64_t(buf, 0, time_usec);
474 _mav_put_int32_t(buf, 8, lat);
475 _mav_put_int32_t(buf, 12, lon);
476 _mav_put_int32_t(buf, 16, alt);
477 _mav_put_uint32_t(buf, 20, dgps_age);
478 _mav_put_uint16_t(buf, 24, eph);
479 _mav_put_uint16_t(buf, 26, epv);
480 _mav_put_uint16_t(buf, 28, vel);
481 _mav_put_uint16_t(buf, 30, cog);
482 _mav_put_uint8_t(buf, 32, fix_type);
483 _mav_put_uint8_t(buf, 33, satellites_visible);
484 _mav_put_uint8_t(buf, 34, dgps_numch);
485 _mav_put_uint16_t(buf, 35, yaw);
486 _mav_put_int32_t(buf, 37, alt_ellipsoid);
487 _mav_put_uint32_t(buf, 41, h_acc);
488 _mav_put_uint32_t(buf, 45, v_acc);
489 _mav_put_uint32_t(buf, 49, vel_acc);
490 _mav_put_uint32_t(buf, 53, hdg_acc);
491
492 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
493#else
494 mavlink_gps2_raw_t *packet = (mavlink_gps2_raw_t *)msgbuf;
495 packet->time_usec = time_usec;
496 packet->lat = lat;
497 packet->lon = lon;
498 packet->alt = alt;
499 packet->dgps_age = dgps_age;
500 packet->eph = eph;
501 packet->epv = epv;
502 packet->vel = vel;
503 packet->cog = cog;
504 packet->fix_type = fix_type;
505 packet->satellites_visible = satellites_visible;
506 packet->dgps_numch = dgps_numch;
507 packet->yaw = yaw;
508 packet->alt_ellipsoid = alt_ellipsoid;
509 packet->h_acc = h_acc;
510 packet->v_acc = v_acc;
511 packet->vel_acc = vel_acc;
512 packet->hdg_acc = hdg_acc;
513
514 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)packet, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
515#endif
516}
517#endif
518
519#endif
520
521// MESSAGE GPS2_RAW UNPACKING
522
523
524/**
525 * @brief Get field time_usec from gps2_raw message
526 *
527 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
528 */
529static inline uint64_t mavlink_msg_gps2_raw_get_time_usec(const mavlink_message_t* msg)
530{
531 return _MAV_RETURN_uint64_t(msg, 0);
532}
533
534/**
535 * @brief Get field fix_type from gps2_raw message
536 *
537 * @return GPS fix type.
538 */
539static inline uint8_t mavlink_msg_gps2_raw_get_fix_type(const mavlink_message_t* msg)
540{
541 return _MAV_RETURN_uint8_t(msg, 32);
542}
543
544/**
545 * @brief Get field lat from gps2_raw message
546 *
547 * @return [degE7] Latitude (WGS84)
548 */
549static inline int32_t mavlink_msg_gps2_raw_get_lat(const mavlink_message_t* msg)
550{
551 return _MAV_RETURN_int32_t(msg, 8);
552}
553
554/**
555 * @brief Get field lon from gps2_raw message
556 *
557 * @return [degE7] Longitude (WGS84)
558 */
559static inline int32_t mavlink_msg_gps2_raw_get_lon(const mavlink_message_t* msg)
560{
561 return _MAV_RETURN_int32_t(msg, 12);
562}
563
564/**
565 * @brief Get field alt from gps2_raw message
566 *
567 * @return [mm] Altitude (MSL). Positive for up.
568 */
569static inline int32_t mavlink_msg_gps2_raw_get_alt(const mavlink_message_t* msg)
570{
571 return _MAV_RETURN_int32_t(msg, 16);
572}
573
574/**
575 * @brief Get field eph from gps2_raw message
576 *
577 * @return GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
578 */
579static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t* msg)
580{
581 return _MAV_RETURN_uint16_t(msg, 24);
582}
583
584/**
585 * @brief Get field epv from gps2_raw message
586 *
587 * @return GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
588 */
589static inline uint16_t mavlink_msg_gps2_raw_get_epv(const mavlink_message_t* msg)
590{
591 return _MAV_RETURN_uint16_t(msg, 26);
592}
593
594/**
595 * @brief Get field vel from gps2_raw message
596 *
597 * @return [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
598 */
599static inline uint16_t mavlink_msg_gps2_raw_get_vel(const mavlink_message_t* msg)
600{
601 return _MAV_RETURN_uint16_t(msg, 28);
602}
603
604/**
605 * @brief Get field cog from gps2_raw message
606 *
607 * @return [cdeg] Course over ground (NOT heading, but direction of movement): 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
608 */
609static inline uint16_t mavlink_msg_gps2_raw_get_cog(const mavlink_message_t* msg)
610{
611 return _MAV_RETURN_uint16_t(msg, 30);
612}
613
614/**
615 * @brief Get field satellites_visible from gps2_raw message
616 *
617 * @return Number of satellites visible. If unknown, set to UINT8_MAX
618 */
619static inline uint8_t mavlink_msg_gps2_raw_get_satellites_visible(const mavlink_message_t* msg)
620{
621 return _MAV_RETURN_uint8_t(msg, 33);
622}
623
624/**
625 * @brief Get field dgps_numch from gps2_raw message
626 *
627 * @return Number of DGPS satellites
628 */
629static inline uint8_t mavlink_msg_gps2_raw_get_dgps_numch(const mavlink_message_t* msg)
630{
631 return _MAV_RETURN_uint8_t(msg, 34);
632}
633
634/**
635 * @brief Get field dgps_age from gps2_raw message
636 *
637 * @return [ms] Age of DGPS info
638 */
639static inline uint32_t mavlink_msg_gps2_raw_get_dgps_age(const mavlink_message_t* msg)
640{
641 return _MAV_RETURN_uint32_t(msg, 20);
642}
643
644/**
645 * @brief Get field yaw from gps2_raw message
646 *
647 * @return [cdeg] Yaw in earth frame from north. Use 0 if this GPS does not provide yaw. Use UINT16_MAX if this GPS is configured to provide yaw and is currently unable to provide it. Use 36000 for north.
648 */
649static inline uint16_t mavlink_msg_gps2_raw_get_yaw(const mavlink_message_t* msg)
650{
651 return _MAV_RETURN_uint16_t(msg, 35);
652}
653
654/**
655 * @brief Get field alt_ellipsoid from gps2_raw message
656 *
657 * @return [mm] Altitude (above WGS84, EGM96 ellipsoid). Positive for up.
658 */
659static inline int32_t mavlink_msg_gps2_raw_get_alt_ellipsoid(const mavlink_message_t* msg)
660{
661 return _MAV_RETURN_int32_t(msg, 37);
662}
663
664/**
665 * @brief Get field h_acc from gps2_raw message
666 *
667 * @return [mm] Position uncertainty.
668 */
669static inline uint32_t mavlink_msg_gps2_raw_get_h_acc(const mavlink_message_t* msg)
670{
671 return _MAV_RETURN_uint32_t(msg, 41);
672}
673
674/**
675 * @brief Get field v_acc from gps2_raw message
676 *
677 * @return [mm] Altitude uncertainty.
678 */
679static inline uint32_t mavlink_msg_gps2_raw_get_v_acc(const mavlink_message_t* msg)
680{
681 return _MAV_RETURN_uint32_t(msg, 45);
682}
683
684/**
685 * @brief Get field vel_acc from gps2_raw message
686 *
687 * @return [mm/s] Speed uncertainty.
688 */
689static inline uint32_t mavlink_msg_gps2_raw_get_vel_acc(const mavlink_message_t* msg)
690{
691 return _MAV_RETURN_uint32_t(msg, 49);
692}
693
694/**
695 * @brief Get field hdg_acc from gps2_raw message
696 *
697 * @return [degE5] Heading / track uncertainty
698 */
699static inline uint32_t mavlink_msg_gps2_raw_get_hdg_acc(const mavlink_message_t* msg)
700{
701 return _MAV_RETURN_uint32_t(msg, 53);
702}
703
704/**
705 * @brief Decode a gps2_raw message into a struct
706 *
707 * @param msg The message to decode
708 * @param gps2_raw C-struct to decode the message contents into
709 */
710static inline void mavlink_msg_gps2_raw_decode(const mavlink_message_t* msg, mavlink_gps2_raw_t* gps2_raw)
711{
712#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
713 gps2_raw->time_usec = mavlink_msg_gps2_raw_get_time_usec(msg);
714 gps2_raw->lat = mavlink_msg_gps2_raw_get_lat(msg);
715 gps2_raw->lon = mavlink_msg_gps2_raw_get_lon(msg);
716 gps2_raw->alt = mavlink_msg_gps2_raw_get_alt(msg);
717 gps2_raw->dgps_age = mavlink_msg_gps2_raw_get_dgps_age(msg);
718 gps2_raw->eph = mavlink_msg_gps2_raw_get_eph(msg);
719 gps2_raw->epv = mavlink_msg_gps2_raw_get_epv(msg);
720 gps2_raw->vel = mavlink_msg_gps2_raw_get_vel(msg);
721 gps2_raw->cog = mavlink_msg_gps2_raw_get_cog(msg);
722 gps2_raw->fix_type = mavlink_msg_gps2_raw_get_fix_type(msg);
723 gps2_raw->satellites_visible = mavlink_msg_gps2_raw_get_satellites_visible(msg);
724 gps2_raw->dgps_numch = mavlink_msg_gps2_raw_get_dgps_numch(msg);
725 gps2_raw->yaw = mavlink_msg_gps2_raw_get_yaw(msg);
726 gps2_raw->alt_ellipsoid = mavlink_msg_gps2_raw_get_alt_ellipsoid(msg);
727 gps2_raw->h_acc = mavlink_msg_gps2_raw_get_h_acc(msg);
728 gps2_raw->v_acc = mavlink_msg_gps2_raw_get_v_acc(msg);
729 gps2_raw->vel_acc = mavlink_msg_gps2_raw_get_vel_acc(msg);
730 gps2_raw->hdg_acc = mavlink_msg_gps2_raw_get_hdg_acc(msg);
731#else
732 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS2_RAW_LEN? msg->len : MAVLINK_MSG_ID_GPS2_RAW_LEN;
733 memset(gps2_raw, 0, MAVLINK_MSG_ID_GPS2_RAW_LEN);
734 memcpy(gps2_raw, _MAV_PAYLOAD(msg), len);
735#endif
736}