Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_utm_global_position.h
blob0c8ee72263a361edc6dff71445b75ed9a6e83ac5
1 #pragma once
2 // MESSAGE UTM_GLOBAL_POSITION PACKING
4 #define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION 340
7 typedef struct __mavlink_utm_global_position_t {
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;
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
33 #define MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC 99
34 #define MAVLINK_MSG_ID_340_CRC 99
36 #define MAVLINK_MSG_UTM_GLOBAL_POSITION_FIELD_UAS_ID_LEN 18
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 } \
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 } \
87 #endif
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
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)
115 static 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)
118 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119 char buf[MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN];
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
162 msg->msgid = MAVLINK_MSG_ID_UTM_GLOBAL_POSITION;
163 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_MIN_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_CRC);
167 * @brief Pack a utm_global_position message on a channel
168 * @param system_id ID of this system
169 * @param component_id ID of this component (e.g. 200 for IMU)
170 * @param chan The MAVLink channel this message will be sent over
171 * @param msg The MAVLink message to compress the data into
172 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
173 * @param uas_id Unique UAS ID.
174 * @param lat [degE7] Latitude (WGS84)
175 * @param lon [degE7] Longitude (WGS84)
176 * @param alt [mm] Altitude (WGS84)
177 * @param relative_alt [mm] Altitude above ground
178 * @param vx [cm/s] Ground X speed (latitude, positive north)
179 * @param vy [cm/s] Ground Y speed (longitude, positive east)
180 * @param vz [cm/s] Ground Z speed (altitude, positive down)
181 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
182 * @param v_acc [mm] Altitude uncertainty (standard deviation)
183 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
184 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
185 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
186 * @param next_alt [mm] Next waypoint, altitude (WGS84)
187 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
188 * @param flight_state Flight state
189 * @param flags Bitwise OR combination of the data available flags.
190 * @return length of the message in bytes (excluding serial stream start sign)
192 static inline uint16_t mavlink_msg_utm_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
193 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)
196 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
197 char buf[MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN];
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
240 msg->msgid = MAVLINK_MSG_ID_UTM_GLOBAL_POSITION;
241 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);
245 * @brief Encode a utm_global_position struct
247 * @param system_id ID of this system
248 * @param component_id ID of this component (e.g. 200 for IMU)
249 * @param msg The MAVLink message to compress the data into
250 * @param utm_global_position C-struct to read the message contents from
252 static 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)
254 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);
258 * @brief Encode a utm_global_position struct on a channel
260 * @param system_id ID of this system
261 * @param component_id ID of this component (e.g. 200 for IMU)
262 * @param chan The MAVLink channel this message will be sent over
263 * @param msg The MAVLink message to compress the data into
264 * @param utm_global_position C-struct to read the message contents from
266 static 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)
268 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);
272 * @brief Send a utm_global_position message
273 * @param chan MAVLink channel to send the message
275 * @param time [us] Time of applicability of position (microseconds since UNIX epoch).
276 * @param uas_id Unique UAS ID.
277 * @param lat [degE7] Latitude (WGS84)
278 * @param lon [degE7] Longitude (WGS84)
279 * @param alt [mm] Altitude (WGS84)
280 * @param relative_alt [mm] Altitude above ground
281 * @param vx [cm/s] Ground X speed (latitude, positive north)
282 * @param vy [cm/s] Ground Y speed (longitude, positive east)
283 * @param vz [cm/s] Ground Z speed (altitude, positive down)
284 * @param h_acc [mm] Horizontal position uncertainty (standard deviation)
285 * @param v_acc [mm] Altitude uncertainty (standard deviation)
286 * @param vel_acc [cm/s] Speed uncertainty (standard deviation)
287 * @param next_lat [degE7] Next waypoint, latitude (WGS84)
288 * @param next_lon [degE7] Next waypoint, longitude (WGS84)
289 * @param next_alt [mm] Next waypoint, altitude (WGS84)
290 * @param update_rate [cs] Time until next update. Set to 0 if unknown or in data driven mode.
291 * @param flight_state Flight state
292 * @param flags Bitwise OR combination of the data available flags.
294 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
296 static 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)
298 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
299 char buf[MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN];
300 _mav_put_uint64_t(buf, 0, time);
301 _mav_put_int32_t(buf, 8, lat);
302 _mav_put_int32_t(buf, 12, lon);
303 _mav_put_int32_t(buf, 16, alt);
304 _mav_put_int32_t(buf, 20, relative_alt);
305 _mav_put_int32_t(buf, 24, next_lat);
306 _mav_put_int32_t(buf, 28, next_lon);
307 _mav_put_int32_t(buf, 32, next_alt);
308 _mav_put_int16_t(buf, 36, vx);
309 _mav_put_int16_t(buf, 38, vy);
310 _mav_put_int16_t(buf, 40, vz);
311 _mav_put_uint16_t(buf, 42, h_acc);
312 _mav_put_uint16_t(buf, 44, v_acc);
313 _mav_put_uint16_t(buf, 46, vel_acc);
314 _mav_put_uint16_t(buf, 48, update_rate);
315 _mav_put_uint8_t(buf, 68, flight_state);
316 _mav_put_uint8_t(buf, 69, flags);
317 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
318 _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);
319 #else
320 mavlink_utm_global_position_t packet;
321 packet.time = time;
322 packet.lat = lat;
323 packet.lon = lon;
324 packet.alt = alt;
325 packet.relative_alt = relative_alt;
326 packet.next_lat = next_lat;
327 packet.next_lon = next_lon;
328 packet.next_alt = next_alt;
329 packet.vx = vx;
330 packet.vy = vy;
331 packet.vz = vz;
332 packet.h_acc = h_acc;
333 packet.v_acc = v_acc;
334 packet.vel_acc = vel_acc;
335 packet.update_rate = update_rate;
336 packet.flight_state = flight_state;
337 packet.flags = flags;
338 mav_array_memcpy(packet.uas_id, uas_id, sizeof(uint8_t)*18);
339 _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);
340 #endif
344 * @brief Send a utm_global_position message
345 * @param chan MAVLink channel to send the message
346 * @param struct The MAVLink struct to serialize
348 static inline void mavlink_msg_utm_global_position_send_struct(mavlink_channel_t chan, const mavlink_utm_global_position_t* utm_global_position)
350 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 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);
352 #else
353 _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);
354 #endif
357 #if MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
359 This varient of _send() can be used to save stack space by re-using
360 memory from the receive buffer. The caller provides a
361 mavlink_message_t which is the size of a full mavlink message. This
362 is usually the receive buffer for the channel, and allows a reply to an
363 incoming message with minimum stack space usage.
365 static 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)
367 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
368 char *buf = (char *)msgbuf;
369 _mav_put_uint64_t(buf, 0, time);
370 _mav_put_int32_t(buf, 8, lat);
371 _mav_put_int32_t(buf, 12, lon);
372 _mav_put_int32_t(buf, 16, alt);
373 _mav_put_int32_t(buf, 20, relative_alt);
374 _mav_put_int32_t(buf, 24, next_lat);
375 _mav_put_int32_t(buf, 28, next_lon);
376 _mav_put_int32_t(buf, 32, next_alt);
377 _mav_put_int16_t(buf, 36, vx);
378 _mav_put_int16_t(buf, 38, vy);
379 _mav_put_int16_t(buf, 40, vz);
380 _mav_put_uint16_t(buf, 42, h_acc);
381 _mav_put_uint16_t(buf, 44, v_acc);
382 _mav_put_uint16_t(buf, 46, vel_acc);
383 _mav_put_uint16_t(buf, 48, update_rate);
384 _mav_put_uint8_t(buf, 68, flight_state);
385 _mav_put_uint8_t(buf, 69, flags);
386 _mav_put_uint8_t_array(buf, 50, uas_id, 18);
387 _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);
388 #else
389 mavlink_utm_global_position_t *packet = (mavlink_utm_global_position_t *)msgbuf;
390 packet->time = time;
391 packet->lat = lat;
392 packet->lon = lon;
393 packet->alt = alt;
394 packet->relative_alt = relative_alt;
395 packet->next_lat = next_lat;
396 packet->next_lon = next_lon;
397 packet->next_alt = next_alt;
398 packet->vx = vx;
399 packet->vy = vy;
400 packet->vz = vz;
401 packet->h_acc = h_acc;
402 packet->v_acc = v_acc;
403 packet->vel_acc = vel_acc;
404 packet->update_rate = update_rate;
405 packet->flight_state = flight_state;
406 packet->flags = flags;
407 mav_array_memcpy(packet->uas_id, uas_id, sizeof(uint8_t)*18);
408 _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);
409 #endif
411 #endif
413 #endif
415 // MESSAGE UTM_GLOBAL_POSITION UNPACKING
419 * @brief Get field time from utm_global_position message
421 * @return [us] Time of applicability of position (microseconds since UNIX epoch).
423 static inline uint64_t mavlink_msg_utm_global_position_get_time(const mavlink_message_t* msg)
425 return _MAV_RETURN_uint64_t(msg, 0);
429 * @brief Get field uas_id from utm_global_position message
431 * @return Unique UAS ID.
433 static inline uint16_t mavlink_msg_utm_global_position_get_uas_id(const mavlink_message_t* msg, uint8_t *uas_id)
435 return _MAV_RETURN_uint8_t_array(msg, uas_id, 18, 50);
439 * @brief Get field lat from utm_global_position message
441 * @return [degE7] Latitude (WGS84)
443 static inline int32_t mavlink_msg_utm_global_position_get_lat(const mavlink_message_t* msg)
445 return _MAV_RETURN_int32_t(msg, 8);
449 * @brief Get field lon from utm_global_position message
451 * @return [degE7] Longitude (WGS84)
453 static inline int32_t mavlink_msg_utm_global_position_get_lon(const mavlink_message_t* msg)
455 return _MAV_RETURN_int32_t(msg, 12);
459 * @brief Get field alt from utm_global_position message
461 * @return [mm] Altitude (WGS84)
463 static inline int32_t mavlink_msg_utm_global_position_get_alt(const mavlink_message_t* msg)
465 return _MAV_RETURN_int32_t(msg, 16);
469 * @brief Get field relative_alt from utm_global_position message
471 * @return [mm] Altitude above ground
473 static inline int32_t mavlink_msg_utm_global_position_get_relative_alt(const mavlink_message_t* msg)
475 return _MAV_RETURN_int32_t(msg, 20);
479 * @brief Get field vx from utm_global_position message
481 * @return [cm/s] Ground X speed (latitude, positive north)
483 static inline int16_t mavlink_msg_utm_global_position_get_vx(const mavlink_message_t* msg)
485 return _MAV_RETURN_int16_t(msg, 36);
489 * @brief Get field vy from utm_global_position message
491 * @return [cm/s] Ground Y speed (longitude, positive east)
493 static inline int16_t mavlink_msg_utm_global_position_get_vy(const mavlink_message_t* msg)
495 return _MAV_RETURN_int16_t(msg, 38);
499 * @brief Get field vz from utm_global_position message
501 * @return [cm/s] Ground Z speed (altitude, positive down)
503 static inline int16_t mavlink_msg_utm_global_position_get_vz(const mavlink_message_t* msg)
505 return _MAV_RETURN_int16_t(msg, 40);
509 * @brief Get field h_acc from utm_global_position message
511 * @return [mm] Horizontal position uncertainty (standard deviation)
513 static inline uint16_t mavlink_msg_utm_global_position_get_h_acc(const mavlink_message_t* msg)
515 return _MAV_RETURN_uint16_t(msg, 42);
519 * @brief Get field v_acc from utm_global_position message
521 * @return [mm] Altitude uncertainty (standard deviation)
523 static inline uint16_t mavlink_msg_utm_global_position_get_v_acc(const mavlink_message_t* msg)
525 return _MAV_RETURN_uint16_t(msg, 44);
529 * @brief Get field vel_acc from utm_global_position message
531 * @return [cm/s] Speed uncertainty (standard deviation)
533 static inline uint16_t mavlink_msg_utm_global_position_get_vel_acc(const mavlink_message_t* msg)
535 return _MAV_RETURN_uint16_t(msg, 46);
539 * @brief Get field next_lat from utm_global_position message
541 * @return [degE7] Next waypoint, latitude (WGS84)
543 static inline int32_t mavlink_msg_utm_global_position_get_next_lat(const mavlink_message_t* msg)
545 return _MAV_RETURN_int32_t(msg, 24);
549 * @brief Get field next_lon from utm_global_position message
551 * @return [degE7] Next waypoint, longitude (WGS84)
553 static inline int32_t mavlink_msg_utm_global_position_get_next_lon(const mavlink_message_t* msg)
555 return _MAV_RETURN_int32_t(msg, 28);
559 * @brief Get field next_alt from utm_global_position message
561 * @return [mm] Next waypoint, altitude (WGS84)
563 static inline int32_t mavlink_msg_utm_global_position_get_next_alt(const mavlink_message_t* msg)
565 return _MAV_RETURN_int32_t(msg, 32);
569 * @brief Get field update_rate from utm_global_position message
571 * @return [cs] Time until next update. Set to 0 if unknown or in data driven mode.
573 static inline uint16_t mavlink_msg_utm_global_position_get_update_rate(const mavlink_message_t* msg)
575 return _MAV_RETURN_uint16_t(msg, 48);
579 * @brief Get field flight_state from utm_global_position message
581 * @return Flight state
583 static inline uint8_t mavlink_msg_utm_global_position_get_flight_state(const mavlink_message_t* msg)
585 return _MAV_RETURN_uint8_t(msg, 68);
589 * @brief Get field flags from utm_global_position message
591 * @return Bitwise OR combination of the data available flags.
593 static inline uint8_t mavlink_msg_utm_global_position_get_flags(const mavlink_message_t* msg)
595 return _MAV_RETURN_uint8_t(msg, 69);
599 * @brief Decode a utm_global_position message into a struct
601 * @param msg The message to decode
602 * @param utm_global_position C-struct to decode the message contents into
604 static inline void mavlink_msg_utm_global_position_decode(const mavlink_message_t* msg, mavlink_utm_global_position_t* utm_global_position)
606 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
607 utm_global_position->time = mavlink_msg_utm_global_position_get_time(msg);
608 utm_global_position->lat = mavlink_msg_utm_global_position_get_lat(msg);
609 utm_global_position->lon = mavlink_msg_utm_global_position_get_lon(msg);
610 utm_global_position->alt = mavlink_msg_utm_global_position_get_alt(msg);
611 utm_global_position->relative_alt = mavlink_msg_utm_global_position_get_relative_alt(msg);
612 utm_global_position->next_lat = mavlink_msg_utm_global_position_get_next_lat(msg);
613 utm_global_position->next_lon = mavlink_msg_utm_global_position_get_next_lon(msg);
614 utm_global_position->next_alt = mavlink_msg_utm_global_position_get_next_alt(msg);
615 utm_global_position->vx = mavlink_msg_utm_global_position_get_vx(msg);
616 utm_global_position->vy = mavlink_msg_utm_global_position_get_vy(msg);
617 utm_global_position->vz = mavlink_msg_utm_global_position_get_vz(msg);
618 utm_global_position->h_acc = mavlink_msg_utm_global_position_get_h_acc(msg);
619 utm_global_position->v_acc = mavlink_msg_utm_global_position_get_v_acc(msg);
620 utm_global_position->vel_acc = mavlink_msg_utm_global_position_get_vel_acc(msg);
621 utm_global_position->update_rate = mavlink_msg_utm_global_position_get_update_rate(msg);
622 mavlink_msg_utm_global_position_get_uas_id(msg, utm_global_position->uas_id);
623 utm_global_position->flight_state = mavlink_msg_utm_global_position_get_flight_state(msg);
624 utm_global_position->flags = mavlink_msg_utm_global_position_get_flags(msg);
625 #else
626 uint8_t len = msg->len < MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN? msg->len : MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN;
627 memset(utm_global_position, 0, MAVLINK_MSG_ID_UTM_GLOBAL_POSITION_LEN);
628 memcpy(utm_global_position, _MAV_PAYLOAD(msg), len);
629 #endif