Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_global_position_sensor.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GLOBAL_POSITION_SENSOR PACKING
3
4#define MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR 296
5
6
8 uint64_t time_usec; /*< [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 uint32_t processing_time; /*< [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.*/
10 int32_t lat; /*< [degE7] Latitude (WGS84)*/
11 int32_t lon; /*< [degE7] Longitude (WGS84)*/
12 float alt_ellipsoid; /*< [m] Altitude (WGS84 elipsoid), preferred if available*/
13 float alt; /*< [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available*/
14 float eph; /*< [m] Standard deviation of horizontal position error*/
15 float epv; /*< [m] Standard deviation of vertical position error*/
16 uint8_t target_system; /*< System ID (ID of target system, normally autopilot and ground station).*/
17 uint8_t target_component; /*< Component ID (normally 0 for broadcast).*/
18 uint8_t id; /*< Sensor ID*/
19 uint8_t source; /*< Source of position/estimate (such as GNSS, estimator, etc.)*/
20 uint8_t flags; /*< Status flags*/
21} mavlink_global_position_sensor_t;
22
23#define MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN 41
24#define MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN 41
25#define MAVLINK_MSG_ID_296_LEN 41
26#define MAVLINK_MSG_ID_296_MIN_LEN 41
27
28#define MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC 158
29#define MAVLINK_MSG_ID_296_CRC 158
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SENSOR {
35 296,
36 "GLOBAL_POSITION_SENSOR",
37 13,
38 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_global_position_sensor_t, target_system) },
39 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_global_position_sensor_t, target_component) },
40 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_global_position_sensor_t, id) },
41 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_sensor_t, time_usec) },
42 { "processing_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_global_position_sensor_t, processing_time) },
43 { "source", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_global_position_sensor_t, source) },
44 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_global_position_sensor_t, flags) },
45 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_sensor_t, lat) },
46 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_sensor_t, lon) },
47 { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_sensor_t, alt_ellipsoid) },
48 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_sensor_t, alt) },
49 { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_sensor_t, eph) },
50 { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_sensor_t, epv) },
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SENSOR {
55 "GLOBAL_POSITION_SENSOR",
56 13,
57 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_global_position_sensor_t, target_system) },
58 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_global_position_sensor_t, target_component) },
59 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_global_position_sensor_t, id) },
60 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_sensor_t, time_usec) },
61 { "processing_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_global_position_sensor_t, processing_time) },
62 { "source", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_global_position_sensor_t, source) },
63 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_global_position_sensor_t, flags) },
64 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_sensor_t, lat) },
65 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_sensor_t, lon) },
66 { "alt_ellipsoid", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_sensor_t, alt_ellipsoid) },
67 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_sensor_t, alt) },
68 { "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_sensor_t, eph) },
69 { "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_sensor_t, epv) },
70 } \
71}
72#endif
73
74/**
75 * @brief Pack a global_position_sensor message
76 * @param system_id ID of this system
77 * @param component_id ID of this component (e.g. 200 for IMU)
78 * @param msg The MAVLink message to compress the data into
79 *
80 * @param target_system System ID (ID of target system, normally autopilot and ground station).
81 * @param target_component Component ID (normally 0 for broadcast).
82 * @param id Sensor ID
83 * @param time_usec [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
84 * @param processing_time [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.
85 * @param source Source of position/estimate (such as GNSS, estimator, etc.)
86 * @param flags Status flags
87 * @param lat [degE7] Latitude (WGS84)
88 * @param lon [degE7] Longitude (WGS84)
89 * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid), preferred if available
90 * @param alt [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available
91 * @param eph [m] Standard deviation of horizontal position error
92 * @param epv [m] Standard deviation of vertical position error
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_global_position_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 uint8_t target_system, uint8_t target_component, uint8_t id, uint64_t time_usec, uint32_t processing_time, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt_ellipsoid, float alt, float eph, float epv)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 _mav_put_uint64_t(buf, 0, time_usec);
101 _mav_put_uint32_t(buf, 8, processing_time);
102 _mav_put_int32_t(buf, 12, lat);
103 _mav_put_int32_t(buf, 16, lon);
104 _mav_put_float(buf, 20, alt_ellipsoid);
105 _mav_put_float(buf, 24, alt);
106 _mav_put_float(buf, 28, eph);
107 _mav_put_float(buf, 32, epv);
108 _mav_put_uint8_t(buf, 36, target_system);
109 _mav_put_uint8_t(buf, 37, target_component);
110 _mav_put_uint8_t(buf, 38, id);
111 _mav_put_uint8_t(buf, 39, source);
112 _mav_put_uint8_t(buf, 40, flags);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
115#else
116 mavlink_global_position_sensor_t packet;
117 packet.time_usec = time_usec;
118 packet.processing_time = processing_time;
119 packet.lat = lat;
120 packet.lon = lon;
121 packet.alt_ellipsoid = alt_ellipsoid;
122 packet.alt = alt;
123 packet.eph = eph;
124 packet.epv = epv;
125 packet.target_system = target_system;
126 packet.target_component = target_component;
127 packet.id = id;
128 packet.source = source;
129 packet.flags = flags;
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
132#endif
133
136}
137
138/**
139 * @brief Pack a global_position_sensor message
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param status MAVLink status structure
143 * @param msg The MAVLink message to compress the data into
144 *
145 * @param target_system System ID (ID of target system, normally autopilot and ground station).
146 * @param target_component Component ID (normally 0 for broadcast).
147 * @param id Sensor ID
148 * @param time_usec [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
149 * @param processing_time [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.
150 * @param source Source of position/estimate (such as GNSS, estimator, etc.)
151 * @param flags Status flags
152 * @param lat [degE7] Latitude (WGS84)
153 * @param lon [degE7] Longitude (WGS84)
154 * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid), preferred if available
155 * @param alt [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available
156 * @param eph [m] Standard deviation of horizontal position error
157 * @param epv [m] Standard deviation of vertical position error
158 * @return length of the message in bytes (excluding serial stream start sign)
159 */
160static inline uint16_t mavlink_msg_global_position_sensor_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
161 uint8_t target_system, uint8_t target_component, uint8_t id, uint64_t time_usec, uint32_t processing_time, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt_ellipsoid, float alt, float eph, float epv)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 _mav_put_uint64_t(buf, 0, time_usec);
166 _mav_put_uint32_t(buf, 8, processing_time);
167 _mav_put_int32_t(buf, 12, lat);
168 _mav_put_int32_t(buf, 16, lon);
169 _mav_put_float(buf, 20, alt_ellipsoid);
170 _mav_put_float(buf, 24, alt);
171 _mav_put_float(buf, 28, eph);
172 _mav_put_float(buf, 32, epv);
173 _mav_put_uint8_t(buf, 36, target_system);
174 _mav_put_uint8_t(buf, 37, target_component);
175 _mav_put_uint8_t(buf, 38, id);
176 _mav_put_uint8_t(buf, 39, source);
177 _mav_put_uint8_t(buf, 40, flags);
178
179 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
180#else
181 mavlink_global_position_sensor_t packet;
182 packet.time_usec = time_usec;
183 packet.processing_time = processing_time;
184 packet.lat = lat;
185 packet.lon = lon;
186 packet.alt_ellipsoid = alt_ellipsoid;
187 packet.alt = alt;
188 packet.eph = eph;
189 packet.epv = epv;
190 packet.target_system = target_system;
191 packet.target_component = target_component;
192 packet.id = id;
193 packet.source = source;
194 packet.flags = flags;
195
196 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
197#endif
198
200#if MAVLINK_CRC_EXTRA
201 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
202#else
203 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
204#endif
205}
206
207/**
208 * @brief Pack a global_position_sensor message on a channel
209 * @param system_id ID of this system
210 * @param component_id ID of this component (e.g. 200 for IMU)
211 * @param chan The MAVLink channel this message will be sent over
212 * @param msg The MAVLink message to compress the data into
213 * @param target_system System ID (ID of target system, normally autopilot and ground station).
214 * @param target_component Component ID (normally 0 for broadcast).
215 * @param id Sensor ID
216 * @param time_usec [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
217 * @param processing_time [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.
218 * @param source Source of position/estimate (such as GNSS, estimator, etc.)
219 * @param flags Status flags
220 * @param lat [degE7] Latitude (WGS84)
221 * @param lon [degE7] Longitude (WGS84)
222 * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid), preferred if available
223 * @param alt [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available
224 * @param eph [m] Standard deviation of horizontal position error
225 * @param epv [m] Standard deviation of vertical position error
226 * @return length of the message in bytes (excluding serial stream start sign)
227 */
228static inline uint16_t mavlink_msg_global_position_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
229 mavlink_message_t* msg,
230 uint8_t target_system,uint8_t target_component,uint8_t id,uint64_t time_usec,uint32_t processing_time,uint8_t source,uint8_t flags,int32_t lat,int32_t lon,float alt_ellipsoid,float alt,float eph,float epv)
231{
232#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
234 _mav_put_uint64_t(buf, 0, time_usec);
235 _mav_put_uint32_t(buf, 8, processing_time);
236 _mav_put_int32_t(buf, 12, lat);
237 _mav_put_int32_t(buf, 16, lon);
238 _mav_put_float(buf, 20, alt_ellipsoid);
239 _mav_put_float(buf, 24, alt);
240 _mav_put_float(buf, 28, eph);
241 _mav_put_float(buf, 32, epv);
242 _mav_put_uint8_t(buf, 36, target_system);
243 _mav_put_uint8_t(buf, 37, target_component);
244 _mav_put_uint8_t(buf, 38, id);
245 _mav_put_uint8_t(buf, 39, source);
246 _mav_put_uint8_t(buf, 40, flags);
247
248 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
249#else
250 mavlink_global_position_sensor_t packet;
251 packet.time_usec = time_usec;
252 packet.processing_time = processing_time;
253 packet.lat = lat;
254 packet.lon = lon;
255 packet.alt_ellipsoid = alt_ellipsoid;
256 packet.alt = alt;
257 packet.eph = eph;
258 packet.epv = epv;
259 packet.target_system = target_system;
260 packet.target_component = target_component;
261 packet.id = id;
262 packet.source = source;
263 packet.flags = flags;
264
265 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
266#endif
267
270}
271
272/**
273 * @brief Encode a global_position_sensor struct
274 *
275 * @param system_id ID of this system
276 * @param component_id ID of this component (e.g. 200 for IMU)
277 * @param msg The MAVLink message to compress the data into
278 * @param global_position_sensor C-struct to read the message contents from
279 */
280static inline uint16_t mavlink_msg_global_position_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_sensor_t* global_position_sensor)
281{
282 return mavlink_msg_global_position_sensor_pack(system_id, component_id, msg, global_position_sensor->target_system, global_position_sensor->target_component, global_position_sensor->id, global_position_sensor->time_usec, global_position_sensor->processing_time, global_position_sensor->source, global_position_sensor->flags, global_position_sensor->lat, global_position_sensor->lon, global_position_sensor->alt_ellipsoid, global_position_sensor->alt, global_position_sensor->eph, global_position_sensor->epv);
283}
284
285/**
286 * @brief Encode a global_position_sensor struct on a channel
287 *
288 * @param system_id ID of this system
289 * @param component_id ID of this component (e.g. 200 for IMU)
290 * @param chan The MAVLink channel this message will be sent over
291 * @param msg The MAVLink message to compress the data into
292 * @param global_position_sensor C-struct to read the message contents from
293 */
294static inline uint16_t mavlink_msg_global_position_sensor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_sensor_t* global_position_sensor)
295{
296 return mavlink_msg_global_position_sensor_pack_chan(system_id, component_id, chan, msg, global_position_sensor->target_system, global_position_sensor->target_component, global_position_sensor->id, global_position_sensor->time_usec, global_position_sensor->processing_time, global_position_sensor->source, global_position_sensor->flags, global_position_sensor->lat, global_position_sensor->lon, global_position_sensor->alt_ellipsoid, global_position_sensor->alt, global_position_sensor->eph, global_position_sensor->epv);
297}
298
299/**
300 * @brief Encode a global_position_sensor struct with provided status structure
301 *
302 * @param system_id ID of this system
303 * @param component_id ID of this component (e.g. 200 for IMU)
304 * @param status MAVLink status structure
305 * @param msg The MAVLink message to compress the data into
306 * @param global_position_sensor C-struct to read the message contents from
307 */
308static inline uint16_t mavlink_msg_global_position_sensor_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_global_position_sensor_t* global_position_sensor)
309{
310 return mavlink_msg_global_position_sensor_pack_status(system_id, component_id, _status, msg, global_position_sensor->target_system, global_position_sensor->target_component, global_position_sensor->id, global_position_sensor->time_usec, global_position_sensor->processing_time, global_position_sensor->source, global_position_sensor->flags, global_position_sensor->lat, global_position_sensor->lon, global_position_sensor->alt_ellipsoid, global_position_sensor->alt, global_position_sensor->eph, global_position_sensor->epv);
311}
312
313/**
314 * @brief Send a global_position_sensor message
315 * @param chan MAVLink channel to send the message
316 *
317 * @param target_system System ID (ID of target system, normally autopilot and ground station).
318 * @param target_component Component ID (normally 0 for broadcast).
319 * @param id Sensor ID
320 * @param time_usec [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
321 * @param processing_time [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.
322 * @param source Source of position/estimate (such as GNSS, estimator, etc.)
323 * @param flags Status flags
324 * @param lat [degE7] Latitude (WGS84)
325 * @param lon [degE7] Longitude (WGS84)
326 * @param alt_ellipsoid [m] Altitude (WGS84 elipsoid), preferred if available
327 * @param alt [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available
328 * @param eph [m] Standard deviation of horizontal position error
329 * @param epv [m] Standard deviation of vertical position error
330 */
331#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
332
333static inline void mavlink_msg_global_position_sensor_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t id, uint64_t time_usec, uint32_t processing_time, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt_ellipsoid, float alt, float eph, float epv)
334{
335#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
336 char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN];
337 _mav_put_uint64_t(buf, 0, time_usec);
338 _mav_put_uint32_t(buf, 8, processing_time);
339 _mav_put_int32_t(buf, 12, lat);
340 _mav_put_int32_t(buf, 16, lon);
341 _mav_put_float(buf, 20, alt_ellipsoid);
342 _mav_put_float(buf, 24, alt);
343 _mav_put_float(buf, 28, eph);
344 _mav_put_float(buf, 32, epv);
345 _mav_put_uint8_t(buf, 36, target_system);
346 _mav_put_uint8_t(buf, 37, target_component);
347 _mav_put_uint8_t(buf, 38, id);
348 _mav_put_uint8_t(buf, 39, source);
349 _mav_put_uint8_t(buf, 40, flags);
350
351 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
352#else
353 mavlink_global_position_sensor_t packet;
354 packet.time_usec = time_usec;
355 packet.processing_time = processing_time;
356 packet.lat = lat;
357 packet.lon = lon;
358 packet.alt_ellipsoid = alt_ellipsoid;
359 packet.alt = alt;
360 packet.eph = eph;
361 packet.epv = epv;
362 packet.target_system = target_system;
363 packet.target_component = target_component;
364 packet.id = id;
365 packet.source = source;
366 packet.flags = flags;
367
368 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
369#endif
370}
371
372/**
373 * @brief Send a global_position_sensor message
374 * @param chan MAVLink channel to send the message
375 * @param struct The MAVLink struct to serialize
376 */
377static inline void mavlink_msg_global_position_sensor_send_struct(mavlink_channel_t chan, const mavlink_global_position_sensor_t* global_position_sensor)
378{
379#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
380 mavlink_msg_global_position_sensor_send(chan, global_position_sensor->target_system, global_position_sensor->target_component, global_position_sensor->id, global_position_sensor->time_usec, global_position_sensor->processing_time, global_position_sensor->source, global_position_sensor->flags, global_position_sensor->lat, global_position_sensor->lon, global_position_sensor->alt_ellipsoid, global_position_sensor->alt, global_position_sensor->eph, global_position_sensor->epv);
381#else
382 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR, (const char *)global_position_sensor, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
383#endif
384}
385
386#if MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
387/*
388 This variant of _send() can be used to save stack space by reusing
389 memory from the receive buffer. The caller provides a
390 mavlink_message_t which is the size of a full mavlink message. This
391 is usually the receive buffer for the channel, and allows a reply to an
392 incoming message with minimum stack space usage.
393 */
394static inline void mavlink_msg_global_position_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t id, uint64_t time_usec, uint32_t processing_time, uint8_t source, uint8_t flags, int32_t lat, int32_t lon, float alt_ellipsoid, float alt, float eph, float epv)
395{
396#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
397 char *buf = (char *)msgbuf;
398 _mav_put_uint64_t(buf, 0, time_usec);
399 _mav_put_uint32_t(buf, 8, processing_time);
400 _mav_put_int32_t(buf, 12, lat);
401 _mav_put_int32_t(buf, 16, lon);
402 _mav_put_float(buf, 20, alt_ellipsoid);
403 _mav_put_float(buf, 24, alt);
404 _mav_put_float(buf, 28, eph);
405 _mav_put_float(buf, 32, epv);
406 _mav_put_uint8_t(buf, 36, target_system);
407 _mav_put_uint8_t(buf, 37, target_component);
408 _mav_put_uint8_t(buf, 38, id);
409 _mav_put_uint8_t(buf, 39, source);
410 _mav_put_uint8_t(buf, 40, flags);
411
412 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
413#else
414 mavlink_global_position_sensor_t *packet = (mavlink_global_position_sensor_t *)msgbuf;
415 packet->time_usec = time_usec;
416 packet->processing_time = processing_time;
417 packet->lat = lat;
418 packet->lon = lon;
419 packet->alt_ellipsoid = alt_ellipsoid;
420 packet->alt = alt;
421 packet->eph = eph;
422 packet->epv = epv;
423 packet->target_system = target_system;
424 packet->target_component = target_component;
425 packet->id = id;
426 packet->source = source;
427 packet->flags = flags;
428
429 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_MIN_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_CRC);
430#endif
431}
432#endif
433
434#endif
435
436// MESSAGE GLOBAL_POSITION_SENSOR UNPACKING
437
438
439/**
440 * @brief Get field target_system from global_position_sensor message
441 *
442 * @return System ID (ID of target system, normally autopilot and ground station).
443 */
444static inline uint8_t mavlink_msg_global_position_sensor_get_target_system(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_uint8_t(msg, 36);
447}
448
449/**
450 * @brief Get field target_component from global_position_sensor message
451 *
452 * @return Component ID (normally 0 for broadcast).
453 */
454static inline uint8_t mavlink_msg_global_position_sensor_get_target_component(const mavlink_message_t* msg)
455{
456 return _MAV_RETURN_uint8_t(msg, 37);
457}
458
459/**
460 * @brief Get field id from global_position_sensor message
461 *
462 * @return Sensor ID
463 */
464static inline uint8_t mavlink_msg_global_position_sensor_get_id(const mavlink_message_t* msg)
465{
466 return _MAV_RETURN_uint8_t(msg, 38);
467}
468
469/**
470 * @brief Get field time_usec from global_position_sensor message
471 *
472 * @return [us] Timestamp of message transmission (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
473 */
474static inline uint64_t mavlink_msg_global_position_sensor_get_time_usec(const mavlink_message_t* msg)
475{
476 return _MAV_RETURN_uint64_t(msg, 0);
477}
478
479/**
480 * @brief Get field processing_time from global_position_sensor message
481 *
482 * @return [us] The time spent in processing the sensor data that is the basis for this position. The recipient can use this to improve time alignment of the data. This is the time between measurement (e.g. camera exposure time) and transmission of this message. Set to NaN if not known.
483 */
484static inline uint32_t mavlink_msg_global_position_sensor_get_processing_time(const mavlink_message_t* msg)
485{
486 return _MAV_RETURN_uint32_t(msg, 8);
487}
488
489/**
490 * @brief Get field source from global_position_sensor message
491 *
492 * @return Source of position/estimate (such as GNSS, estimator, etc.)
493 */
494static inline uint8_t mavlink_msg_global_position_sensor_get_source(const mavlink_message_t* msg)
495{
496 return _MAV_RETURN_uint8_t(msg, 39);
497}
498
499/**
500 * @brief Get field flags from global_position_sensor message
501 *
502 * @return Status flags
503 */
504static inline uint8_t mavlink_msg_global_position_sensor_get_flags(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_uint8_t(msg, 40);
507}
508
509/**
510 * @brief Get field lat from global_position_sensor message
511 *
512 * @return [degE7] Latitude (WGS84)
513 */
514static inline int32_t mavlink_msg_global_position_sensor_get_lat(const mavlink_message_t* msg)
515{
516 return _MAV_RETURN_int32_t(msg, 12);
517}
518
519/**
520 * @brief Get field lon from global_position_sensor message
521 *
522 * @return [degE7] Longitude (WGS84)
523 */
524static inline int32_t mavlink_msg_global_position_sensor_get_lon(const mavlink_message_t* msg)
525{
526 return _MAV_RETURN_int32_t(msg, 16);
527}
528
529/**
530 * @brief Get field alt_ellipsoid from global_position_sensor message
531 *
532 * @return [m] Altitude (WGS84 elipsoid), preferred if available
533 */
534static inline float mavlink_msg_global_position_sensor_get_alt_ellipsoid(const mavlink_message_t* msg)
535{
536 return _MAV_RETURN_float(msg, 20);
537}
538
539/**
540 * @brief Get field alt from global_position_sensor message
541 *
542 * @return [m] Altitude (MSL - position-system specific value) use if no alt_ellipsoid available
543 */
544static inline float mavlink_msg_global_position_sensor_get_alt(const mavlink_message_t* msg)
545{
546 return _MAV_RETURN_float(msg, 24);
547}
548
549/**
550 * @brief Get field eph from global_position_sensor message
551 *
552 * @return [m] Standard deviation of horizontal position error
553 */
554static inline float mavlink_msg_global_position_sensor_get_eph(const mavlink_message_t* msg)
555{
556 return _MAV_RETURN_float(msg, 28);
557}
558
559/**
560 * @brief Get field epv from global_position_sensor message
561 *
562 * @return [m] Standard deviation of vertical position error
563 */
564static inline float mavlink_msg_global_position_sensor_get_epv(const mavlink_message_t* msg)
565{
566 return _MAV_RETURN_float(msg, 32);
567}
568
569/**
570 * @brief Decode a global_position_sensor message into a struct
571 *
572 * @param msg The message to decode
573 * @param global_position_sensor C-struct to decode the message contents into
574 */
575static inline void mavlink_msg_global_position_sensor_decode(const mavlink_message_t* msg, mavlink_global_position_sensor_t* global_position_sensor)
576{
577#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
578 global_position_sensor->time_usec = mavlink_msg_global_position_sensor_get_time_usec(msg);
579 global_position_sensor->processing_time = mavlink_msg_global_position_sensor_get_processing_time(msg);
580 global_position_sensor->lat = mavlink_msg_global_position_sensor_get_lat(msg);
581 global_position_sensor->lon = mavlink_msg_global_position_sensor_get_lon(msg);
582 global_position_sensor->alt_ellipsoid = mavlink_msg_global_position_sensor_get_alt_ellipsoid(msg);
583 global_position_sensor->alt = mavlink_msg_global_position_sensor_get_alt(msg);
584 global_position_sensor->eph = mavlink_msg_global_position_sensor_get_eph(msg);
585 global_position_sensor->epv = mavlink_msg_global_position_sensor_get_epv(msg);
586 global_position_sensor->target_system = mavlink_msg_global_position_sensor_get_target_system(msg);
587 global_position_sensor->target_component = mavlink_msg_global_position_sensor_get_target_component(msg);
588 global_position_sensor->id = mavlink_msg_global_position_sensor_get_id(msg);
589 global_position_sensor->source = mavlink_msg_global_position_sensor_get_source(msg);
590 global_position_sensor->flags = mavlink_msg_global_position_sensor_get_flags(msg);
591#else
592 uint8_t len = msg->len < MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN? msg->len : MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN;
593 memset(global_position_sensor, 0, MAVLINK_MSG_ID_GLOBAL_POSITION_SENSOR_LEN);
594 memcpy(global_position_sensor, _MAV_PAYLOAD(msg), len);
595#endif
596}