RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_hil_gps.h
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; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
9 int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
10 int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
11 int32_t alt; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/
12 uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535*/
13 uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535*/
14 uint16_t vel; /*< GPS ground speed in cm/s. If unknown, set to: 65535*/
15 int16_t vn; /*< GPS velocity in cm/s in NORTH direction in earth-fixed NED frame*/
16 int16_t ve; /*< GPS velocity in cm/s in EAST direction in earth-fixed NED frame*/
17 int16_t vd; /*< GPS velocity in cm/s in DOWN direction in earth-fixed NED frame*/
18 uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535*/
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 255*/
21}) mavlink_hil_gps_t;
22
23#define MAVLINK_MSG_ID_HIL_GPS_LEN 36
24#define MAVLINK_MSG_ID_HIL_GPS_MIN_LEN 36
25#define MAVLINK_MSG_ID_113_LEN 36
26#define MAVLINK_MSG_ID_113_MIN_LEN 36
27
28#define MAVLINK_MSG_ID_HIL_GPS_CRC 124
29#define MAVLINK_MSG_ID_113_CRC 124
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_HIL_GPS { \
35 113, \
36 "HIL_GPS", \
37 13, \
38 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) }, \
39 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) }, \
40 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) }, \
41 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) }, \
42 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) }, \
43 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) }, \
44 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) }, \
45 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) }, \
46 { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) }, \
47 { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) }, \
48 { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) }, \
49 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) }, \
50 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) }, \
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_HIL_GPS { \
55 "HIL_GPS", \
56 13, \
57 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) }, \
58 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) }, \
59 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) }, \
60 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) }, \
61 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) }, \
62 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) }, \
63 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) }, \
64 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) }, \
65 { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) }, \
66 { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) }, \
67 { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) }, \
68 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) }, \
69 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) }, \
70 } \
71}
72#endif
73
74/**
75 * @brief Pack a hil_gps message
76 * @param system_id ID of this system
77 * @param component_id ID of this component (e.g. 200 for IMU)
78 * @param msg The MAVLink message to compress the data into
79 *
80 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
81 * @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.
82 * @param lat Latitude (WGS84), in degrees * 1E7
83 * @param lon Longitude (WGS84), in degrees * 1E7
84 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
85 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
86 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
87 * @param vel GPS ground speed in cm/s. If unknown, set to: 65535
88 * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
89 * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
90 * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
91 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
92 * @param satellites_visible Number of satellites visible. If unknown, set to 255
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 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)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
100 _mav_put_uint64_t(buf, 0, time_usec);
101 _mav_put_int32_t(buf, 8, lat);
102 _mav_put_int32_t(buf, 12, lon);
103 _mav_put_int32_t(buf, 16, alt);
104 _mav_put_uint16_t(buf, 20, eph);
105 _mav_put_uint16_t(buf, 22, epv);
106 _mav_put_uint16_t(buf, 24, vel);
107 _mav_put_int16_t(buf, 26, vn);
108 _mav_put_int16_t(buf, 28, ve);
109 _mav_put_int16_t(buf, 30, vd);
110 _mav_put_uint16_t(buf, 32, cog);
111 _mav_put_uint8_t(buf, 34, fix_type);
112 _mav_put_uint8_t(buf, 35, satellites_visible);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
115#else
116 mavlink_hil_gps_t packet;
117 packet.time_usec = time_usec;
118 packet.lat = lat;
119 packet.lon = lon;
120 packet.alt = alt;
121 packet.eph = eph;
122 packet.epv = epv;
123 packet.vel = vel;
124 packet.vn = vn;
125 packet.ve = ve;
126 packet.vd = vd;
127 packet.cog = cog;
128 packet.fix_type = fix_type;
129 packet.satellites_visible = satellites_visible;
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
132#endif
133
134 msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
135 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);
136}
137
138/**
139 * @brief Pack a hil_gps message on a channel
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param chan The MAVLink channel this message will be sent over
143 * @param msg The MAVLink message to compress the data into
144 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
145 * @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.
146 * @param lat Latitude (WGS84), in degrees * 1E7
147 * @param lon Longitude (WGS84), in degrees * 1E7
148 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
149 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
150 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
151 * @param vel GPS ground speed in cm/s. If unknown, set to: 65535
152 * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
153 * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
154 * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
155 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
156 * @param satellites_visible Number of satellites visible. If unknown, set to 255
157 * @return length of the message in bytes (excluding serial stream start sign)
158 */
159static inline uint16_t mavlink_msg_hil_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
160 mavlink_message_t* msg,
161 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)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
164 char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
165 _mav_put_uint64_t(buf, 0, time_usec);
166 _mav_put_int32_t(buf, 8, lat);
167 _mav_put_int32_t(buf, 12, lon);
168 _mav_put_int32_t(buf, 16, alt);
169 _mav_put_uint16_t(buf, 20, eph);
170 _mav_put_uint16_t(buf, 22, epv);
171 _mav_put_uint16_t(buf, 24, vel);
172 _mav_put_int16_t(buf, 26, vn);
173 _mav_put_int16_t(buf, 28, ve);
174 _mav_put_int16_t(buf, 30, vd);
175 _mav_put_uint16_t(buf, 32, cog);
176 _mav_put_uint8_t(buf, 34, fix_type);
177 _mav_put_uint8_t(buf, 35, satellites_visible);
178
179 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
180#else
181 mavlink_hil_gps_t packet;
182 packet.time_usec = time_usec;
183 packet.lat = lat;
184 packet.lon = lon;
185 packet.alt = alt;
186 packet.eph = eph;
187 packet.epv = epv;
188 packet.vel = vel;
189 packet.vn = vn;
190 packet.ve = ve;
191 packet.vd = vd;
192 packet.cog = cog;
193 packet.fix_type = fix_type;
194 packet.satellites_visible = satellites_visible;
195
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
197#endif
198
199 msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
200 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);
201}
202
203/**
204 * @brief Encode a hil_gps struct
205 *
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param msg The MAVLink message to compress the data into
209 * @param hil_gps C-struct to read the message contents from
210 */
211static 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)
212{
213 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);
214}
215
216/**
217 * @brief Encode a hil_gps struct on a channel
218 *
219 * @param system_id ID of this system
220 * @param component_id ID of this component (e.g. 200 for IMU)
221 * @param chan The MAVLink channel this message will be sent over
222 * @param msg The MAVLink message to compress the data into
223 * @param hil_gps C-struct to read the message contents from
224 */
225static 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)
226{
227 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);
228}
229
230/**
231 * @brief Send a hil_gps message
232 * @param chan MAVLink channel to send the message
233 *
234 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
235 * @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.
236 * @param lat Latitude (WGS84), in degrees * 1E7
237 * @param lon Longitude (WGS84), in degrees * 1E7
238 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
239 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
240 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
241 * @param vel GPS ground speed in cm/s. If unknown, set to: 65535
242 * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
243 * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
244 * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
245 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
246 * @param satellites_visible Number of satellites visible. If unknown, set to 255
247 */
248#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
249
250static 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)
251{
252#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253 char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
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
268 _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);
269#else
270 mavlink_hil_gps_t packet;
271 packet.time_usec = time_usec;
272 packet.lat = lat;
273 packet.lon = lon;
274 packet.alt = alt;
275 packet.eph = eph;
276 packet.epv = epv;
277 packet.vel = vel;
278 packet.vn = vn;
279 packet.ve = ve;
280 packet.vd = vd;
281 packet.cog = cog;
282 packet.fix_type = fix_type;
283 packet.satellites_visible = satellites_visible;
284
285 _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);
286#endif
287}
288
289/**
290 * @brief Send a hil_gps message
291 * @param chan MAVLink channel to send the message
292 * @param struct The MAVLink struct to serialize
293 */
294static inline void mavlink_msg_hil_gps_send_struct(mavlink_channel_t chan, const mavlink_hil_gps_t* hil_gps)
295{
296#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
297 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);
298#else
299 _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);
300#endif
301}
302
303#if MAVLINK_MSG_ID_HIL_GPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
304/*
305 This varient of _send() can be used to save stack space by re-using
306 memory from the receive buffer. The caller provides a
307 mavlink_message_t which is the size of a full mavlink message. This
308 is usually the receive buffer for the channel, and allows a reply to an
309 incoming message with minimum stack space usage.
310 */
311static inline void mavlink_msg_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)
312{
313#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
314 char *buf = (char *)msgbuf;
315 _mav_put_uint64_t(buf, 0, time_usec);
316 _mav_put_int32_t(buf, 8, lat);
317 _mav_put_int32_t(buf, 12, lon);
318 _mav_put_int32_t(buf, 16, alt);
319 _mav_put_uint16_t(buf, 20, eph);
320 _mav_put_uint16_t(buf, 22, epv);
321 _mav_put_uint16_t(buf, 24, vel);
322 _mav_put_int16_t(buf, 26, vn);
323 _mav_put_int16_t(buf, 28, ve);
324 _mav_put_int16_t(buf, 30, vd);
325 _mav_put_uint16_t(buf, 32, cog);
326 _mav_put_uint8_t(buf, 34, fix_type);
327 _mav_put_uint8_t(buf, 35, satellites_visible);
328
329 _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);
330#else
331 mavlink_hil_gps_t *packet = (mavlink_hil_gps_t *)msgbuf;
332 packet->time_usec = time_usec;
333 packet->lat = lat;
334 packet->lon = lon;
335 packet->alt = alt;
336 packet->eph = eph;
337 packet->epv = epv;
338 packet->vel = vel;
339 packet->vn = vn;
340 packet->ve = ve;
341 packet->vd = vd;
342 packet->cog = cog;
343 packet->fix_type = fix_type;
344 packet->satellites_visible = satellites_visible;
345
346 _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);
347#endif
348}
349#endif
350
351#endif
352
353// MESSAGE HIL_GPS UNPACKING
354
355
356/**
357 * @brief Get field time_usec from hil_gps message
358 *
359 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
360 */
361static inline uint64_t mavlink_msg_hil_gps_get_time_usec(const mavlink_message_t* msg)
362{
363 return _MAV_RETURN_uint64_t(msg, 0);
364}
365
366/**
367 * @brief Get field fix_type from hil_gps message
368 *
369 * @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.
370 */
371static inline uint8_t mavlink_msg_hil_gps_get_fix_type(const mavlink_message_t* msg)
372{
373 return _MAV_RETURN_uint8_t(msg, 34);
374}
375
376/**
377 * @brief Get field lat from hil_gps message
378 *
379 * @return Latitude (WGS84), in degrees * 1E7
380 */
381static inline int32_t mavlink_msg_hil_gps_get_lat(const mavlink_message_t* msg)
382{
383 return _MAV_RETURN_int32_t(msg, 8);
384}
385
386/**
387 * @brief Get field lon from hil_gps message
388 *
389 * @return Longitude (WGS84), in degrees * 1E7
390 */
391static inline int32_t mavlink_msg_hil_gps_get_lon(const mavlink_message_t* msg)
392{
393 return _MAV_RETURN_int32_t(msg, 12);
394}
395
396/**
397 * @brief Get field alt from hil_gps message
398 *
399 * @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
400 */
401static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg)
402{
403 return _MAV_RETURN_int32_t(msg, 16);
404}
405
406/**
407 * @brief Get field eph from hil_gps message
408 *
409 * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
410 */
411static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg)
412{
413 return _MAV_RETURN_uint16_t(msg, 20);
414}
415
416/**
417 * @brief Get field epv from hil_gps message
418 *
419 * @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
420 */
421static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg)
422{
423 return _MAV_RETURN_uint16_t(msg, 22);
424}
425
426/**
427 * @brief Get field vel from hil_gps message
428 *
429 * @return GPS ground speed in cm/s. If unknown, set to: 65535
430 */
431static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg)
432{
433 return _MAV_RETURN_uint16_t(msg, 24);
434}
435
436/**
437 * @brief Get field vn from hil_gps message
438 *
439 * @return GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
440 */
441static inline int16_t mavlink_msg_hil_gps_get_vn(const mavlink_message_t* msg)
442{
443 return _MAV_RETURN_int16_t(msg, 26);
444}
445
446/**
447 * @brief Get field ve from hil_gps message
448 *
449 * @return GPS velocity in cm/s in EAST direction in earth-fixed NED frame
450 */
451static inline int16_t mavlink_msg_hil_gps_get_ve(const mavlink_message_t* msg)
452{
453 return _MAV_RETURN_int16_t(msg, 28);
454}
455
456/**
457 * @brief Get field vd from hil_gps message
458 *
459 * @return GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
460 */
461static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg)
462{
463 return _MAV_RETURN_int16_t(msg, 30);
464}
465
466/**
467 * @brief Get field cog from hil_gps message
468 *
469 * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
470 */
471static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg)
472{
473 return _MAV_RETURN_uint16_t(msg, 32);
474}
475
476/**
477 * @brief Get field satellites_visible from hil_gps message
478 *
479 * @return Number of satellites visible. If unknown, set to 255
480 */
481static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg)
482{
483 return _MAV_RETURN_uint8_t(msg, 35);
484}
485
486/**
487 * @brief Decode a hil_gps message into a struct
488 *
489 * @param msg The message to decode
490 * @param hil_gps C-struct to decode the message contents into
491 */
492static inline void mavlink_msg_hil_gps_decode(const mavlink_message_t* msg, mavlink_hil_gps_t* hil_gps)
493{
494#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
495 hil_gps->time_usec = mavlink_msg_hil_gps_get_time_usec(msg);
496 hil_gps->lat = mavlink_msg_hil_gps_get_lat(msg);
497 hil_gps->lon = mavlink_msg_hil_gps_get_lon(msg);
498 hil_gps->alt = mavlink_msg_hil_gps_get_alt(msg);
499 hil_gps->eph = mavlink_msg_hil_gps_get_eph(msg);
500 hil_gps->epv = mavlink_msg_hil_gps_get_epv(msg);
501 hil_gps->vel = mavlink_msg_hil_gps_get_vel(msg);
502 hil_gps->vn = mavlink_msg_hil_gps_get_vn(msg);
503 hil_gps->ve = mavlink_msg_hil_gps_get_ve(msg);
504 hil_gps->vd = mavlink_msg_hil_gps_get_vd(msg);
505 hil_gps->cog = mavlink_msg_hil_gps_get_cog(msg);
506 hil_gps->fix_type = mavlink_msg_hil_gps_get_fix_type(msg);
507 hil_gps->satellites_visible = mavlink_msg_hil_gps_get_satellites_visible(msg);
508#else
509 uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_GPS_LEN? msg->len : MAVLINK_MSG_ID_HIL_GPS_LEN;
510 memset(hil_gps, 0, MAVLINK_MSG_ID_HIL_GPS_LEN);
511 memcpy(hil_gps, _MAV_PAYLOAD(msg), len);
512#endif
513}