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