Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_global_position_int.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GLOBAL_POSITION_INT PACKING
3
4#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT 33
5
6
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 int32_t lat; /*< [degE7] Latitude, expressed*/
10 int32_t lon; /*< [degE7] Longitude, expressed*/
11 int32_t alt; /*< [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.*/
12 int32_t relative_alt; /*< [mm] Altitude above home*/
13 int16_t vx; /*< [cm/s] Ground X Speed (Latitude, positive north)*/
14 int16_t vy; /*< [cm/s] Ground Y Speed (Longitude, positive east)*/
15 int16_t vz; /*< [cm/s] Ground Z Speed (Altitude, positive down)*/
16 uint16_t hdg; /*< [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
17} mavlink_global_position_int_t;
18
19#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 28
20#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN 28
21#define MAVLINK_MSG_ID_33_LEN 28
22#define MAVLINK_MSG_ID_33_MIN_LEN 28
23
24#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC 104
25#define MAVLINK_MSG_ID_33_CRC 104
26
27
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT {
31 33,
32 "GLOBAL_POSITION_INT",
33 9,
34 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) },
35 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) },
36 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) },
37 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) },
38 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) },
39 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) },
40 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) },
41 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) },
42 { "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) },
43 } \
44}
45#else
46#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT {
47 "GLOBAL_POSITION_INT",
48 9,
49 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) },
50 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) },
51 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) },
52 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) },
53 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) },
54 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) },
55 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) },
56 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) },
57 { "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) },
58 } \
59}
60#endif
61
62/**
63 * @brief Pack a global_position_int message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
67 *
68 * @param time_boot_ms [ms] Timestamp (time since system boot).
69 * @param lat [degE7] Latitude, expressed
70 * @param lon [degE7] Longitude, expressed
71 * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.
72 * @param relative_alt [mm] Altitude above home
73 * @param vx [cm/s] Ground X Speed (Latitude, positive north)
74 * @param vy [cm/s] Ground Y Speed (Longitude, positive east)
75 * @param vz [cm/s] Ground Z Speed (Altitude, positive down)
76 * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
77 * @return length of the message in bytes (excluding serial stream start sign)
78 */
79static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
80 uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
81{
82#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
84 _mav_put_uint32_t(buf, 0, time_boot_ms);
85 _mav_put_int32_t(buf, 4, lat);
86 _mav_put_int32_t(buf, 8, lon);
87 _mav_put_int32_t(buf, 12, alt);
88 _mav_put_int32_t(buf, 16, relative_alt);
89 _mav_put_int16_t(buf, 20, vx);
90 _mav_put_int16_t(buf, 22, vy);
91 _mav_put_int16_t(buf, 24, vz);
92 _mav_put_uint16_t(buf, 26, hdg);
93
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
95#else
96 mavlink_global_position_int_t packet;
97 packet.time_boot_ms = time_boot_ms;
98 packet.lat = lat;
99 packet.lon = lon;
100 packet.alt = alt;
101 packet.relative_alt = relative_alt;
102 packet.vx = vx;
103 packet.vy = vy;
104 packet.vz = vz;
105 packet.hdg = hdg;
106
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
108#endif
109
112}
113
114/**
115 * @brief Pack a global_position_int message
116 * @param system_id ID of this system
117 * @param component_id ID of this component (e.g. 200 for IMU)
118 * @param status MAVLink status structure
119 * @param msg The MAVLink message to compress the data into
120 *
121 * @param time_boot_ms [ms] Timestamp (time since system boot).
122 * @param lat [degE7] Latitude, expressed
123 * @param lon [degE7] Longitude, expressed
124 * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.
125 * @param relative_alt [mm] Altitude above home
126 * @param vx [cm/s] Ground X Speed (Latitude, positive north)
127 * @param vy [cm/s] Ground Y Speed (Longitude, positive east)
128 * @param vz [cm/s] Ground Z Speed (Altitude, positive down)
129 * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
130 * @return length of the message in bytes (excluding serial stream start sign)
131 */
132static inline uint16_t mavlink_msg_global_position_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
133 uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
134{
135#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
137 _mav_put_uint32_t(buf, 0, time_boot_ms);
138 _mav_put_int32_t(buf, 4, lat);
139 _mav_put_int32_t(buf, 8, lon);
140 _mav_put_int32_t(buf, 12, alt);
141 _mav_put_int32_t(buf, 16, relative_alt);
142 _mav_put_int16_t(buf, 20, vx);
143 _mav_put_int16_t(buf, 22, vy);
144 _mav_put_int16_t(buf, 24, vz);
145 _mav_put_uint16_t(buf, 26, hdg);
146
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
148#else
149 mavlink_global_position_int_t packet;
150 packet.time_boot_ms = time_boot_ms;
151 packet.lat = lat;
152 packet.lon = lon;
153 packet.alt = alt;
154 packet.relative_alt = relative_alt;
155 packet.vx = vx;
156 packet.vy = vy;
157 packet.vz = vz;
158 packet.hdg = hdg;
159
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
161#endif
162
164#if MAVLINK_CRC_EXTRA
165 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
166#else
167 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
168#endif
169}
170
171/**
172 * @brief Pack a global_position_int message on a channel
173 * @param system_id ID of this system
174 * @param component_id ID of this component (e.g. 200 for IMU)
175 * @param chan The MAVLink channel this message will be sent over
176 * @param msg The MAVLink message to compress the data into
177 * @param time_boot_ms [ms] Timestamp (time since system boot).
178 * @param lat [degE7] Latitude, expressed
179 * @param lon [degE7] Longitude, expressed
180 * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.
181 * @param relative_alt [mm] Altitude above home
182 * @param vx [cm/s] Ground X Speed (Latitude, positive north)
183 * @param vy [cm/s] Ground Y Speed (Longitude, positive east)
184 * @param vz [cm/s] Ground Z Speed (Altitude, positive down)
185 * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
186 * @return length of the message in bytes (excluding serial stream start sign)
187 */
188static inline uint16_t mavlink_msg_global_position_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
189 mavlink_message_t* msg,
190 uint32_t time_boot_ms,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,int16_t vx,int16_t vy,int16_t vz,uint16_t hdg)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
194 _mav_put_uint32_t(buf, 0, time_boot_ms);
195 _mav_put_int32_t(buf, 4, lat);
196 _mav_put_int32_t(buf, 8, lon);
197 _mav_put_int32_t(buf, 12, alt);
198 _mav_put_int32_t(buf, 16, relative_alt);
199 _mav_put_int16_t(buf, 20, vx);
200 _mav_put_int16_t(buf, 22, vy);
201 _mav_put_int16_t(buf, 24, vz);
202 _mav_put_uint16_t(buf, 26, hdg);
203
204 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
205#else
206 mavlink_global_position_int_t packet;
207 packet.time_boot_ms = time_boot_ms;
208 packet.lat = lat;
209 packet.lon = lon;
210 packet.alt = alt;
211 packet.relative_alt = relative_alt;
212 packet.vx = vx;
213 packet.vy = vy;
214 packet.vz = vz;
215 packet.hdg = hdg;
216
217 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
218#endif
219
221 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
222}
223
224/**
225 * @brief Encode a global_position_int struct
226 *
227 * @param system_id ID of this system
228 * @param component_id ID of this component (e.g. 200 for IMU)
229 * @param msg The MAVLink message to compress the data into
230 * @param global_position_int C-struct to read the message contents from
231 */
232static inline uint16_t mavlink_msg_global_position_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
233{
234 return mavlink_msg_global_position_int_pack(system_id, component_id, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
235}
236
237/**
238 * @brief Encode a global_position_int struct on a channel
239 *
240 * @param system_id ID of this system
241 * @param component_id ID of this component (e.g. 200 for IMU)
242 * @param chan The MAVLink channel this message will be sent over
243 * @param msg The MAVLink message to compress the data into
244 * @param global_position_int C-struct to read the message contents from
245 */
246static inline uint16_t mavlink_msg_global_position_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
247{
248 return mavlink_msg_global_position_int_pack_chan(system_id, component_id, chan, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
249}
250
251/**
252 * @brief Encode a global_position_int struct with provided status structure
253 *
254 * @param system_id ID of this system
255 * @param component_id ID of this component (e.g. 200 for IMU)
256 * @param status MAVLink status structure
257 * @param msg The MAVLink message to compress the data into
258 * @param global_position_int C-struct to read the message contents from
259 */
260static inline uint16_t mavlink_msg_global_position_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
261{
262 return mavlink_msg_global_position_int_pack_status(system_id, component_id, _status, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
263}
264
265/**
266 * @brief Send a global_position_int message
267 * @param chan MAVLink channel to send the message
268 *
269 * @param time_boot_ms [ms] Timestamp (time since system boot).
270 * @param lat [degE7] Latitude, expressed
271 * @param lon [degE7] Longitude, expressed
272 * @param alt [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.
273 * @param relative_alt [mm] Altitude above home
274 * @param vx [cm/s] Ground X Speed (Latitude, positive north)
275 * @param vy [cm/s] Ground Y Speed (Longitude, positive east)
276 * @param vz [cm/s] Ground Z Speed (Altitude, positive down)
277 * @param hdg [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
278 */
279#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
280
281static inline void mavlink_msg_global_position_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
282{
283#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN];
285 _mav_put_uint32_t(buf, 0, time_boot_ms);
286 _mav_put_int32_t(buf, 4, lat);
287 _mav_put_int32_t(buf, 8, lon);
288 _mav_put_int32_t(buf, 12, alt);
289 _mav_put_int32_t(buf, 16, relative_alt);
290 _mav_put_int16_t(buf, 20, vx);
291 _mav_put_int16_t(buf, 22, vy);
292 _mav_put_int16_t(buf, 24, vz);
293 _mav_put_uint16_t(buf, 26, hdg);
294
295 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
296#else
297 mavlink_global_position_int_t packet;
298 packet.time_boot_ms = time_boot_ms;
299 packet.lat = lat;
300 packet.lon = lon;
301 packet.alt = alt;
302 packet.relative_alt = relative_alt;
303 packet.vx = vx;
304 packet.vy = vy;
305 packet.vz = vz;
306 packet.hdg = hdg;
307
308 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
309#endif
310}
311
312/**
313 * @brief Send a global_position_int message
314 * @param chan MAVLink channel to send the message
315 * @param struct The MAVLink struct to serialize
316 */
317static inline void mavlink_msg_global_position_int_send_struct(mavlink_channel_t chan, const mavlink_global_position_int_t* global_position_int)
318{
319#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
320 mavlink_msg_global_position_int_send(chan, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
321#else
322 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)global_position_int, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
323#endif
324}
325
326#if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
327/*
328 This variant of _send() can be used to save stack space by reusing
329 memory from the receive buffer. The caller provides a
330 mavlink_message_t which is the size of a full mavlink message. This
331 is usually the receive buffer for the channel, and allows a reply to an
332 incoming message with minimum stack space usage.
333 */
334static inline void mavlink_msg_global_position_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
335{
336#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
337 char *buf = (char *)msgbuf;
338 _mav_put_uint32_t(buf, 0, time_boot_ms);
339 _mav_put_int32_t(buf, 4, lat);
340 _mav_put_int32_t(buf, 8, lon);
341 _mav_put_int32_t(buf, 12, alt);
342 _mav_put_int32_t(buf, 16, relative_alt);
343 _mav_put_int16_t(buf, 20, vx);
344 _mav_put_int16_t(buf, 22, vy);
345 _mav_put_int16_t(buf, 24, vz);
346 _mav_put_uint16_t(buf, 26, hdg);
347
348 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
349#else
350 mavlink_global_position_int_t *packet = (mavlink_global_position_int_t *)msgbuf;
351 packet->time_boot_ms = time_boot_ms;
352 packet->lat = lat;
353 packet->lon = lon;
354 packet->alt = alt;
355 packet->relative_alt = relative_alt;
356 packet->vx = vx;
357 packet->vy = vy;
358 packet->vz = vz;
359 packet->hdg = hdg;
360
361 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
362#endif
363}
364#endif
365
366#endif
367
368// MESSAGE GLOBAL_POSITION_INT UNPACKING
369
370
371/**
372 * @brief Get field time_boot_ms from global_position_int message
373 *
374 * @return [ms] Timestamp (time since system boot).
375 */
376static inline uint32_t mavlink_msg_global_position_int_get_time_boot_ms(const mavlink_message_t* msg)
377{
378 return _MAV_RETURN_uint32_t(msg, 0);
379}
380
381/**
382 * @brief Get field lat from global_position_int message
383 *
384 * @return [degE7] Latitude, expressed
385 */
386static inline int32_t mavlink_msg_global_position_int_get_lat(const mavlink_message_t* msg)
387{
388 return _MAV_RETURN_int32_t(msg, 4);
389}
390
391/**
392 * @brief Get field lon from global_position_int message
393 *
394 * @return [degE7] Longitude, expressed
395 */
396static inline int32_t mavlink_msg_global_position_int_get_lon(const mavlink_message_t* msg)
397{
398 return _MAV_RETURN_int32_t(msg, 8);
399}
400
401/**
402 * @brief Get field alt from global_position_int message
403 *
404 * @return [mm] Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL.
405 */
406static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_message_t* msg)
407{
408 return _MAV_RETURN_int32_t(msg, 12);
409}
410
411/**
412 * @brief Get field relative_alt from global_position_int message
413 *
414 * @return [mm] Altitude above home
415 */
416static inline int32_t mavlink_msg_global_position_int_get_relative_alt(const mavlink_message_t* msg)
417{
418 return _MAV_RETURN_int32_t(msg, 16);
419}
420
421/**
422 * @brief Get field vx from global_position_int message
423 *
424 * @return [cm/s] Ground X Speed (Latitude, positive north)
425 */
426static inline int16_t mavlink_msg_global_position_int_get_vx(const mavlink_message_t* msg)
427{
428 return _MAV_RETURN_int16_t(msg, 20);
429}
430
431/**
432 * @brief Get field vy from global_position_int message
433 *
434 * @return [cm/s] Ground Y Speed (Longitude, positive east)
435 */
436static inline int16_t mavlink_msg_global_position_int_get_vy(const mavlink_message_t* msg)
437{
438 return _MAV_RETURN_int16_t(msg, 22);
439}
440
441/**
442 * @brief Get field vz from global_position_int message
443 *
444 * @return [cm/s] Ground Z Speed (Altitude, positive down)
445 */
446static inline int16_t mavlink_msg_global_position_int_get_vz(const mavlink_message_t* msg)
447{
448 return _MAV_RETURN_int16_t(msg, 24);
449}
450
451/**
452 * @brief Get field hdg from global_position_int message
453 *
454 * @return [cdeg] Vehicle heading (yaw angle), 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
455 */
456static inline uint16_t mavlink_msg_global_position_int_get_hdg(const mavlink_message_t* msg)
457{
458 return _MAV_RETURN_uint16_t(msg, 26);
459}
460
461/**
462 * @brief Decode a global_position_int message into a struct
463 *
464 * @param msg The message to decode
465 * @param global_position_int C-struct to decode the message contents into
466 */
467static inline void mavlink_msg_global_position_int_decode(const mavlink_message_t* msg, mavlink_global_position_int_t* global_position_int)
468{
469#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
470 global_position_int->time_boot_ms = mavlink_msg_global_position_int_get_time_boot_ms(msg);
471 global_position_int->lat = mavlink_msg_global_position_int_get_lat(msg);
472 global_position_int->lon = mavlink_msg_global_position_int_get_lon(msg);
473 global_position_int->alt = mavlink_msg_global_position_int_get_alt(msg);
474 global_position_int->relative_alt = mavlink_msg_global_position_int_get_relative_alt(msg);
475 global_position_int->vx = mavlink_msg_global_position_int_get_vx(msg);
476 global_position_int->vy = mavlink_msg_global_position_int_get_vy(msg);
477 global_position_int->vz = mavlink_msg_global_position_int_get_vz(msg);
478 global_position_int->hdg = mavlink_msg_global_position_int_get_hdg(msg);
479#else
480 uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN;
481 memset(global_position_int, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
482 memcpy(global_position_int, _MAV_PAYLOAD(msg), len);
483#endif
484}