Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_landing_target.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE LANDING_TARGET PACKING
3
4#define MAVLINK_MSG_ID_LANDING_TARGET 149
5
6MAVPACKED(
7typedef struct __mavlink_landing_target_t {
8 uint64_t time_usec; /*< [us] Timestamp (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 float angle_x; /*< [rad] X-axis angular offset of the target from the center of the image*/
10 float angle_y; /*< [rad] Y-axis angular offset of the target from the center of the image*/
11 float distance; /*< [m] Distance to the target from the vehicle*/
12 float size_x; /*< [rad] Size of target along x-axis*/
13 float size_y; /*< [rad] Size of target along y-axis*/
14 uint8_t target_num; /*< The ID of the target if multiple targets are present*/
15 uint8_t frame; /*< Coordinate frame used for following fields.*/
16 float x; /*< [m] X Position of the landing target in MAV_FRAME*/
17 float y; /*< [m] Y Position of the landing target in MAV_FRAME*/
18 float z; /*< [m] Z Position of the landing target in MAV_FRAME*/
19 float q[4]; /*< Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
20 uint8_t type; /*< Type of landing target*/
21 uint8_t position_valid; /*< Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.*/
22}) mavlink_landing_target_t;
23
24#define MAVLINK_MSG_ID_LANDING_TARGET_LEN 60
25#define MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN 30
26#define MAVLINK_MSG_ID_149_LEN 60
27#define MAVLINK_MSG_ID_149_MIN_LEN 30
28
29#define MAVLINK_MSG_ID_LANDING_TARGET_CRC 200
30#define MAVLINK_MSG_ID_149_CRC 200
31
32#define MAVLINK_MSG_LANDING_TARGET_FIELD_Q_LEN 4
33
34#if MAVLINK_COMMAND_24BIT
35#define MAVLINK_MESSAGE_INFO_LANDING_TARGET {
36 149,
37 "LANDING_TARGET",
38 14,
39 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) },
40 { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) },
41 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) },
42 { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) },
43 { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) },
44 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) },
45 { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) },
46 { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) },
47 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_landing_target_t, x) },
48 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_landing_target_t, y) },
49 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_landing_target_t, z) },
50 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 42, offsetof(mavlink_landing_target_t, q) },
51 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_landing_target_t, type) },
52 { "position_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 59, offsetof(mavlink_landing_target_t, position_valid) },
53 } \
54}
55#else
56#define MAVLINK_MESSAGE_INFO_LANDING_TARGET {
57 "LANDING_TARGET",
58 14,
59 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) },
60 { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) },
61 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) },
62 { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) },
63 { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) },
64 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) },
65 { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) },
66 { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) },
67 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_landing_target_t, x) },
68 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_landing_target_t, y) },
69 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_landing_target_t, z) },
70 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 42, offsetof(mavlink_landing_target_t, q) },
71 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_landing_target_t, type) },
72 { "position_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 59, offsetof(mavlink_landing_target_t, position_valid) },
73 } \
74}
75#endif
76
77/**
78 * @brief Pack a landing_target message
79 * @param system_id ID of this system
80 * @param component_id ID of this component (e.g. 200 for IMU)
81 * @param msg The MAVLink message to compress the data into
82 *
83 * @param time_usec [us] Timestamp (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 target_num The ID of the target if multiple targets are present
85 * @param frame Coordinate frame used for following fields.
86 * @param angle_x [rad] X-axis angular offset of the target from the center of the image
87 * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
88 * @param distance [m] Distance to the target from the vehicle
89 * @param size_x [rad] Size of target along x-axis
90 * @param size_y [rad] Size of target along y-axis
91 * @param x [m] X Position of the landing target in MAV_FRAME
92 * @param y [m] Y Position of the landing target in MAV_FRAME
93 * @param z [m] Z Position of the landing target in MAV_FRAME
94 * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
95 * @param type Type of landing target
96 * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.
97 * @return length of the message in bytes (excluding serial stream start sign)
98 */
99static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
100 uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
101{
102#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
104 _mav_put_uint64_t(buf, 0, time_usec);
105 _mav_put_float(buf, 8, angle_x);
106 _mav_put_float(buf, 12, angle_y);
107 _mav_put_float(buf, 16, distance);
108 _mav_put_float(buf, 20, size_x);
109 _mav_put_float(buf, 24, size_y);
110 _mav_put_uint8_t(buf, 28, target_num);
111 _mav_put_uint8_t(buf, 29, frame);
112 _mav_put_float(buf, 30, x);
113 _mav_put_float(buf, 34, y);
114 _mav_put_float(buf, 38, z);
115 _mav_put_uint8_t(buf, 58, type);
116 _mav_put_uint8_t(buf, 59, position_valid);
117 _mav_put_float_array(buf, 42, q, 4);
118 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
119#else
120 mavlink_landing_target_t packet;
121 packet.time_usec = time_usec;
122 packet.angle_x = angle_x;
123 packet.angle_y = angle_y;
124 packet.distance = distance;
125 packet.size_x = size_x;
126 packet.size_y = size_y;
127 packet.target_num = target_num;
128 packet.frame = frame;
129 packet.x = x;
130 packet.y = y;
131 packet.z = z;
132 packet.type = type;
133 packet.position_valid = position_valid;
134 mav_array_memcpy(packet.q, q, sizeof(float)*4);
135 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
136#endif
137
139 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
140}
141
142/**
143 * @brief Pack a landing_target message
144 * @param system_id ID of this system
145 * @param component_id ID of this component (e.g. 200 for IMU)
146 * @param status MAVLink status structure
147 * @param msg The MAVLink message to compress the data into
148 *
149 * @param time_usec [us] Timestamp (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.
150 * @param target_num The ID of the target if multiple targets are present
151 * @param frame Coordinate frame used for following fields.
152 * @param angle_x [rad] X-axis angular offset of the target from the center of the image
153 * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
154 * @param distance [m] Distance to the target from the vehicle
155 * @param size_x [rad] Size of target along x-axis
156 * @param size_y [rad] Size of target along y-axis
157 * @param x [m] X Position of the landing target in MAV_FRAME
158 * @param y [m] Y Position of the landing target in MAV_FRAME
159 * @param z [m] Z Position of the landing target in MAV_FRAME
160 * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
161 * @param type Type of landing target
162 * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.
163 * @return length of the message in bytes (excluding serial stream start sign)
164 */
165static inline uint16_t mavlink_msg_landing_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
166 uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
167{
168#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
170 _mav_put_uint64_t(buf, 0, time_usec);
171 _mav_put_float(buf, 8, angle_x);
172 _mav_put_float(buf, 12, angle_y);
173 _mav_put_float(buf, 16, distance);
174 _mav_put_float(buf, 20, size_x);
175 _mav_put_float(buf, 24, size_y);
176 _mav_put_uint8_t(buf, 28, target_num);
177 _mav_put_uint8_t(buf, 29, frame);
178 _mav_put_float(buf, 30, x);
179 _mav_put_float(buf, 34, y);
180 _mav_put_float(buf, 38, z);
181 _mav_put_uint8_t(buf, 58, type);
182 _mav_put_uint8_t(buf, 59, position_valid);
183 _mav_put_float_array(buf, 42, q, 4);
184 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
185#else
186 mavlink_landing_target_t packet;
187 packet.time_usec = time_usec;
188 packet.angle_x = angle_x;
189 packet.angle_y = angle_y;
190 packet.distance = distance;
191 packet.size_x = size_x;
192 packet.size_y = size_y;
193 packet.target_num = target_num;
194 packet.frame = frame;
195 packet.x = x;
196 packet.y = y;
197 packet.z = z;
198 packet.type = type;
199 packet.position_valid = position_valid;
200 mav_array_memcpy(packet.q, q, sizeof(float)*4);
201 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
202#endif
203
205#if MAVLINK_CRC_EXTRA
206 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
207#else
208 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
209#endif
210}
211
212/**
213 * @brief Pack a landing_target message on a channel
214 * @param system_id ID of this system
215 * @param component_id ID of this component (e.g. 200 for IMU)
216 * @param chan The MAVLink channel this message will be sent over
217 * @param msg The MAVLink message to compress the data into
218 * @param time_usec [us] Timestamp (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.
219 * @param target_num The ID of the target if multiple targets are present
220 * @param frame Coordinate frame used for following fields.
221 * @param angle_x [rad] X-axis angular offset of the target from the center of the image
222 * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
223 * @param distance [m] Distance to the target from the vehicle
224 * @param size_x [rad] Size of target along x-axis
225 * @param size_y [rad] Size of target along y-axis
226 * @param x [m] X Position of the landing target in MAV_FRAME
227 * @param y [m] Y Position of the landing target in MAV_FRAME
228 * @param z [m] Z Position of the landing target in MAV_FRAME
229 * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
230 * @param type Type of landing target
231 * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.
232 * @return length of the message in bytes (excluding serial stream start sign)
233 */
234static inline uint16_t mavlink_msg_landing_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
235 mavlink_message_t* msg,
236 uint64_t time_usec,uint8_t target_num,uint8_t frame,float angle_x,float angle_y,float distance,float size_x,float size_y,float x,float y,float z,const float *q,uint8_t type,uint8_t position_valid)
237{
238#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
240 _mav_put_uint64_t(buf, 0, time_usec);
241 _mav_put_float(buf, 8, angle_x);
242 _mav_put_float(buf, 12, angle_y);
243 _mav_put_float(buf, 16, distance);
244 _mav_put_float(buf, 20, size_x);
245 _mav_put_float(buf, 24, size_y);
246 _mav_put_uint8_t(buf, 28, target_num);
247 _mav_put_uint8_t(buf, 29, frame);
248 _mav_put_float(buf, 30, x);
249 _mav_put_float(buf, 34, y);
250 _mav_put_float(buf, 38, z);
251 _mav_put_uint8_t(buf, 58, type);
252 _mav_put_uint8_t(buf, 59, position_valid);
253 _mav_put_float_array(buf, 42, q, 4);
254 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
255#else
256 mavlink_landing_target_t packet;
257 packet.time_usec = time_usec;
258 packet.angle_x = angle_x;
259 packet.angle_y = angle_y;
260 packet.distance = distance;
261 packet.size_x = size_x;
262 packet.size_y = size_y;
263 packet.target_num = target_num;
264 packet.frame = frame;
265 packet.x = x;
266 packet.y = y;
267 packet.z = z;
268 packet.type = type;
269 packet.position_valid = position_valid;
270 mav_array_memcpy(packet.q, q, sizeof(float)*4);
271 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
272#endif
273
275 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
276}
277
278/**
279 * @brief Encode a landing_target struct
280 *
281 * @param system_id ID of this system
282 * @param component_id ID of this component (e.g. 200 for IMU)
283 * @param msg The MAVLink message to compress the data into
284 * @param landing_target C-struct to read the message contents from
285 */
286static inline uint16_t mavlink_msg_landing_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target)
287{
288 return mavlink_msg_landing_target_pack(system_id, component_id, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
289}
290
291/**
292 * @brief Encode a landing_target struct on a channel
293 *
294 * @param system_id ID of this system
295 * @param component_id ID of this component (e.g. 200 for IMU)
296 * @param chan The MAVLink channel this message will be sent over
297 * @param msg The MAVLink message to compress the data into
298 * @param landing_target C-struct to read the message contents from
299 */
300static inline uint16_t mavlink_msg_landing_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target)
301{
302 return mavlink_msg_landing_target_pack_chan(system_id, component_id, chan, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
303}
304
305/**
306 * @brief Encode a landing_target struct with provided status structure
307 *
308 * @param system_id ID of this system
309 * @param component_id ID of this component (e.g. 200 for IMU)
310 * @param status MAVLink status structure
311 * @param msg The MAVLink message to compress the data into
312 * @param landing_target C-struct to read the message contents from
313 */
314static inline uint16_t mavlink_msg_landing_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target)
315{
316 return mavlink_msg_landing_target_pack_status(system_id, component_id, _status, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
317}
318
319/**
320 * @brief Send a landing_target message
321 * @param chan MAVLink channel to send the message
322 *
323 * @param time_usec [us] Timestamp (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.
324 * @param target_num The ID of the target if multiple targets are present
325 * @param frame Coordinate frame used for following fields.
326 * @param angle_x [rad] X-axis angular offset of the target from the center of the image
327 * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
328 * @param distance [m] Distance to the target from the vehicle
329 * @param size_x [rad] Size of target along x-axis
330 * @param size_y [rad] Size of target along y-axis
331 * @param x [m] X Position of the landing target in MAV_FRAME
332 * @param y [m] Y Position of the landing target in MAV_FRAME
333 * @param z [m] Z Position of the landing target in MAV_FRAME
334 * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
335 * @param type Type of landing target
336 * @param position_valid Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.
337 */
338#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
339
340static inline void mavlink_msg_landing_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
341{
342#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
343 char buf[MAVLINK_MSG_ID_LANDING_TARGET_LEN];
344 _mav_put_uint64_t(buf, 0, time_usec);
345 _mav_put_float(buf, 8, angle_x);
346 _mav_put_float(buf, 12, angle_y);
347 _mav_put_float(buf, 16, distance);
348 _mav_put_float(buf, 20, size_x);
349 _mav_put_float(buf, 24, size_y);
350 _mav_put_uint8_t(buf, 28, target_num);
351 _mav_put_uint8_t(buf, 29, frame);
352 _mav_put_float(buf, 30, x);
353 _mav_put_float(buf, 34, y);
354 _mav_put_float(buf, 38, z);
355 _mav_put_uint8_t(buf, 58, type);
356 _mav_put_uint8_t(buf, 59, position_valid);
357 _mav_put_float_array(buf, 42, q, 4);
358 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, buf, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
359#else
360 mavlink_landing_target_t packet;
361 packet.time_usec = time_usec;
362 packet.angle_x = angle_x;
363 packet.angle_y = angle_y;
364 packet.distance = distance;
365 packet.size_x = size_x;
366 packet.size_y = size_y;
367 packet.target_num = target_num;
368 packet.frame = frame;
369 packet.x = x;
370 packet.y = y;
371 packet.z = z;
372 packet.type = type;
373 packet.position_valid = position_valid;
374 mav_array_memcpy(packet.q, q, sizeof(float)*4);
375 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)&packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
376#endif
377}
378
379/**
380 * @brief Send a landing_target message
381 * @param chan MAVLink channel to send the message
382 * @param struct The MAVLink struct to serialize
383 */
384static inline void mavlink_msg_landing_target_send_struct(mavlink_channel_t chan, const mavlink_landing_target_t* landing_target)
385{
386#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
387 mavlink_msg_landing_target_send(chan, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
388#else
389 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)landing_target, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
390#endif
391}
392
393#if MAVLINK_MSG_ID_LANDING_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
394/*
395 This variant of _send() can be used to save stack space by reusing
396 memory from the receive buffer. The caller provides a
397 mavlink_message_t which is the size of a full mavlink message. This
398 is usually the receive buffer for the channel, and allows a reply to an
399 incoming message with minimum stack space usage.
400 */
401static inline void mavlink_msg_landing_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
402{
403#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
404 char *buf = (char *)msgbuf;
405 _mav_put_uint64_t(buf, 0, time_usec);
406 _mav_put_float(buf, 8, angle_x);
407 _mav_put_float(buf, 12, angle_y);
408 _mav_put_float(buf, 16, distance);
409 _mav_put_float(buf, 20, size_x);
410 _mav_put_float(buf, 24, size_y);
411 _mav_put_uint8_t(buf, 28, target_num);
412 _mav_put_uint8_t(buf, 29, frame);
413 _mav_put_float(buf, 30, x);
414 _mav_put_float(buf, 34, y);
415 _mav_put_float(buf, 38, z);
416 _mav_put_uint8_t(buf, 58, type);
417 _mav_put_uint8_t(buf, 59, position_valid);
418 _mav_put_float_array(buf, 42, q, 4);
419 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, buf, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
420#else
421 mavlink_landing_target_t *packet = (mavlink_landing_target_t *)msgbuf;
422 packet->time_usec = time_usec;
423 packet->angle_x = angle_x;
424 packet->angle_y = angle_y;
425 packet->distance = distance;
426 packet->size_x = size_x;
427 packet->size_y = size_y;
428 packet->target_num = target_num;
429 packet->frame = frame;
430 packet->x = x;
431 packet->y = y;
432 packet->z = z;
433 packet->type = type;
434 packet->position_valid = position_valid;
435 mav_array_memcpy(packet->q, q, sizeof(float)*4);
436 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
437#endif
438}
439#endif
440
441#endif
442
443// MESSAGE LANDING_TARGET UNPACKING
444
445
446/**
447 * @brief Get field time_usec from landing_target message
448 *
449 * @return [us] Timestamp (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.
450 */
451static inline uint64_t mavlink_msg_landing_target_get_time_usec(const mavlink_message_t* msg)
452{
453 return _MAV_RETURN_uint64_t(msg, 0);
454}
455
456/**
457 * @brief Get field target_num from landing_target message
458 *
459 * @return The ID of the target if multiple targets are present
460 */
461static inline uint8_t mavlink_msg_landing_target_get_target_num(const mavlink_message_t* msg)
462{
463 return _MAV_RETURN_uint8_t(msg, 28);
464}
465
466/**
467 * @brief Get field frame from landing_target message
468 *
469 * @return Coordinate frame used for following fields.
470 */
471static inline uint8_t mavlink_msg_landing_target_get_frame(const mavlink_message_t* msg)
472{
473 return _MAV_RETURN_uint8_t(msg, 29);
474}
475
476/**
477 * @brief Get field angle_x from landing_target message
478 *
479 * @return [rad] X-axis angular offset of the target from the center of the image
480 */
481static inline float mavlink_msg_landing_target_get_angle_x(const mavlink_message_t* msg)
482{
483 return _MAV_RETURN_float(msg, 8);
484}
485
486/**
487 * @brief Get field angle_y from landing_target message
488 *
489 * @return [rad] Y-axis angular offset of the target from the center of the image
490 */
491static inline float mavlink_msg_landing_target_get_angle_y(const mavlink_message_t* msg)
492{
493 return _MAV_RETURN_float(msg, 12);
494}
495
496/**
497 * @brief Get field distance from landing_target message
498 *
499 * @return [m] Distance to the target from the vehicle
500 */
501static inline float mavlink_msg_landing_target_get_distance(const mavlink_message_t* msg)
502{
503 return _MAV_RETURN_float(msg, 16);
504}
505
506/**
507 * @brief Get field size_x from landing_target message
508 *
509 * @return [rad] Size of target along x-axis
510 */
511static inline float mavlink_msg_landing_target_get_size_x(const mavlink_message_t* msg)
512{
513 return _MAV_RETURN_float(msg, 20);
514}
515
516/**
517 * @brief Get field size_y from landing_target message
518 *
519 * @return [rad] Size of target along y-axis
520 */
521static inline float mavlink_msg_landing_target_get_size_y(const mavlink_message_t* msg)
522{
523 return _MAV_RETURN_float(msg, 24);
524}
525
526/**
527 * @brief Get field x from landing_target message
528 *
529 * @return [m] X Position of the landing target in MAV_FRAME
530 */
531static inline float mavlink_msg_landing_target_get_x(const mavlink_message_t* msg)
532{
533 return _MAV_RETURN_float(msg, 30);
534}
535
536/**
537 * @brief Get field y from landing_target message
538 *
539 * @return [m] Y Position of the landing target in MAV_FRAME
540 */
541static inline float mavlink_msg_landing_target_get_y(const mavlink_message_t* msg)
542{
543 return _MAV_RETURN_float(msg, 34);
544}
545
546/**
547 * @brief Get field z from landing_target message
548 *
549 * @return [m] Z Position of the landing target in MAV_FRAME
550 */
551static inline float mavlink_msg_landing_target_get_z(const mavlink_message_t* msg)
552{
553 return _MAV_RETURN_float(msg, 38);
554}
555
556/**
557 * @brief Get field q from landing_target message
558 *
559 * @return Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
560 */
561static inline uint16_t mavlink_msg_landing_target_get_q(const mavlink_message_t* msg, float *q)
562{
563 return _MAV_RETURN_float_array(msg, q, 4, 42);
564}
565
566/**
567 * @brief Get field type from landing_target message
568 *
569 * @return Type of landing target
570 */
571static inline uint8_t mavlink_msg_landing_target_get_type(const mavlink_message_t* msg)
572{
573 return _MAV_RETURN_uint8_t(msg, 58);
574}
575
576/**
577 * @brief Get field position_valid from landing_target message
578 *
579 * @return Position fields (x, y, z, q, type) contain valid target position information (MAV_BOOL_FALSE: invalid values). Values not equal to 0 or 1 are invalid.
580 */
581static inline uint8_t mavlink_msg_landing_target_get_position_valid(const mavlink_message_t* msg)
582{
583 return _MAV_RETURN_uint8_t(msg, 59);
584}
585
586/**
587 * @brief Decode a landing_target message into a struct
588 *
589 * @param msg The message to decode
590 * @param landing_target C-struct to decode the message contents into
591 */
592static inline void mavlink_msg_landing_target_decode(const mavlink_message_t* msg, mavlink_landing_target_t* landing_target)
593{
594#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
595 landing_target->time_usec = mavlink_msg_landing_target_get_time_usec(msg);
596 landing_target->angle_x = mavlink_msg_landing_target_get_angle_x(msg);
597 landing_target->angle_y = mavlink_msg_landing_target_get_angle_y(msg);
598 landing_target->distance = mavlink_msg_landing_target_get_distance(msg);
599 landing_target->size_x = mavlink_msg_landing_target_get_size_x(msg);
600 landing_target->size_y = mavlink_msg_landing_target_get_size_y(msg);
601 landing_target->target_num = mavlink_msg_landing_target_get_target_num(msg);
602 landing_target->frame = mavlink_msg_landing_target_get_frame(msg);
603 landing_target->x = mavlink_msg_landing_target_get_x(msg);
604 landing_target->y = mavlink_msg_landing_target_get_y(msg);
605 landing_target->z = mavlink_msg_landing_target_get_z(msg);
606 mavlink_msg_landing_target_get_q(msg, landing_target->q);
607 landing_target->type = mavlink_msg_landing_target_get_type(msg);
608 landing_target->position_valid = mavlink_msg_landing_target_get_position_valid(msg);
609#else
610 uint8_t len = msg->len < MAVLINK_MSG_ID_LANDING_TARGET_LEN? msg->len : MAVLINK_MSG_ID_LANDING_TARGET_LEN;
611 memset(landing_target, 0, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
612 memcpy(landing_target, _MAV_PAYLOAD(msg), len);
613#endif
614}