Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_utm_global_position.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE UTM_GLOBAL_POSITION PACKING
3
4#define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION 340
5
6
8 uint64_t time; /*< [us] Time of applicability of position (microseconds since UNIX epoch).*/
9 int32_t lat; /*< [degE7] Latitude (WGS84)*/
10 int32_t lon; /*< [degE7] Longitude (WGS84)*/
11 int32_t alt; /*< [mm] Altitude (WGS84)*/
12 int32_t relative_alt; /*< [mm] Altitude above ground*/
13 int32_t next_lat; /*< [degE7] Next waypoint, latitude (WGS84)*/
14 int32_t next_lon; /*< [degE7] Next waypoint, longitude (WGS84)*/
15 int32_t next_alt; /*< [mm] Next waypoint, altitude (WGS84)*/
16 int16_t vx; /*< [cm/s] Ground X speed (latitude, positive north)*/
17 int16_t vy; /*< [cm/s] Ground Y speed (longitude, positive east)*/
18 int16_t vz; /*< [cm/s] Ground Z speed (altitude, positive down)*/
19 uint16_t h_acc; /*< [mm] Horizontal position uncertainty (standard deviation)*/
20 uint16_t v_acc; /*< [mm] Altitude uncertainty (standard deviation)*/
21 uint16_t vel_acc; /*< [cm/s] Speed uncertainty (standard deviation)*/
22 uint16_t update_rate; /*< [cs] Time until next update. Set to 0 if unknown or in data driven mode.*/
23 uint8_t uas_id[18]; /*< Unique UAS ID.*/
24 uint8_t flight_state; /*< Flight state*/
25 uint8_t flags; /*< Bitwise OR combination of the data available flags.*/
26} mavlink_utm_global_position_t;
27
28#define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN 70
29#define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN 70
30#define MAVLINK_MSG_ID_340_LEN 70
31#define MAVLINK_MSG_ID_340_MIN_LEN 70
32
33#define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC 99
34#define MAVLINK_MSG_ID_340_CRC 99
35
36#define MAVLINK_MSG_UTM_GLOBAL_POSITION_FIELD_UAS_ID_LEN 18
37
38#if MAVLINK_COMMAND_24BIT
39#define MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION {
40 340,
41 "UTM_GLOBAL_POSITION",
42 18,
43 { { "time", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_utm_global_position_t, time) },
44 { "uas_id", NULL, MAVLINK_TYPE_UINT8_T, 18, 50, offsetof(mavlink_utm_global_position_t, uas_id) },
45 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_utm_global_position_t, lat) },
46 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_utm_global_position_t, lon) },
47 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_utm_global_position_t, alt) },
48 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_utm_global_position_t, relative_alt) },
49 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_utm_global_position_t, vx) },
50 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_utm_global_position_t, vy) },
51 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_utm_global_position_t, vz) },
52 { "h_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_utm_global_position_t, h_acc) },
53 { "v_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 44, offsetof(mavlink_utm_global_position_t, v_acc) },
54 { "vel_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 46, offsetof(mavlink_utm_global_position_t, vel_acc) },
55 { "next_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_utm_global_position_t, next_lat) },
56 { "next_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_utm_global_position_t, next_lon) },
57 { "next_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_utm_global_position_t, next_alt) },
58 { "update_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_utm_global_position_t, update_rate) },
59 { "flight_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_utm_global_position_t, flight_state) },
60 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 69, offsetof(mavlink_utm_global_position_t, flags) },
61 } \
62}
63#else
64#define MAVLINK_MESSAGE_INFO_UTM_GLOBAL_POSITION {
65 "UTM_GLOBAL_POSITION",
66 18,
67 { { "time", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_utm_global_position_t, time) },
68 { "uas_id", NULL, MAVLINK_TYPE_UINT8_T, 18, 50, offsetof(mavlink_utm_global_position_t, uas_id) },
69 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_utm_global_position_t, lat) },
70 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_utm_global_position_t, lon) },
71 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_utm_global_position_t, alt) },
72 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_utm_global_position_t, relative_alt) },
73 { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 36, offsetof(mavlink_utm_global_position_t, vx) },
74 { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 38, offsetof(mavlink_utm_global_position_t, vy) },
75 { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_utm_global_position_t, vz) },
76 { "h_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 42, offsetof(mavlink_utm_global_position_t, h_acc) },
77 { "v_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 44, offsetof(mavlink_utm_global_position_t, v_acc) },
78 { "vel_acc", NULL, MAVLINK_TYPE_UINT16_T, 0, 46, offsetof(mavlink_utm_global_position_t, vel_acc) },
79 { "next_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_utm_global_position_t, next_lat) },
80 { "next_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 28, offsetof(mavlink_utm_global_position_t, next_lon) },
81 { "next_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_utm_global_position_t, next_alt) },
82 { "update_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_utm_global_position_t, update_rate) },
83 { "flight_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 68, offsetof(mavlink_utm_global_position_t, flight_state) },
84 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 69, offsetof(mavlink_utm_global_position_t, flags) },
85 } \
86}
87#endif
88
89/**
90 * @brief Pack a utm_global_position message
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param msg The MAVLink message to compress the data into
94 *
95 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
96 * @param uas_id Unique UAS ID.
97 * @param lat [degE7] Latitude (WGS84)
98 * @param lon [degE7] Longitude (WGS84)
99 * @param alt [mm] Altitude (WGS84)
100 * @param relative_alt [mm] Altitude above ground
101 * @param vx [cm/s] Ground X speed (latitude, positive north)
102 * @param vy [cm/s] Ground Y speed (longitude, positive east)
103 * @param vz [cm/s] Ground Z speed (altitude, positive down)
104 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
105 * @param v_acc [mm] Altitude uncertainty (standard deviation)
106 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
107 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
108 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
109 * @param next_alt [mm] Next waypoint, altitude (WGS84)
110 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
111 * @param flight_state Flight state
112 * @param flags Bitwise OR combination of the data available flags.
113 * @return length of the message in bytes (excluding serial stream start sign)
114 */
115static inline uint16_t mavlink_msg_utm_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
116 uint64_t time, const uint8_t *uas_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t h_acc, uint16_t v_acc, uint16_t vel_acc, int32_t next_lat, int32_t next_lon, int32_t next_alt, uint16_t update_rate, uint8_t flight_state, uint8_t flags)
117{
118#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
120 _mav_put_uint64_t(buf, 0, time);
121 _mav_put_int32_t(buf, 8, lat);
122 _mav_put_int32_t(buf, 12, lon);
123 _mav_put_int32_t(buf, 16, alt);
124 _mav_put_int32_t(buf, 20, relative_alt);
125 _mav_put_int32_t(buf, 24, next_lat);
126 _mav_put_int32_t(buf, 28, next_lon);
127 _mav_put_int32_t(buf, 32, next_alt);
128 _mav_put_int16_t(buf, 36, vx);
129 _mav_put_int16_t(buf, 38, vy);
130 _mav_put_int16_t(buf, 40, vz);
131 _mav_put_uint16_t(buf, 42, h_acc);
132 _mav_put_uint16_t(buf, 44, v_acc);
133 _mav_put_uint16_t(buf, 46, vel_acc);
134 _mav_put_uint16_t(buf, 48, update_rate);
135 _mav_put_uint8_t(buf, 68, flight_state);
136 _mav_put_uint8_t(buf, 69, flags);
137 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
138 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
139#else
140 mavlink_utm_global_position_t packet;
141 packet.time = time;
142 packet.lat = lat;
143 packet.lon = lon;
144 packet.alt = alt;
145 packet.relative_alt = relative_alt;
146 packet.next_lat = next_lat;
147 packet.next_lon = next_lon;
148 packet.next_alt = next_alt;
149 packet.vx = vx;
150 packet.vy = vy;
151 packet.vz = vz;
152 packet.h_acc = h_acc;
153 packet.v_acc = v_acc;
154 packet.vel_acc = vel_acc;
155 packet.update_rate = update_rate;
156 packet.flight_state = flight_state;
157 packet.flags = flags;
158 mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18);
159 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
160#endif
161
164}
165
166/**
167 * @brief Pack a utm_global_position message
168 * @param system_id ID of this system
169 * @param component_id ID of this component (e.g. 200 for IMU)
170 * @param status MAVLink status structure
171 * @param msg The MAVLink message to compress the data into
172 *
173 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
174 * @param uas_id Unique UAS ID.
175 * @param lat [degE7] Latitude (WGS84)
176 * @param lon [degE7] Longitude (WGS84)
177 * @param alt [mm] Altitude (WGS84)
178 * @param relative_alt [mm] Altitude above ground
179 * @param vx [cm/s] Ground X speed (latitude, positive north)
180 * @param vy [cm/s] Ground Y speed (longitude, positive east)
181 * @param vz [cm/s] Ground Z speed (altitude, positive down)
182 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
183 * @param v_acc [mm] Altitude uncertainty (standard deviation)
184 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
185 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
186 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
187 * @param next_alt [mm] Next waypoint, altitude (WGS84)
188 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
189 * @param flight_state Flight state
190 * @param flags Bitwise OR combination of the data available flags.
191 * @return length of the message in bytes (excluding serial stream start sign)
192 */
193static inline uint16_t mavlink_msg_utm_global_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
194 uint64_t time, const uint8_t *uas_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t h_acc, uint16_t v_acc, uint16_t vel_acc, int32_t next_lat, int32_t next_lon, int32_t next_alt, uint16_t update_rate, uint8_t flight_state, uint8_t flags)
195{
196#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
198 _mav_put_uint64_t(buf, 0, time);
199 _mav_put_int32_t(buf, 8, lat);
200 _mav_put_int32_t(buf, 12, lon);
201 _mav_put_int32_t(buf, 16, alt);
202 _mav_put_int32_t(buf, 20, relative_alt);
203 _mav_put_int32_t(buf, 24, next_lat);
204 _mav_put_int32_t(buf, 28, next_lon);
205 _mav_put_int32_t(buf, 32, next_alt);
206 _mav_put_int16_t(buf, 36, vx);
207 _mav_put_int16_t(buf, 38, vy);
208 _mav_put_int16_t(buf, 40, vz);
209 _mav_put_uint16_t(buf, 42, h_acc);
210 _mav_put_uint16_t(buf, 44, v_acc);
211 _mav_put_uint16_t(buf, 46, vel_acc);
212 _mav_put_uint16_t(buf, 48, update_rate);
213 _mav_put_uint8_t(buf, 68, flight_state);
214 _mav_put_uint8_t(buf, 69, flags);
215 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
216 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
217#else
218 mavlink_utm_global_position_t packet;
219 packet.time = time;
220 packet.lat = lat;
221 packet.lon = lon;
222 packet.alt = alt;
223 packet.relative_alt = relative_alt;
224 packet.next_lat = next_lat;
225 packet.next_lon = next_lon;
226 packet.next_alt = next_alt;
227 packet.vx = vx;
228 packet.vy = vy;
229 packet.vz = vz;
230 packet.h_acc = h_acc;
231 packet.v_acc = v_acc;
232 packet.vel_acc = vel_acc;
233 packet.update_rate = update_rate;
234 packet.flight_state = flight_state;
235 packet.flags = flags;
236 mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18);
237 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
238#endif
239
241#if MAVLINK_CRC_EXTRA
242 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
243#else
244 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
245#endif
246}
247
248/**
249 * @brief Pack a utm_global_position message on a channel
250 * @param system_id ID of this system
251 * @param component_id ID of this component (e.g. 200 for IMU)
252 * @param chan The MAVLink channel this message will be sent over
253 * @param msg The MAVLink message to compress the data into
254 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
255 * @param uas_id Unique UAS ID.
256 * @param lat [degE7] Latitude (WGS84)
257 * @param lon [degE7] Longitude (WGS84)
258 * @param alt [mm] Altitude (WGS84)
259 * @param relative_alt [mm] Altitude above ground
260 * @param vx [cm/s] Ground X speed (latitude, positive north)
261 * @param vy [cm/s] Ground Y speed (longitude, positive east)
262 * @param vz [cm/s] Ground Z speed (altitude, positive down)
263 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
264 * @param v_acc [mm] Altitude uncertainty (standard deviation)
265 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
266 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
267 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
268 * @param next_alt [mm] Next waypoint, altitude (WGS84)
269 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
270 * @param flight_state Flight state
271 * @param flags Bitwise OR combination of the data available flags.
272 * @return length of the message in bytes (excluding serial stream start sign)
273 */
274static inline uint16_t mavlink_msg_utm_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
275 mavlink_message_t* msg,
276 uint64_t time,const uint8_t *uas_id,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,int16_t vx,int16_t vy,int16_t vz,uint16_t h_acc,uint16_t v_acc,uint16_t vel_acc,int32_t next_lat,int32_t next_lon,int32_t next_alt,uint16_t update_rate,uint8_t flight_state,uint8_t flags)
277{
278#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
280 _mav_put_uint64_t(buf, 0, time);
281 _mav_put_int32_t(buf, 8, lat);
282 _mav_put_int32_t(buf, 12, lon);
283 _mav_put_int32_t(buf, 16, alt);
284 _mav_put_int32_t(buf, 20, relative_alt);
285 _mav_put_int32_t(buf, 24, next_lat);
286 _mav_put_int32_t(buf, 28, next_lon);
287 _mav_put_int32_t(buf, 32, next_alt);
288 _mav_put_int16_t(buf, 36, vx);
289 _mav_put_int16_t(buf, 38, vy);
290 _mav_put_int16_t(buf, 40, vz);
291 _mav_put_uint16_t(buf, 42, h_acc);
292 _mav_put_uint16_t(buf, 44, v_acc);
293 _mav_put_uint16_t(buf, 46, vel_acc);
294 _mav_put_uint16_t(buf, 48, update_rate);
295 _mav_put_uint8_t(buf, 68, flight_state);
296 _mav_put_uint8_t(buf, 69, flags);
297 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
298 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
299#else
300 mavlink_utm_global_position_t packet;
301 packet.time = time;
302 packet.lat = lat;
303 packet.lon = lon;
304 packet.alt = alt;
305 packet.relative_alt = relative_alt;
306 packet.next_lat = next_lat;
307 packet.next_lon = next_lon;
308 packet.next_alt = next_alt;
309 packet.vx = vx;
310 packet.vy = vy;
311 packet.vz = vz;
312 packet.h_acc = h_acc;
313 packet.v_acc = v_acc;
314 packet.vel_acc = vel_acc;
315 packet.update_rate = update_rate;
316 packet.flight_state = flight_state;
317 packet.flags = flags;
318 mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18);
319 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
320#endif
321
323 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
324}
325
326/**
327 * @brief Encode a utm_global_position struct
328 *
329 * @param system_id ID of this system
330 * @param component_id ID of this component (e.g. 200 for IMU)
331 * @param msg The MAVLink message to compress the data into
332 * @param utm_global_position C-struct to read the message contents from
333 */
334static inline uint16_t mavlink_msg_utm_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_utm_global_position_t* utm_global_position)
335{
336 return mavlink_msg_utm_global_position_pack(system_id, component_id, msg, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags);
337}
338
339/**
340 * @brief Encode a utm_global_position struct on a channel
341 *
342 * @param system_id ID of this system
343 * @param component_id ID of this component (e.g. 200 for IMU)
344 * @param chan The MAVLink channel this message will be sent over
345 * @param msg The MAVLink message to compress the data into
346 * @param utm_global_position C-struct to read the message contents from
347 */
348static inline uint16_t mavlink_msg_utm_global_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_utm_global_position_t* utm_global_position)
349{
350 return mavlink_msg_utm_global_position_pack_chan(system_id, component_id, chan, msg, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags);
351}
352
353/**
354 * @brief Encode a utm_global_position struct with provided status structure
355 *
356 * @param system_id ID of this system
357 * @param component_id ID of this component (e.g. 200 for IMU)
358 * @param status MAVLink status structure
359 * @param msg The MAVLink message to compress the data into
360 * @param utm_global_position C-struct to read the message contents from
361 */
362static inline uint16_t mavlink_msg_utm_global_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_utm_global_position_t* utm_global_position)
363{
364 return mavlink_msg_utm_global_position_pack_status(system_id, component_id, _status, msg, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags);
365}
366
367/**
368 * @brief Send a utm_global_position message
369 * @param chan MAVLink channel to send the message
370 *
371 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
372 * @param uas_id Unique UAS ID.
373 * @param lat [degE7] Latitude (WGS84)
374 * @param lon [degE7] Longitude (WGS84)
375 * @param alt [mm] Altitude (WGS84)
376 * @param relative_alt [mm] Altitude above ground
377 * @param vx [cm/s] Ground X speed (latitude, positive north)
378 * @param vy [cm/s] Ground Y speed (longitude, positive east)
379 * @param vz [cm/s] Ground Z speed (altitude, positive down)
380 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
381 * @param v_acc [mm] Altitude uncertainty (standard deviation)
382 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
383 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
384 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
385 * @param next_alt [mm] Next waypoint, altitude (WGS84)
386 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
387 * @param flight_state Flight state
388 * @param flags Bitwise OR combination of the data available flags.
389 */
390#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
391
392static inline void mavlink_msg_utm_global_position_send(mavlink_channel_t chan, uint64_t time, const uint8_t *uas_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t h_acc, uint16_t v_acc, uint16_t vel_acc, int32_t next_lat, int32_t next_lon, int32_t next_alt, uint16_t update_rate, uint8_t flight_state, uint8_t flags)
393{
394#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
395 char buf[MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN];
396 _mav_put_uint64_t(buf, 0, time);
397 _mav_put_int32_t(buf, 8, lat);
398 _mav_put_int32_t(buf, 12, lon);
399 _mav_put_int32_t(buf, 16, alt);
400 _mav_put_int32_t(buf, 20, relative_alt);
401 _mav_put_int32_t(buf, 24, next_lat);
402 _mav_put_int32_t(buf, 28, next_lon);
403 _mav_put_int32_t(buf, 32, next_alt);
404 _mav_put_int16_t(buf, 36, vx);
405 _mav_put_int16_t(buf, 38, vy);
406 _mav_put_int16_t(buf, 40, vz);
407 _mav_put_uint16_t(buf, 42, h_acc);
408 _mav_put_uint16_t(buf, 44, v_acc);
409 _mav_put_uint16_t(buf, 46, vel_acc);
410 _mav_put_uint16_t(buf, 48, update_rate);
411 _mav_put_uint8_t(buf, 68, flight_state);
412 _mav_put_uint8_t(buf, 69, flags);
413 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
414 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
415#else
416 mavlink_utm_global_position_t packet;
417 packet.time = time;
418 packet.lat = lat;
419 packet.lon = lon;
420 packet.alt = alt;
421 packet.relative_alt = relative_alt;
422 packet.next_lat = next_lat;
423 packet.next_lon = next_lon;
424 packet.next_alt = next_alt;
425 packet.vx = vx;
426 packet.vy = vy;
427 packet.vz = vz;
428 packet.h_acc = h_acc;
429 packet.v_acc = v_acc;
430 packet.vel_acc = vel_acc;
431 packet.update_rate = update_rate;
432 packet.flight_state = flight_state;
433 packet.flags = flags;
434 mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18);
435 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, (const char *)&packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
436#endif
437}
438
439/**
440 * @brief Send a utm_global_position message
441 * @param chan MAVLink channel to send the message
442 * @param struct The MAVLink struct to serialize
443 */
444static inline void mavlink_msg_utm_global_position_send_struct(mavlink_channel_t chan, const mavlink_utm_global_position_t* utm_global_position)
445{
446#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
447 mavlink_msg_utm_global_position_send(chan, utm_global_position->time, utm_global_position->uas_id, utm_global_position->lat, utm_global_position->lon, utm_global_position->alt, utm_global_position->relative_alt, utm_global_position->vx, utm_global_position->vy, utm_global_position->vz, utm_global_position->h_acc, utm_global_position->v_acc, utm_global_position->vel_acc, utm_global_position->next_lat, utm_global_position->next_lon, utm_global_position->next_alt, utm_global_position->update_rate, utm_global_position->flight_state, utm_global_position->flags);
448#else
449 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, (const char *)utm_global_position, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
450#endif
451}
452
453#if MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
454/*
455 This variant of _send() can be used to save stack space by reusing
456 memory from the receive buffer. The caller provides a
457 mavlink_message_t which is the size of a full mavlink message. This
458 is usually the receive buffer for the channel, and allows a reply to an
459 incoming message with minimum stack space usage.
460 */
461static inline void mavlink_msg_utm_global_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time, const uint8_t *uas_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t h_acc, uint16_t v_acc, uint16_t vel_acc, int32_t next_lat, int32_t next_lon, int32_t next_alt, uint16_t update_rate, uint8_t flight_state, uint8_t flags)
462{
463#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
464 char *buf = (char *)msgbuf;
465 _mav_put_uint64_t(buf, 0, time);
466 _mav_put_int32_t(buf, 8, lat);
467 _mav_put_int32_t(buf, 12, lon);
468 _mav_put_int32_t(buf, 16, alt);
469 _mav_put_int32_t(buf, 20, relative_alt);
470 _mav_put_int32_t(buf, 24, next_lat);
471 _mav_put_int32_t(buf, 28, next_lon);
472 _mav_put_int32_t(buf, 32, next_alt);
473 _mav_put_int16_t(buf, 36, vx);
474 _mav_put_int16_t(buf, 38, vy);
475 _mav_put_int16_t(buf, 40, vz);
476 _mav_put_uint16_t(buf, 42, h_acc);
477 _mav_put_uint16_t(buf, 44, v_acc);
478 _mav_put_uint16_t(buf, 46, vel_acc);
479 _mav_put_uint16_t(buf, 48, update_rate);
480 _mav_put_uint8_t(buf, 68, flight_state);
481 _mav_put_uint8_t(buf, 69, flags);
482 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
483 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, buf, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
484#else
485 mavlink_utm_global_position_t *packet = (mavlink_utm_global_position_t *)msgbuf;
486 packet->time = time;
487 packet->lat = lat;
488 packet->lon = lon;
489 packet->alt = alt;
490 packet->relative_alt = relative_alt;
491 packet->next_lat = next_lat;
492 packet->next_lon = next_lon;
493 packet->next_alt = next_alt;
494 packet->vx = vx;
495 packet->vy = vy;
496 packet->vz = vz;
497 packet->h_acc = h_acc;
498 packet->v_acc = v_acc;
499 packet->vel_acc = vel_acc;
500 packet->update_rate = update_rate;
501 packet->flight_state = flight_state;
502 packet->flags = flags;
503 mav_array_memcpy(packet->uas_id, uas_id, sizeof(uint8_t)*18);
504 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION, (const char *)packet, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
505#endif
506}
507#endif
508
509#endif
510
511// MESSAGE UTM_GLOBAL_POSITION UNPACKING
512
513
514/**
515 * @brief Get field time from utm_global_position message
516 *
517 * @return [us] Time of applicability of position (microseconds since UNIX epoch).
518 */
519static inline uint64_t mavlink_msg_utm_global_position_get_time(const mavlink_message_t* msg)
520{
521 return _MAV_RETURN_uint64_t(msg, 0);
522}
523
524/**
525 * @brief Get field uas_id from utm_global_position message
526 *
527 * @return Unique UAS ID.
528 */
529static inline uint16_t mavlink_msg_utm_global_position_get_uas_id(const mavlink_message_t* msg, uint8_t *uas_id)
530{
531 return _MAV_RETURN_uint8_t_array(msg, uas_id, 18, 50);
532}
533
534/**
535 * @brief Get field lat from utm_global_position message
536 *
537 * @return [degE7] Latitude (WGS84)
538 */
539static inline int32_t mavlink_msg_utm_global_position_get_lat(const mavlink_message_t* msg)
540{
541 return _MAV_RETURN_int32_t(msg, 8);
542}
543
544/**
545 * @brief Get field lon from utm_global_position message
546 *
547 * @return [degE7] Longitude (WGS84)
548 */
549static inline int32_t mavlink_msg_utm_global_position_get_lon(const mavlink_message_t* msg)
550{
551 return _MAV_RETURN_int32_t(msg, 12);
552}
553
554/**
555 * @brief Get field alt from utm_global_position message
556 *
557 * @return [mm] Altitude (WGS84)
558 */
559static inline int32_t mavlink_msg_utm_global_position_get_alt(const mavlink_message_t* msg)
560{
561 return _MAV_RETURN_int32_t(msg, 16);
562}
563
564/**
565 * @brief Get field relative_alt from utm_global_position message
566 *
567 * @return [mm] Altitude above ground
568 */
569static inline int32_t mavlink_msg_utm_global_position_get_relative_alt(const mavlink_message_t* msg)
570{
571 return _MAV_RETURN_int32_t(msg, 20);
572}
573
574/**
575 * @brief Get field vx from utm_global_position message
576 *
577 * @return [cm/s] Ground X speed (latitude, positive north)
578 */
579static inline int16_t mavlink_msg_utm_global_position_get_vx(const mavlink_message_t* msg)
580{
581 return _MAV_RETURN_int16_t(msg, 36);
582}
583
584/**
585 * @brief Get field vy from utm_global_position message
586 *
587 * @return [cm/s] Ground Y speed (longitude, positive east)
588 */
589static inline int16_t mavlink_msg_utm_global_position_get_vy(const mavlink_message_t* msg)
590{
591 return _MAV_RETURN_int16_t(msg, 38);
592}
593
594/**
595 * @brief Get field vz from utm_global_position message
596 *
597 * @return [cm/s] Ground Z speed (altitude, positive down)
598 */
599static inline int16_t mavlink_msg_utm_global_position_get_vz(const mavlink_message_t* msg)
600{
601 return _MAV_RETURN_int16_t(msg, 40);
602}
603
604/**
605 * @brief Get field h_acc from utm_global_position message
606 *
607 * @return [mm] Horizontal position uncertainty (standard deviation)
608 */
609static inline uint16_t mavlink_msg_utm_global_position_get_h_acc(const mavlink_message_t* msg)
610{
611 return _MAV_RETURN_uint16_t(msg, 42);
612}
613
614/**
615 * @brief Get field v_acc from utm_global_position message
616 *
617 * @return [mm] Altitude uncertainty (standard deviation)
618 */
619static inline uint16_t mavlink_msg_utm_global_position_get_v_acc(const mavlink_message_t* msg)
620{
621 return _MAV_RETURN_uint16_t(msg, 44);
622}
623
624/**
625 * @brief Get field vel_acc from utm_global_position message
626 *
627 * @return [cm/s] Speed uncertainty (standard deviation)
628 */
629static inline uint16_t mavlink_msg_utm_global_position_get_vel_acc(const mavlink_message_t* msg)
630{
631 return _MAV_RETURN_uint16_t(msg, 46);
632}
633
634/**
635 * @brief Get field next_lat from utm_global_position message
636 *
637 * @return [degE7] Next waypoint, latitude (WGS84)
638 */
639static inline int32_t mavlink_msg_utm_global_position_get_next_lat(const mavlink_message_t* msg)
640{
641 return _MAV_RETURN_int32_t(msg, 24);
642}
643
644/**
645 * @brief Get field next_lon from utm_global_position message
646 *
647 * @return [degE7] Next waypoint, longitude (WGS84)
648 */
649static inline int32_t mavlink_msg_utm_global_position_get_next_lon(const mavlink_message_t* msg)
650{
651 return _MAV_RETURN_int32_t(msg, 28);
652}
653
654/**
655 * @brief Get field next_alt from utm_global_position message
656 *
657 * @return [mm] Next waypoint, altitude (WGS84)
658 */
659static inline int32_t mavlink_msg_utm_global_position_get_next_alt(const mavlink_message_t* msg)
660{
661 return _MAV_RETURN_int32_t(msg, 32);
662}
663
664/**
665 * @brief Get field update_rate from utm_global_position message
666 *
667 * @return [cs] Time until next update. Set to 0 if unknown or in data driven mode.
668 */
669static inline uint16_t mavlink_msg_utm_global_position_get_update_rate(const mavlink_message_t* msg)
670{
671 return _MAV_RETURN_uint16_t(msg, 48);
672}
673
674/**
675 * @brief Get field flight_state from utm_global_position message
676 *
677 * @return Flight state
678 */
679static inline uint8_t mavlink_msg_utm_global_position_get_flight_state(const mavlink_message_t* msg)
680{
681 return _MAV_RETURN_uint8_t(msg, 68);
682}
683
684/**
685 * @brief Get field flags from utm_global_position message
686 *
687 * @return Bitwise OR combination of the data available flags.
688 */
689static inline uint8_t mavlink_msg_utm_global_position_get_flags(const mavlink_message_t* msg)
690{
691 return _MAV_RETURN_uint8_t(msg, 69);
692}
693
694/**
695 * @brief Decode a utm_global_position message into a struct
696 *
697 * @param msg The message to decode
698 * @param utm_global_position C-struct to decode the message contents into
699 */
700static inline void mavlink_msg_utm_global_position_decode(const mavlink_message_t* msg, mavlink_utm_global_position_t* utm_global_position)
701{
702#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
703 utm_global_position->time = mavlink_msg_utm_global_position_get_time(msg);
704 utm_global_position->lat = mavlink_msg_utm_global_position_get_lat(msg);
705 utm_global_position->lon = mavlink_msg_utm_global_position_get_lon(msg);
706 utm_global_position->alt = mavlink_msg_utm_global_position_get_alt(msg);
707 utm_global_position->relative_alt = mavlink_msg_utm_global_position_get_relative_alt(msg);
708 utm_global_position->next_lat = mavlink_msg_utm_global_position_get_next_lat(msg);
709 utm_global_position->next_lon = mavlink_msg_utm_global_position_get_next_lon(msg);
710 utm_global_position->next_alt = mavlink_msg_utm_global_position_get_next_alt(msg);
711 utm_global_position->vx = mavlink_msg_utm_global_position_get_vx(msg);
712 utm_global_position->vy = mavlink_msg_utm_global_position_get_vy(msg);
713 utm_global_position->vz = mavlink_msg_utm_global_position_get_vz(msg);
714 utm_global_position->h_acc = mavlink_msg_utm_global_position_get_h_acc(msg);
715 utm_global_position->v_acc = mavlink_msg_utm_global_position_get_v_acc(msg);
716 utm_global_position->vel_acc = mavlink_msg_utm_global_position_get_vel_acc(msg);
717 utm_global_position->update_rate = mavlink_msg_utm_global_position_get_update_rate(msg);
718 mavlink_msg_utm_global_position_get_uas_id(msg, utm_global_position->uas_id);
719 utm_global_position->flight_state = mavlink_msg_utm_global_position_get_flight_state(msg);
720 utm_global_position->flags = mavlink_msg_utm_global_position_get_flags(msg);
721#else
722 uint8_t len = msg->len < MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN;
723 memset(utm_global_position, 0, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
724 memcpy(utm_global_position, _MAV_PAYLOAD(msg), len);
725#endif
726}