source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_hil_gps.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

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