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