1 // MESSAGE GPS_RAW_INT PACKING
3 #define MAVLINK_MSG_ID_GPS_RAW_INT 24
5 typedef struct __mavlink_gps_raw_int_t
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 in cm (m*100). If unknown, set to: UINT16_MAX
12 uint16_t epv
; ///< GPS VDOP vertical dilution of position in cm (m*100). 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
17 } mavlink_gps_raw_int_t
;
19 #define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30
20 #define MAVLINK_MSG_ID_24_LEN 30
22 #define MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24
23 #define MAVLINK_MSG_ID_24_CRC 24
27 #define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
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) }, \
45 * @brief Pack a gps_raw_int message
46 * @param system_id ID of this system
47 * @param component_id ID of this component (e.g. 200 for IMU)
48 * @param msg The MAVLink message to compress the data into
50 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
51 * @param 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.
52 * @param lat Latitude (WGS84), in degrees * 1E7
53 * @param lon Longitude (WGS84), in degrees * 1E7
54 * @param 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.
55 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
56 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
57 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
58 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
59 * @param satellites_visible Number of satellites visible. If unknown, set to 255
60 * @return length of the message in bytes (excluding serial stream start sign)
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
)
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66 char buf
[MAVLINK_MSG_ID_GPS_RAW_INT_LEN
];
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
);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
80 mavlink_gps_raw_int_t packet
;
81 packet
.time_usec
= time_usec
;
89 packet
.fix_type
= fix_type
;
90 packet
.satellites_visible
= satellites_visible
;
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
95 msg
->msgid
= MAVLINK_MSG_ID_GPS_RAW_INT
;
97 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
, MAVLINK_MSG_ID_GPS_RAW_INT_CRC
);
99 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
104 * @brief Pack a gps_raw_int message on a channel
105 * @param system_id ID of this system
106 * @param component_id ID of this component (e.g. 200 for IMU)
107 * @param chan The MAVLink channel this message will be sent over
108 * @param msg The MAVLink message to compress the data into
109 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
110 * @param 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.
111 * @param lat Latitude (WGS84), in degrees * 1E7
112 * @param lon Longitude (WGS84), in degrees * 1E7
113 * @param 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.
114 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
115 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
116 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
117 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
118 * @param satellites_visible Number of satellites visible. If unknown, set to 255
119 * @return length of the message in bytes (excluding serial stream start sign)
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
)
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
126 char buf
[MAVLINK_MSG_ID_GPS_RAW_INT_LEN
];
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
);
138 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
140 mavlink_gps_raw_int_t packet
;
141 packet
.time_usec
= time_usec
;
149 packet
.fix_type
= fix_type
;
150 packet
.satellites_visible
= satellites_visible
;
152 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
155 msg
->msgid
= MAVLINK_MSG_ID_GPS_RAW_INT
;
156 #if MAVLINK_CRC_EXTRA
157 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
, MAVLINK_MSG_ID_GPS_RAW_INT_CRC
);
159 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
164 * @brief Encode a gps_raw_int struct
166 * @param system_id ID of this system
167 * @param component_id ID of this component (e.g. 200 for IMU)
168 * @param msg The MAVLink message to compress the data into
169 * @param gps_raw_int C-struct to read the message contents from
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
)
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
);
177 * @brief Encode a gps_raw_int struct on a channel
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param chan The MAVLink channel this message will be sent over
182 * @param msg The MAVLink message to compress the data into
183 * @param gps_raw_int C-struct to read the message contents from
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
)
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
);
191 * @brief Send a gps_raw_int message
192 * @param chan MAVLink channel to send the message
194 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
195 * @param 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.
196 * @param lat Latitude (WGS84), in degrees * 1E7
197 * @param lon Longitude (WGS84), in degrees * 1E7
198 * @param 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.
199 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
200 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
201 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
202 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
203 * @param satellites_visible Number of satellites visible. If unknown, set to 255
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
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
)
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 char buf
[MAVLINK_MSG_ID_GPS_RAW_INT_LEN
];
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
);
222 #if MAVLINK_CRC_EXTRA
223 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
, MAVLINK_MSG_ID_GPS_RAW_INT_CRC
);
225 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
228 mavlink_gps_raw_int_t packet
;
229 packet
.time_usec
= time_usec
;
237 packet
.fix_type
= fix_type
;
238 packet
.satellites_visible
= satellites_visible
;
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
);
243 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, (const char *)&packet
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
248 #if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
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
)
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
);
271 #if MAVLINK_CRC_EXTRA
272 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
, MAVLINK_MSG_ID_GPS_RAW_INT_CRC
);
274 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, buf
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
277 mavlink_gps_raw_int_t
*packet
= (mavlink_gps_raw_int_t
*)msgbuf
;
278 packet
->time_usec
= time_usec
;
286 packet
->fix_type
= fix_type
;
287 packet
->satellites_visible
= satellites_visible
;
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
);
292 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_RAW_INT
, (const char *)packet
, MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);
300 // MESSAGE GPS_RAW_INT UNPACKING
304 * @brief Get field time_usec from gps_raw_int message
306 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
308 static inline uint64_t mavlink_msg_gps_raw_int_get_time_usec(const mavlink_message_t
* msg
)
310 return _MAV_RETURN_uint64_t(msg
, 0);
314 * @brief Get field fix_type from gps_raw_int message
316 * @return 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.
318 static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t
* msg
)
320 return _MAV_RETURN_uint8_t(msg
, 28);
324 * @brief Get field lat from gps_raw_int message
326 * @return Latitude (WGS84), in degrees * 1E7
328 static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t
* msg
)
330 return _MAV_RETURN_int32_t(msg
, 8);
334 * @brief Get field lon from gps_raw_int message
336 * @return Longitude (WGS84), in degrees * 1E7
338 static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t
* msg
)
340 return _MAV_RETURN_int32_t(msg
, 12);
344 * @brief Get field alt from gps_raw_int message
346 * @return 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.
348 static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t
* msg
)
350 return _MAV_RETURN_int32_t(msg
, 16);
354 * @brief Get field eph from gps_raw_int message
356 * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
358 static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t
* msg
)
360 return _MAV_RETURN_uint16_t(msg
, 20);
364 * @brief Get field epv from gps_raw_int message
366 * @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
368 static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t
* msg
)
370 return _MAV_RETURN_uint16_t(msg
, 22);
374 * @brief Get field vel from gps_raw_int message
376 * @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
378 static inline uint16_t mavlink_msg_gps_raw_int_get_vel(const mavlink_message_t
* msg
)
380 return _MAV_RETURN_uint16_t(msg
, 24);
384 * @brief Get field cog from gps_raw_int message
386 * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
388 static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t
* msg
)
390 return _MAV_RETURN_uint16_t(msg
, 26);
394 * @brief Get field satellites_visible from gps_raw_int message
396 * @return Number of satellites visible. If unknown, set to 255
398 static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t
* msg
)
400 return _MAV_RETURN_uint8_t(msg
, 29);
404 * @brief Decode a gps_raw_int message into a struct
406 * @param msg The message to decode
407 * @param gps_raw_int C-struct to decode the message contents into
409 static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t
* msg
, mavlink_gps_raw_int_t
* gps_raw_int
)
411 #if MAVLINK_NEED_BYTE_SWAP
412 gps_raw_int
->time_usec
= mavlink_msg_gps_raw_int_get_time_usec(msg
);
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
);
420 gps_raw_int
->fix_type
= mavlink_msg_gps_raw_int_get_fix_type(msg
);
421 gps_raw_int
->satellites_visible
= mavlink_msg_gps_raw_int_get_satellites_visible(msg
);
423 memcpy(gps_raw_int
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_GPS_RAW_INT_LEN
);