Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_hil_gps.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE HIL_GPS PACKING
3
4#define MAVLINK_MSG_ID_HIL_GPS 113
5
6MAVPACKED(
7typedef struct __mavlink_hil_gps_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 uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/
13 uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX*/
14 uint16_t vel; /*< [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX*/
15 int16_t vn; /*< [cm/s] GPS velocity in north direction in earth-fixed NED frame*/
16 int16_t ve; /*< [cm/s] GPS velocity in east direction in earth-fixed NED frame*/
17 int16_t vd; /*< [cm/s] GPS velocity in down direction in earth-fixed NED frame*/
18 uint16_t cog; /*< [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
19 uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/
20 uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/
21 uint8_t id; /*< GPS ID (zero indexed). Used for multiple GPS inputs*/
22 uint16_t yaw; /*< [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north*/
23}) mavlink_hil_gps_t;
24
25#define MAVLINK_MSG_ID_HIL_GPS_LEN 39
26#define MAVLINK_MSG_ID_HIL_GPS_MIN_LEN 36
27#define MAVLINK_MSG_ID_113_LEN 39
28#define MAVLINK_MSG_ID_113_MIN_LEN 36
29
30#define MAVLINK_MSG_ID_HIL_GPS_CRC 124
31#define MAVLINK_MSG_ID_113_CRC 124
32
33
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_HIL_GPS {
37 113,
38 "HIL_GPS",
39 15,
40 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) },
41 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) },
42 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) },
43 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) },
44 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) },
45 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) },
46 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) },
47 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) },
48 { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) },
49 { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) },
50 { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) },
51 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) },
52 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) },
53 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_hil_gps_t, id) },
54 { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 37, offsetof(mavlink_hil_gps_t, yaw) },
55 } \
56}
57#else
58#define MAVLINK_MESSAGE_INFO_HIL_GPS {
59 "HIL_GPS",
60 15,
61 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) },
62 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) },
63 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) },
64 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) },
65 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) },
66 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) },
67 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) },
68 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) },
69 { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) },
70 { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) },
71 { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) },
72 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) },
73 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) },
74 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_hil_gps_t, id) },
75 { "yaw", NULL, MAVLINK_TYPE_UINT16_T, 0, 37, offsetof(mavlink_hil_gps_t, yaw) },
76 } \
77}
78#endif
79
80/**
81 * @brief Pack a hil_gps message
82 * @param system_id ID of this system
83 * @param component_id ID of this component (e.g. 200 for IMU)
84 * @param msg The MAVLink message to compress the data into
85 *
86 * @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.
87 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
88 * @param lat [degE7] Latitude (WGS84)
89 * @param lon [degE7] Longitude (WGS84)
90 * @param alt [mm] Altitude (MSL). Positive for up.
91 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
92 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
93 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
94 * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame
95 * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame
96 * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame
97 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
98 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
99 * @param id GPS ID (zero indexed). Used for multiple GPS inputs
100 * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north
101 * @return length of the message in bytes (excluding serial stream start sign)
102 */
103static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
104 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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible, uint8_t id, uint16_t yaw)
105{
106#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 _mav_put_uint64_t(buf, 0, time_usec);
109 _mav_put_int32_t(buf, 8, lat);
110 _mav_put_int32_t(buf, 12, lon);
111 _mav_put_int32_t(buf, 16, alt);
112 _mav_put_uint16_t(buf, 20, eph);
113 _mav_put_uint16_t(buf, 22, epv);
114 _mav_put_uint16_t(buf, 24, vel);
115 _mav_put_int16_t(buf, 26, vn);
116 _mav_put_int16_t(buf, 28, ve);
117 _mav_put_int16_t(buf, 30, vd);
118 _mav_put_uint16_t(buf, 32, cog);
119 _mav_put_uint8_t(buf, 34, fix_type);
120 _mav_put_uint8_t(buf, 35, satellites_visible);
121 _mav_put_uint8_t(buf, 36, id);
122 _mav_put_uint16_t(buf, 37, yaw);
123
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
125#else
126 mavlink_hil_gps_t packet;
127 packet.time_usec = time_usec;
128 packet.lat = lat;
129 packet.lon = lon;
130 packet.alt = alt;
131 packet.eph = eph;
132 packet.epv = epv;
133 packet.vel = vel;
134 packet.vn = vn;
135 packet.ve = ve;
136 packet.vd = vd;
137 packet.cog = cog;
138 packet.fix_type = fix_type;
139 packet.satellites_visible = satellites_visible;
140 packet.id = id;
141 packet.yaw = yaw;
142
143 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
144#endif
145
146 msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
147 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
148}
149
150/**
151 * @brief Pack a hil_gps message
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param status MAVLink status structure
155 * @param msg The MAVLink message to compress the data into
156 *
157 * @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.
158 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
159 * @param lat [degE7] Latitude (WGS84)
160 * @param lon [degE7] Longitude (WGS84)
161 * @param alt [mm] Altitude (MSL). Positive for up.
162 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
163 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
164 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
165 * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame
166 * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame
167 * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame
168 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
169 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
170 * @param id GPS ID (zero indexed). Used for multiple GPS inputs
171 * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north
172 * @return length of the message in bytes (excluding serial stream start sign)
173 */
174static inline uint16_t mavlink_msg_hil_gps_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
175 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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible, uint8_t id, uint16_t yaw)
176{
177#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 _mav_put_uint64_t(buf, 0, time_usec);
180 _mav_put_int32_t(buf, 8, lat);
181 _mav_put_int32_t(buf, 12, lon);
182 _mav_put_int32_t(buf, 16, alt);
183 _mav_put_uint16_t(buf, 20, eph);
184 _mav_put_uint16_t(buf, 22, epv);
185 _mav_put_uint16_t(buf, 24, vel);
186 _mav_put_int16_t(buf, 26, vn);
187 _mav_put_int16_t(buf, 28, ve);
188 _mav_put_int16_t(buf, 30, vd);
189 _mav_put_uint16_t(buf, 32, cog);
190 _mav_put_uint8_t(buf, 34, fix_type);
191 _mav_put_uint8_t(buf, 35, satellites_visible);
192 _mav_put_uint8_t(buf, 36, id);
193 _mav_put_uint16_t(buf, 37, yaw);
194
195 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
196#else
197 mavlink_hil_gps_t packet;
198 packet.time_usec = time_usec;
199 packet.lat = lat;
200 packet.lon = lon;
201 packet.alt = alt;
202 packet.eph = eph;
203 packet.epv = epv;
204 packet.vel = vel;
205 packet.vn = vn;
206 packet.ve = ve;
207 packet.vd = vd;
208 packet.cog = cog;
209 packet.fix_type = fix_type;
210 packet.satellites_visible = satellites_visible;
211 packet.id = id;
212 packet.yaw = yaw;
213
214 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
215#endif
216
217 msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
218#if MAVLINK_CRC_EXTRA
219 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
220#else
221 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN);
222#endif
223}
224
225/**
226 * @brief Pack a hil_gps message on a channel
227 * @param system_id ID of this system
228 * @param component_id ID of this component (e.g. 200 for IMU)
229 * @param chan The MAVLink channel this message will be sent over
230 * @param msg The MAVLink message to compress the data into
231 * @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.
232 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
233 * @param lat [degE7] Latitude (WGS84)
234 * @param lon [degE7] Longitude (WGS84)
235 * @param alt [mm] Altitude (MSL). Positive for up.
236 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
237 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
238 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
239 * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame
240 * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame
241 * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame
242 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
243 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
244 * @param id GPS ID (zero indexed). Used for multiple GPS inputs
245 * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north
246 * @return length of the message in bytes (excluding serial stream start sign)
247 */
248static inline uint16_t mavlink_msg_hil_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
249 mavlink_message_t* msg,
250 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,int16_t vn,int16_t ve,int16_t vd,uint16_t cog,uint8_t satellites_visible,uint8_t id,uint16_t yaw)
251{
252#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
254 _mav_put_uint64_t(buf, 0, time_usec);
255 _mav_put_int32_t(buf, 8, lat);
256 _mav_put_int32_t(buf, 12, lon);
257 _mav_put_int32_t(buf, 16, alt);
258 _mav_put_uint16_t(buf, 20, eph);
259 _mav_put_uint16_t(buf, 22, epv);
260 _mav_put_uint16_t(buf, 24, vel);
261 _mav_put_int16_t(buf, 26, vn);
262 _mav_put_int16_t(buf, 28, ve);
263 _mav_put_int16_t(buf, 30, vd);
264 _mav_put_uint16_t(buf, 32, cog);
265 _mav_put_uint8_t(buf, 34, fix_type);
266 _mav_put_uint8_t(buf, 35, satellites_visible);
267 _mav_put_uint8_t(buf, 36, id);
268 _mav_put_uint16_t(buf, 37, yaw);
269
270 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
271#else
272 mavlink_hil_gps_t packet;
273 packet.time_usec = time_usec;
274 packet.lat = lat;
275 packet.lon = lon;
276 packet.alt = alt;
277 packet.eph = eph;
278 packet.epv = epv;
279 packet.vel = vel;
280 packet.vn = vn;
281 packet.ve = ve;
282 packet.vd = vd;
283 packet.cog = cog;
284 packet.fix_type = fix_type;
285 packet.satellites_visible = satellites_visible;
286 packet.id = id;
287 packet.yaw = yaw;
288
289 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
290#endif
291
292 msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
293 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
294}
295
296/**
297 * @brief Encode a hil_gps struct
298 *
299 * @param system_id ID of this system
300 * @param component_id ID of this component (e.g. 200 for IMU)
301 * @param msg The MAVLink message to compress the data into
302 * @param hil_gps C-struct to read the message contents from
303 */
304static inline uint16_t mavlink_msg_hil_gps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps)
305{
306 return mavlink_msg_hil_gps_pack(system_id, component_id, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw);
307}
308
309/**
310 * @brief Encode a hil_gps struct on a channel
311 *
312 * @param system_id ID of this system
313 * @param component_id ID of this component (e.g. 200 for IMU)
314 * @param chan The MAVLink channel this message will be sent over
315 * @param msg The MAVLink message to compress the data into
316 * @param hil_gps C-struct to read the message contents from
317 */
318static inline uint16_t mavlink_msg_hil_gps_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps)
319{
320 return mavlink_msg_hil_gps_pack_chan(system_id, component_id, chan, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw);
321}
322
323/**
324 * @brief Encode a hil_gps struct with provided status structure
325 *
326 * @param system_id ID of this system
327 * @param component_id ID of this component (e.g. 200 for IMU)
328 * @param status MAVLink status structure
329 * @param msg The MAVLink message to compress the data into
330 * @param hil_gps C-struct to read the message contents from
331 */
332static inline uint16_t mavlink_msg_hil_gps_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps)
333{
334 return mavlink_msg_hil_gps_pack_status(system_id, component_id, _status, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw);
335}
336
337/**
338 * @brief Send a hil_gps message
339 * @param chan MAVLink channel to send the message
340 *
341 * @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.
342 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
343 * @param lat [degE7] Latitude (WGS84)
344 * @param lon [degE7] Longitude (WGS84)
345 * @param alt [mm] Altitude (MSL). Positive for up.
346 * @param eph GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
347 * @param epv GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
348 * @param vel [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
349 * @param vn [cm/s] GPS velocity in north direction in earth-fixed NED frame
350 * @param ve [cm/s] GPS velocity in east direction in earth-fixed NED frame
351 * @param vd [cm/s] GPS velocity in down direction in earth-fixed NED frame
352 * @param cog [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
353 * @param satellites_visible Number of satellites visible. If unknown, set to UINT8_MAX
354 * @param id GPS ID (zero indexed). Used for multiple GPS inputs
355 * @param yaw [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north
356 */
357#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
358
359static inline void mavlink_msg_hil_gps_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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible, uint8_t id, uint16_t yaw)
360{
361#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
362 char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
363 _mav_put_uint64_t(buf, 0, time_usec);
364 _mav_put_int32_t(buf, 8, lat);
365 _mav_put_int32_t(buf, 12, lon);
366 _mav_put_int32_t(buf, 16, alt);
367 _mav_put_uint16_t(buf, 20, eph);
368 _mav_put_uint16_t(buf, 22, epv);
369 _mav_put_uint16_t(buf, 24, vel);
370 _mav_put_int16_t(buf, 26, vn);
371 _mav_put_int16_t(buf, 28, ve);
372 _mav_put_int16_t(buf, 30, vd);
373 _mav_put_uint16_t(buf, 32, cog);
374 _mav_put_uint8_t(buf, 34, fix_type);
375 _mav_put_uint8_t(buf, 35, satellites_visible);
376 _mav_put_uint8_t(buf, 36, id);
377 _mav_put_uint16_t(buf, 37, yaw);
378
379 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
380#else
381 mavlink_hil_gps_t packet;
382 packet.time_usec = time_usec;
383 packet.lat = lat;
384 packet.lon = lon;
385 packet.alt = alt;
386 packet.eph = eph;
387 packet.epv = epv;
388 packet.vel = vel;
389 packet.vn = vn;
390 packet.ve = ve;
391 packet.vd = vd;
392 packet.cog = cog;
393 packet.fix_type = fix_type;
394 packet.satellites_visible = satellites_visible;
395 packet.id = id;
396 packet.yaw = yaw;
397
398 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
399#endif
400}
401
402/**
403 * @brief Send a hil_gps message
404 * @param chan MAVLink channel to send the message
405 * @param struct The MAVLink struct to serialize
406 */
407static inline void mavlink_msg_hil_gps_send_struct(mavlink_channel_t chan, const mavlink_hil_gps_t* hil_gps)
408{
409#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
410 mavlink_msg_hil_gps_send(chan, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible, hil_gps->id, hil_gps->yaw);
411#else
412 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)hil_gps, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
413#endif
414}
415
416#if MAVLINK_MSG_ID_HIL_GPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
417/*
418 This variant of _send() can be used to save stack space by reusing
419 memory from the receive buffer. The caller provides a
420 mavlink_message_t which is the size of a full mavlink message. This
421 is usually the receive buffer for the channel, and allows a reply to an
422 incoming message with minimum stack space usage.
423 */
424static inline void mavlink_msg_hil_gps_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, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible, uint8_t id, uint16_t yaw)
425{
426#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
427 char *buf = (char *)msgbuf;
428 _mav_put_uint64_t(buf, 0, time_usec);
429 _mav_put_int32_t(buf, 8, lat);
430 _mav_put_int32_t(buf, 12, lon);
431 _mav_put_int32_t(buf, 16, alt);
432 _mav_put_uint16_t(buf, 20, eph);
433 _mav_put_uint16_t(buf, 22, epv);
434 _mav_put_uint16_t(buf, 24, vel);
435 _mav_put_int16_t(buf, 26, vn);
436 _mav_put_int16_t(buf, 28, ve);
437 _mav_put_int16_t(buf, 30, vd);
438 _mav_put_uint16_t(buf, 32, cog);
439 _mav_put_uint8_t(buf, 34, fix_type);
440 _mav_put_uint8_t(buf, 35, satellites_visible);
441 _mav_put_uint8_t(buf, 36, id);
442 _mav_put_uint16_t(buf, 37, yaw);
443
444 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
445#else
446 mavlink_hil_gps_t *packet = (mavlink_hil_gps_t *)msgbuf;
447 packet->time_usec = time_usec;
448 packet->lat = lat;
449 packet->lon = lon;
450 packet->alt = alt;
451 packet->eph = eph;
452 packet->epv = epv;
453 packet->vel = vel;
454 packet->vn = vn;
455 packet->ve = ve;
456 packet->vd = vd;
457 packet->cog = cog;
458 packet->fix_type = fix_type;
459 packet->satellites_visible = satellites_visible;
460 packet->id = id;
461 packet->yaw = yaw;
462
463 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)packet, MAVLINK_MSG_ID_HIL_GPS_MIN_LEN, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
464#endif
465}
466#endif
467
468#endif
469
470// MESSAGE HIL_GPS UNPACKING
471
472
473/**
474 * @brief Get field time_usec from hil_gps message
475 *
476 * @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.
477 */
478static inline uint64_t mavlink_msg_hil_gps_get_time_usec(const mavlink_message_t* msg)
479{
480 return _MAV_RETURN_uint64_t(msg, 0);
481}
482
483/**
484 * @brief Get field fix_type from hil_gps message
485 *
486 * @return 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
487 */
488static inline uint8_t mavlink_msg_hil_gps_get_fix_type(const mavlink_message_t* msg)
489{
490 return _MAV_RETURN_uint8_t(msg, 34);
491}
492
493/**
494 * @brief Get field lat from hil_gps message
495 *
496 * @return [degE7] Latitude (WGS84)
497 */
498static inline int32_t mavlink_msg_hil_gps_get_lat(const mavlink_message_t* msg)
499{
500 return _MAV_RETURN_int32_t(msg, 8);
501}
502
503/**
504 * @brief Get field lon from hil_gps message
505 *
506 * @return [degE7] Longitude (WGS84)
507 */
508static inline int32_t mavlink_msg_hil_gps_get_lon(const mavlink_message_t* msg)
509{
510 return _MAV_RETURN_int32_t(msg, 12);
511}
512
513/**
514 * @brief Get field alt from hil_gps message
515 *
516 * @return [mm] Altitude (MSL). Positive for up.
517 */
518static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg)
519{
520 return _MAV_RETURN_int32_t(msg, 16);
521}
522
523/**
524 * @brief Get field eph from hil_gps message
525 *
526 * @return GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
527 */
528static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg)
529{
530 return _MAV_RETURN_uint16_t(msg, 20);
531}
532
533/**
534 * @brief Get field epv from hil_gps message
535 *
536 * @return GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX
537 */
538static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg)
539{
540 return _MAV_RETURN_uint16_t(msg, 22);
541}
542
543/**
544 * @brief Get field vel from hil_gps message
545 *
546 * @return [cm/s] GPS ground speed. If unknown, set to: UINT16_MAX
547 */
548static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg)
549{
550 return _MAV_RETURN_uint16_t(msg, 24);
551}
552
553/**
554 * @brief Get field vn from hil_gps message
555 *
556 * @return [cm/s] GPS velocity in north direction in earth-fixed NED frame
557 */
558static inline int16_t mavlink_msg_hil_gps_get_vn(const mavlink_message_t* msg)
559{
560 return _MAV_RETURN_int16_t(msg, 26);
561}
562
563/**
564 * @brief Get field ve from hil_gps message
565 *
566 * @return [cm/s] GPS velocity in east direction in earth-fixed NED frame
567 */
568static inline int16_t mavlink_msg_hil_gps_get_ve(const mavlink_message_t* msg)
569{
570 return _MAV_RETURN_int16_t(msg, 28);
571}
572
573/**
574 * @brief Get field vd from hil_gps message
575 *
576 * @return [cm/s] GPS velocity in down direction in earth-fixed NED frame
577 */
578static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg)
579{
580 return _MAV_RETURN_int16_t(msg, 30);
581}
582
583/**
584 * @brief Get field cog from hil_gps message
585 *
586 * @return [cdeg] Course over ground (NOT heading, but direction of movement), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
587 */
588static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg)
589{
590 return _MAV_RETURN_uint16_t(msg, 32);
591}
592
593/**
594 * @brief Get field satellites_visible from hil_gps message
595 *
596 * @return Number of satellites visible. If unknown, set to UINT8_MAX
597 */
598static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg)
599{
600 return _MAV_RETURN_uint8_t(msg, 35);
601}
602
603/**
604 * @brief Get field id from hil_gps message
605 *
606 * @return GPS ID (zero indexed). Used for multiple GPS inputs
607 */
608static inline uint8_t mavlink_msg_hil_gps_get_id(const mavlink_message_t* msg)
609{
610 return _MAV_RETURN_uint8_t(msg, 36);
611}
612
613/**
614 * @brief Get field yaw from hil_gps message
615 *
616 * @return [cdeg] Yaw of vehicle relative to Earth's North, zero means not available, use 36000 for north
617 */
618static inline uint16_t mavlink_msg_hil_gps_get_yaw(const mavlink_message_t* msg)
619{
620 return _MAV_RETURN_uint16_t(msg, 37);
621}
622
623/**
624 * @brief Decode a hil_gps message into a struct
625 *
626 * @param msg The message to decode
627 * @param hil_gps C-struct to decode the message contents into
628 */
629static inline void mavlink_msg_hil_gps_decode(const mavlink_message_t* msg, mavlink_hil_gps_t* hil_gps)
630{
631#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
632 hil_gps->time_usec = mavlink_msg_hil_gps_get_time_usec(msg);
633 hil_gps->lat = mavlink_msg_hil_gps_get_lat(msg);
634 hil_gps->lon = mavlink_msg_hil_gps_get_lon(msg);
635 hil_gps->alt = mavlink_msg_hil_gps_get_alt(msg);
636 hil_gps->eph = mavlink_msg_hil_gps_get_eph(msg);
637 hil_gps->epv = mavlink_msg_hil_gps_get_epv(msg);
638 hil_gps->vel = mavlink_msg_hil_gps_get_vel(msg);
639 hil_gps->vn = mavlink_msg_hil_gps_get_vn(msg);
640 hil_gps->ve = mavlink_msg_hil_gps_get_ve(msg);
641 hil_gps->vd = mavlink_msg_hil_gps_get_vd(msg);
642 hil_gps->cog = mavlink_msg_hil_gps_get_cog(msg);
643 hil_gps->fix_type = mavlink_msg_hil_gps_get_fix_type(msg);
644 hil_gps->satellites_visible = mavlink_msg_hil_gps_get_satellites_visible(msg);
645 hil_gps->id = mavlink_msg_hil_gps_get_id(msg);
646 hil_gps->yaw = mavlink_msg_hil_gps_get_yaw(msg);
647#else
648 uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_GPS_LEN? msg->len : MAVLINK_MSG_ID_HIL_GPS_LEN;
649 memset(hil_gps, 0, MAVLINK_MSG_ID_HIL_GPS_LEN);
650 memcpy(hil_gps, _MAV_PAYLOAD(msg), len);
651#endif
652}