Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE GLOBAL_POSITION_INT PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT 33 |
||
4 | |||
5 | typedef struct __mavlink_global_position_int_t |
||
6 | { |
||
7 | uint32_t time_boot_ms; ///< Timestamp (milliseconds since system boot) |
||
8 | int32_t lat; ///< Latitude, expressed as * 1E7 |
||
9 | int32_t lon; ///< Longitude, expressed as * 1E7 |
||
10 | int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters), above MSL |
||
11 | int32_t relative_alt; ///< Altitude above ground in meters, expressed as * 1000 (millimeters) |
||
12 | int16_t vx; ///< Ground X Speed (Latitude), expressed as m/s * 100 |
||
13 | int16_t vy; ///< Ground Y Speed (Longitude), expressed as m/s * 100 |
||
14 | int16_t vz; ///< Ground Z Speed (Altitude), expressed as m/s * 100 |
||
15 | uint16_t hdg; ///< Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
||
16 | } mavlink_global_position_int_t; |
||
17 | |||
18 | #define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 28 |
||
19 | #define MAVLINK_MSG_ID_33_LEN 28 |
||
20 | |||
21 | |||
22 | |||
23 | #define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT { \ |
||
24 | "GLOBAL_POSITION_INT", \ |
||
25 | 9, \ |
||
26 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) }, \ |
||
27 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) }, \ |
||
28 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) }, \ |
||
29 | { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) }, \ |
||
30 | { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) }, \ |
||
31 | { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) }, \ |
||
32 | { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) }, \ |
||
33 | { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) }, \ |
||
34 | { "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) }, \ |
||
35 | } \ |
||
36 | } |
||
37 | |||
38 | |||
39 | /** |
||
40 | * @brief Pack a global_position_int message |
||
41 | * @param system_id ID of this system |
||
42 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
43 | * @param msg The MAVLink message to compress the data into |
||
44 | * |
||
45 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
||
46 | * @param lat Latitude, expressed as * 1E7 |
||
47 | * @param lon Longitude, expressed as * 1E7 |
||
48 | * @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL |
||
49 | * @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters) |
||
50 | * @param vx Ground X Speed (Latitude), expressed as m/s * 100 |
||
51 | * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 |
||
52 | * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 |
||
53 | * @param hdg Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
||
54 | * @return length of the message in bytes (excluding serial stream start sign) |
||
55 | */ |
||
56 | static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
57 | 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) |
||
58 | { |
||
59 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
60 | char buf[28]; |
||
61 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
||
62 | _mav_put_int32_t(buf, 4, lat); |
||
63 | _mav_put_int32_t(buf, 8, lon); |
||
64 | _mav_put_int32_t(buf, 12, alt); |
||
65 | _mav_put_int32_t(buf, 16, relative_alt); |
||
66 | _mav_put_int16_t(buf, 20, vx); |
||
67 | _mav_put_int16_t(buf, 22, vy); |
||
68 | _mav_put_int16_t(buf, 24, vz); |
||
69 | _mav_put_uint16_t(buf, 26, hdg); |
||
70 | |||
71 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 28); |
||
72 | #else |
||
73 | mavlink_global_position_int_t packet; |
||
74 | packet.time_boot_ms = time_boot_ms; |
||
75 | packet.lat = lat; |
||
76 | packet.lon = lon; |
||
77 | packet.alt = alt; |
||
78 | packet.relative_alt = relative_alt; |
||
79 | packet.vx = vx; |
||
80 | packet.vy = vy; |
||
81 | packet.vz = vz; |
||
82 | packet.hdg = hdg; |
||
83 | |||
84 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 28); |
||
85 | #endif |
||
86 | |||
87 | msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; |
||
88 | return mavlink_finalize_message(msg, system_id, component_id, 28, 104); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @brief Pack a global_position_int message on a channel |
||
93 | * @param system_id ID of this system |
||
94 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
95 | * @param chan The MAVLink channel this message was sent over |
||
96 | * @param msg The MAVLink message to compress the data into |
||
97 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
||
98 | * @param lat Latitude, expressed as * 1E7 |
||
99 | * @param lon Longitude, expressed as * 1E7 |
||
100 | * @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL |
||
101 | * @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters) |
||
102 | * @param vx Ground X Speed (Latitude), expressed as m/s * 100 |
||
103 | * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 |
||
104 | * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 |
||
105 | * @param hdg Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
||
106 | * @return length of the message in bytes (excluding serial stream start sign) |
||
107 | */ |
||
108 | static inline uint16_t mavlink_msg_global_position_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
109 | mavlink_message_t* msg, |
||
110 | 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) |
||
111 | { |
||
112 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
113 | char buf[28]; |
||
114 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
||
115 | _mav_put_int32_t(buf, 4, lat); |
||
116 | _mav_put_int32_t(buf, 8, lon); |
||
117 | _mav_put_int32_t(buf, 12, alt); |
||
118 | _mav_put_int32_t(buf, 16, relative_alt); |
||
119 | _mav_put_int16_t(buf, 20, vx); |
||
120 | _mav_put_int16_t(buf, 22, vy); |
||
121 | _mav_put_int16_t(buf, 24, vz); |
||
122 | _mav_put_uint16_t(buf, 26, hdg); |
||
123 | |||
124 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 28); |
||
125 | #else |
||
126 | mavlink_global_position_int_t packet; |
||
127 | packet.time_boot_ms = time_boot_ms; |
||
128 | packet.lat = lat; |
||
129 | packet.lon = lon; |
||
130 | packet.alt = alt; |
||
131 | packet.relative_alt = relative_alt; |
||
132 | packet.vx = vx; |
||
133 | packet.vy = vy; |
||
134 | packet.vz = vz; |
||
135 | packet.hdg = hdg; |
||
136 | |||
137 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 28); |
||
138 | #endif |
||
139 | |||
140 | msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; |
||
141 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 28, 104); |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * @brief Encode a global_position_int struct into a message |
||
146 | * |
||
147 | * @param system_id ID of this system |
||
148 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
149 | * @param msg The MAVLink message to compress the data into |
||
150 | * @param global_position_int C-struct to read the message contents from |
||
151 | */ |
||
152 | 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) |
||
153 | { |
||
154 | 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); |
||
155 | } |
||
156 | |||
157 | /** |
||
158 | * @brief Send a global_position_int message |
||
159 | * @param chan MAVLink channel to send the message |
||
160 | * |
||
161 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
||
162 | * @param lat Latitude, expressed as * 1E7 |
||
163 | * @param lon Longitude, expressed as * 1E7 |
||
164 | * @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL |
||
165 | * @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters) |
||
166 | * @param vx Ground X Speed (Latitude), expressed as m/s * 100 |
||
167 | * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 |
||
168 | * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 |
||
169 | * @param hdg Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
||
170 | */ |
||
171 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
172 | |||
173 | 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) |
||
174 | { |
||
175 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
176 | char buf[28]; |
||
177 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
||
178 | _mav_put_int32_t(buf, 4, lat); |
||
179 | _mav_put_int32_t(buf, 8, lon); |
||
180 | _mav_put_int32_t(buf, 12, alt); |
||
181 | _mav_put_int32_t(buf, 16, relative_alt); |
||
182 | _mav_put_int16_t(buf, 20, vx); |
||
183 | _mav_put_int16_t(buf, 22, vy); |
||
184 | _mav_put_int16_t(buf, 24, vz); |
||
185 | _mav_put_uint16_t(buf, 26, hdg); |
||
186 | |||
187 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, 28, 104); |
||
188 | #else |
||
189 | mavlink_global_position_int_t packet; |
||
190 | packet.time_boot_ms = time_boot_ms; |
||
191 | packet.lat = lat; |
||
192 | packet.lon = lon; |
||
193 | packet.alt = alt; |
||
194 | packet.relative_alt = relative_alt; |
||
195 | packet.vx = vx; |
||
196 | packet.vy = vy; |
||
197 | packet.vz = vz; |
||
198 | packet.hdg = hdg; |
||
199 | |||
200 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, 28, 104); |
||
201 | #endif |
||
202 | } |
||
203 | |||
204 | #endif |
||
205 | |||
206 | // MESSAGE GLOBAL_POSITION_INT UNPACKING |
||
207 | |||
208 | |||
209 | /** |
||
210 | * @brief Get field time_boot_ms from global_position_int message |
||
211 | * |
||
212 | * @return Timestamp (milliseconds since system boot) |
||
213 | */ |
||
214 | static inline uint32_t mavlink_msg_global_position_int_get_time_boot_ms(const mavlink_message_t* msg) |
||
215 | { |
||
216 | return _MAV_RETURN_uint32_t(msg, 0); |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * @brief Get field lat from global_position_int message |
||
221 | * |
||
222 | * @return Latitude, expressed as * 1E7 |
||
223 | */ |
||
224 | static inline int32_t mavlink_msg_global_position_int_get_lat(const mavlink_message_t* msg) |
||
225 | { |
||
226 | return _MAV_RETURN_int32_t(msg, 4); |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * @brief Get field lon from global_position_int message |
||
231 | * |
||
232 | * @return Longitude, expressed as * 1E7 |
||
233 | */ |
||
234 | static inline int32_t mavlink_msg_global_position_int_get_lon(const mavlink_message_t* msg) |
||
235 | { |
||
236 | return _MAV_RETURN_int32_t(msg, 8); |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * @brief Get field alt from global_position_int message |
||
241 | * |
||
242 | * @return Altitude in meters, expressed as * 1000 (millimeters), above MSL |
||
243 | */ |
||
244 | static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_message_t* msg) |
||
245 | { |
||
246 | return _MAV_RETURN_int32_t(msg, 12); |
||
247 | } |
||
248 | |||
249 | /** |
||
250 | * @brief Get field relative_alt from global_position_int message |
||
251 | * |
||
252 | * @return Altitude above ground in meters, expressed as * 1000 (millimeters) |
||
253 | */ |
||
254 | static inline int32_t mavlink_msg_global_position_int_get_relative_alt(const mavlink_message_t* msg) |
||
255 | { |
||
256 | return _MAV_RETURN_int32_t(msg, 16); |
||
257 | } |
||
258 | |||
259 | /** |
||
260 | * @brief Get field vx from global_position_int message |
||
261 | * |
||
262 | * @return Ground X Speed (Latitude), expressed as m/s * 100 |
||
263 | */ |
||
264 | static inline int16_t mavlink_msg_global_position_int_get_vx(const mavlink_message_t* msg) |
||
265 | { |
||
266 | return _MAV_RETURN_int16_t(msg, 20); |
||
267 | } |
||
268 | |||
269 | /** |
||
270 | * @brief Get field vy from global_position_int message |
||
271 | * |
||
272 | * @return Ground Y Speed (Longitude), expressed as m/s * 100 |
||
273 | */ |
||
274 | static inline int16_t mavlink_msg_global_position_int_get_vy(const mavlink_message_t* msg) |
||
275 | { |
||
276 | return _MAV_RETURN_int16_t(msg, 22); |
||
277 | } |
||
278 | |||
279 | /** |
||
280 | * @brief Get field vz from global_position_int message |
||
281 | * |
||
282 | * @return Ground Z Speed (Altitude), expressed as m/s * 100 |
||
283 | */ |
||
284 | static inline int16_t mavlink_msg_global_position_int_get_vz(const mavlink_message_t* msg) |
||
285 | { |
||
286 | return _MAV_RETURN_int16_t(msg, 24); |
||
287 | } |
||
288 | |||
289 | /** |
||
290 | * @brief Get field hdg from global_position_int message |
||
291 | * |
||
292 | * @return Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 |
||
293 | */ |
||
294 | static inline uint16_t mavlink_msg_global_position_int_get_hdg(const mavlink_message_t* msg) |
||
295 | { |
||
296 | return _MAV_RETURN_uint16_t(msg, 26); |
||
297 | } |
||
298 | |||
299 | /** |
||
300 | * @brief Decode a global_position_int message into a struct |
||
301 | * |
||
302 | * @param msg The message to decode |
||
303 | * @param global_position_int C-struct to decode the message contents into |
||
304 | */ |
||
305 | static inline void mavlink_msg_global_position_int_decode(const mavlink_message_t* msg, mavlink_global_position_int_t* global_position_int) |
||
306 | { |
||
307 | #if MAVLINK_NEED_BYTE_SWAP |
||
308 | global_position_int->time_boot_ms = mavlink_msg_global_position_int_get_time_boot_ms(msg); |
||
309 | global_position_int->lat = mavlink_msg_global_position_int_get_lat(msg); |
||
310 | global_position_int->lon = mavlink_msg_global_position_int_get_lon(msg); |
||
311 | global_position_int->alt = mavlink_msg_global_position_int_get_alt(msg); |
||
312 | global_position_int->relative_alt = mavlink_msg_global_position_int_get_relative_alt(msg); |
||
313 | global_position_int->vx = mavlink_msg_global_position_int_get_vx(msg); |
||
314 | global_position_int->vy = mavlink_msg_global_position_int_get_vy(msg); |
||
315 | global_position_int->vz = mavlink_msg_global_position_int_get_vz(msg); |
||
316 | global_position_int->hdg = mavlink_msg_global_position_int_get_hdg(msg); |
||
317 | #else |
||
318 | memcpy(global_position_int, _MAV_PAYLOAD(msg), 28); |
||
319 | #endif |
||
320 | } |