mavlink_msg_gps_raw_int.h
Go to the documentation of this file.
1 // MESSAGE GPS_RAW_INT PACKING
2 
3 #define MAVLINK_MSG_ID_GPS_RAW_INT 24
4 
5 typedef struct __mavlink_gps_raw_int_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). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.*/
11  uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/
12  uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/
13  uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
14  uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
15  uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/
16  uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
18 
19 #define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30
20 #define MAVLINK_MSG_ID_24_LEN 30
21 
22 #define MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24
23 #define MAVLINK_MSG_ID_24_CRC 24
24 
25 
26 
27 #define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
28  "GPS_RAW_INT", \
29  10, \
30  { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, time_usec) }, \
31  { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_raw_int_t, lat) }, \
32  { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_raw_int_t, lon) }, \
33  { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_raw_int_t, alt) }, \
34  { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_gps_raw_int_t, eph) }, \
35  { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_gps_raw_int_t, epv) }, \
36  { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps_raw_int_t, vel) }, \
37  { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps_raw_int_t, cog) }, \
38  { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
39  { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_gps_raw_int_t, satellites_visible) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67  _mav_put_uint64_t(buf, 0, time_usec);
68  _mav_put_int32_t(buf, 8, lat);
69  _mav_put_int32_t(buf, 12, lon);
70  _mav_put_int32_t(buf, 16, alt);
71  _mav_put_uint16_t(buf, 20, eph);
72  _mav_put_uint16_t(buf, 22, epv);
73  _mav_put_uint16_t(buf, 24, vel);
74  _mav_put_uint16_t(buf, 26, cog);
75  _mav_put_uint8_t(buf, 28, fix_type);
76  _mav_put_uint8_t(buf, 29, satellites_visible);
77 
79 #else
80  mavlink_gps_raw_int_t packet;
81  packet.time_usec = time_usec;
82  packet.lat = lat;
83  packet.lon = lon;
84  packet.alt = alt;
85  packet.eph = eph;
86  packet.epv = epv;
87  packet.vel = vel;
88  packet.cog = cog;
89  packet.fix_type = fix_type;
91 
93 #endif
94 
95  msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
100 #endif
101 }
102 
121 static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
122  mavlink_message_t* msg,
123  uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible)
124 {
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
127  _mav_put_uint64_t(buf, 0, time_usec);
128  _mav_put_int32_t(buf, 8, lat);
129  _mav_put_int32_t(buf, 12, lon);
130  _mav_put_int32_t(buf, 16, alt);
131  _mav_put_uint16_t(buf, 20, eph);
132  _mav_put_uint16_t(buf, 22, epv);
133  _mav_put_uint16_t(buf, 24, vel);
134  _mav_put_uint16_t(buf, 26, cog);
135  _mav_put_uint8_t(buf, 28, fix_type);
136  _mav_put_uint8_t(buf, 29, satellites_visible);
137 
139 #else
140  mavlink_gps_raw_int_t packet;
141  packet.time_usec = time_usec;
142  packet.lat = lat;
143  packet.lon = lon;
144  packet.alt = alt;
145  packet.eph = eph;
146  packet.epv = epv;
147  packet.vel = vel;
148  packet.cog = cog;
149  packet.fix_type = fix_type;
151 
153 #endif
154 
155  msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
156 #if MAVLINK_CRC_EXTRA
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_gps_raw_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
172 {
173  return mavlink_msg_gps_raw_int_pack(system_id, component_id, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
174 }
175 
185 static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
186 {
187  return mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, chan, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_gps_raw_int_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211  _mav_put_uint64_t(buf, 0, time_usec);
212  _mav_put_int32_t(buf, 8, lat);
213  _mav_put_int32_t(buf, 12, lon);
214  _mav_put_int32_t(buf, 16, alt);
215  _mav_put_uint16_t(buf, 20, eph);
216  _mav_put_uint16_t(buf, 22, epv);
217  _mav_put_uint16_t(buf, 24, vel);
218  _mav_put_uint16_t(buf, 26, cog);
219  _mav_put_uint8_t(buf, 28, fix_type);
220  _mav_put_uint8_t(buf, 29, satellites_visible);
221 
222 #if MAVLINK_CRC_EXTRA
224 #else
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
226 #endif
227 #else
228  mavlink_gps_raw_int_t packet;
229  packet.time_usec = time_usec;
230  packet.lat = lat;
231  packet.lon = lon;
232  packet.alt = alt;
233  packet.eph = eph;
234  packet.epv = epv;
235  packet.vel = vel;
236  packet.cog = cog;
237  packet.fix_type = fix_type;
239 
240 #if MAVLINK_CRC_EXTRA
241  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
242 #else
243  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
244 #endif
245 #endif
246 }
247 
248 #if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
249 /*
250  This varient of _send() can be used to save stack space by re-using
251  memory from the receive buffer. The caller provides a
252  mavlink_message_t which is the size of a full mavlink message. This
253  is usually the receive buffer for the channel, and allows a reply to an
254  incoming message with minimum stack space usage.
255  */
256 static inline void mavlink_msg_gps_raw_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
257 {
258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259  char *buf = (char *)msgbuf;
260  _mav_put_uint64_t(buf, 0, time_usec);
261  _mav_put_int32_t(buf, 8, lat);
262  _mav_put_int32_t(buf, 12, lon);
263  _mav_put_int32_t(buf, 16, alt);
264  _mav_put_uint16_t(buf, 20, eph);
265  _mav_put_uint16_t(buf, 22, epv);
266  _mav_put_uint16_t(buf, 24, vel);
267  _mav_put_uint16_t(buf, 26, cog);
268  _mav_put_uint8_t(buf, 28, fix_type);
269  _mav_put_uint8_t(buf, 29, satellites_visible);
270 
271 #if MAVLINK_CRC_EXTRA
273 #else
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
275 #endif
276 #else
277  mavlink_gps_raw_int_t *packet = (mavlink_gps_raw_int_t *)msgbuf;
278  packet->time_usec = time_usec;
279  packet->lat = lat;
280  packet->lon = lon;
281  packet->alt = alt;
282  packet->eph = eph;
283  packet->epv = epv;
284  packet->vel = vel;
285  packet->cog = cog;
286  packet->fix_type = fix_type;
288 
289 #if MAVLINK_CRC_EXTRA
290  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
293 #endif
294 #endif
295 }
296 #endif
297 
298 #endif
299 
300 // MESSAGE GPS_RAW_INT UNPACKING
301 
302 
308 static inline uint64_t mavlink_msg_gps_raw_int_get_time_usec(const mavlink_message_t* msg)
309 {
310  return _MAV_RETURN_uint64_t(msg, 0);
311 }
312 
318 static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t* msg)
319 {
320  return _MAV_RETURN_uint8_t(msg, 28);
321 }
322 
328 static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t* msg)
329 {
330  return _MAV_RETURN_int32_t(msg, 8);
331 }
332 
338 static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t* msg)
339 {
340  return _MAV_RETURN_int32_t(msg, 12);
341 }
342 
348 static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* msg)
349 {
350  return _MAV_RETURN_int32_t(msg, 16);
351 }
352 
358 static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg)
359 {
360  return _MAV_RETURN_uint16_t(msg, 20);
361 }
362 
368 static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg)
369 {
370  return _MAV_RETURN_uint16_t(msg, 22);
371 }
372 
378 static inline uint16_t mavlink_msg_gps_raw_int_get_vel(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_uint16_t(msg, 24);
381 }
382 
388 static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t* msg)
389 {
390  return _MAV_RETURN_uint16_t(msg, 26);
391 }
392 
398 static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_uint8_t(msg, 29);
401 }
402 
409 static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t* msg, mavlink_gps_raw_int_t* gps_raw_int)
410 {
411 #if MAVLINK_NEED_BYTE_SWAP
413  gps_raw_int->lat = mavlink_msg_gps_raw_int_get_lat(msg);
414  gps_raw_int->lon = mavlink_msg_gps_raw_int_get_lon(msg);
415  gps_raw_int->alt = mavlink_msg_gps_raw_int_get_alt(msg);
416  gps_raw_int->eph = mavlink_msg_gps_raw_int_get_eph(msg);
417  gps_raw_int->epv = mavlink_msg_gps_raw_int_get_epv(msg);
418  gps_raw_int->vel = mavlink_msg_gps_raw_int_get_vel(msg);
419  gps_raw_int->cog = mavlink_msg_gps_raw_int_get_cog(msg);
422 #else
423  memcpy(gps_raw_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
424 #endif
425 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint64_t(buf, wire_offset, b)
Definition: protocol.h:149
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:09:25