2 // MESSAGE LANDING_TARGET PACKING
4 #define MAVLINK_MSG_ID_LANDING_TARGET 149
7 typedef struct __mavlink_landing_target_t
{
8 uint64_t time_usec
; /*< Timestamp (micros since boot or Unix epoch)*/
9 float angle_x
; /*< X-axis angular offset (in radians) of the target from the center of the image*/
10 float angle_y
; /*< Y-axis angular offset (in radians) of the target from the center of the image*/
11 float distance
; /*< Distance to the target from the vehicle in meters*/
12 float size_x
; /*< Size in radians of target along x-axis*/
13 float size_y
; /*< Size in radians of target along y-axis*/
14 uint8_t target_num
; /*< The ID of the target if multiple targets are present*/
15 uint8_t frame
; /*< MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc.*/
16 }) mavlink_landing_target_t
;
18 #define MAVLINK_MSG_ID_LANDING_TARGET_LEN 30
19 #define MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN 30
20 #define MAVLINK_MSG_ID_149_LEN 30
21 #define MAVLINK_MSG_ID_149_MIN_LEN 30
23 #define MAVLINK_MSG_ID_LANDING_TARGET_CRC 200
24 #define MAVLINK_MSG_ID_149_CRC 200
28 #if MAVLINK_COMMAND_24BIT
29 #define MAVLINK_MESSAGE_INFO_LANDING_TARGET { \
33 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) }, \
34 { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) }, \
35 { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) }, \
36 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) }, \
37 { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) }, \
38 { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) }, \
39 { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) }, \
40 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) }, \
44 #define MAVLINK_MESSAGE_INFO_LANDING_TARGET { \
47 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) }, \
48 { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) }, \
49 { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) }, \
50 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) }, \
51 { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) }, \
52 { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) }, \
53 { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) }, \
54 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) }, \
60 * @brief Pack a landing_target message
61 * @param system_id ID of this system
62 * @param component_id ID of this component (e.g. 200 for IMU)
63 * @param msg The MAVLink message to compress the data into
65 * @param time_usec Timestamp (micros since boot or Unix epoch)
66 * @param target_num The ID of the target if multiple targets are present
67 * @param frame MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc.
68 * @param angle_x X-axis angular offset (in radians) of the target from the center of the image
69 * @param angle_y Y-axis angular offset (in radians) of the target from the center of the image
70 * @param distance Distance to the target from the vehicle in meters
71 * @param size_x Size in radians of target along x-axis
72 * @param size_y Size in radians of target along y-axis
73 * @return length of the message in bytes (excluding serial stream start sign)
75 static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
76 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
)
78 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79 char buf
[MAVLINK_MSG_ID_LANDING_TARGET_LEN
];
80 _mav_put_uint64_t(buf
, 0, time_usec
);
81 _mav_put_float(buf
, 8, angle_x
);
82 _mav_put_float(buf
, 12, angle_y
);
83 _mav_put_float(buf
, 16, distance
);
84 _mav_put_float(buf
, 20, size_x
);
85 _mav_put_float(buf
, 24, size_y
);
86 _mav_put_uint8_t(buf
, 28, target_num
);
87 _mav_put_uint8_t(buf
, 29, frame
);
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_LANDING_TARGET_LEN
);
91 mavlink_landing_target_t packet
;
92 packet
.time_usec
= time_usec
;
93 packet
.angle_x
= angle_x
;
94 packet
.angle_y
= angle_y
;
95 packet
.distance
= distance
;
96 packet
.size_x
= size_x
;
97 packet
.size_y
= size_y
;
98 packet
.target_num
= target_num
;
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_LANDING_TARGET_LEN
);
104 msg
->msgid
= MAVLINK_MSG_ID_LANDING_TARGET
;
105 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
);
109 * @brief Pack a landing_target message on a channel
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param chan The MAVLink channel this message will be sent over
113 * @param msg The MAVLink message to compress the data into
114 * @param time_usec Timestamp (micros since boot or Unix epoch)
115 * @param target_num The ID of the target if multiple targets are present
116 * @param frame MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc.
117 * @param angle_x X-axis angular offset (in radians) of the target from the center of the image
118 * @param angle_y Y-axis angular offset (in radians) of the target from the center of the image
119 * @param distance Distance to the target from the vehicle in meters
120 * @param size_x Size in radians of target along x-axis
121 * @param size_y Size in radians of target along y-axis
122 * @return length of the message in bytes (excluding serial stream start sign)
124 static inline uint16_t mavlink_msg_landing_target_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
125 mavlink_message_t
* msg
,
126 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
)
128 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
129 char buf
[MAVLINK_MSG_ID_LANDING_TARGET_LEN
];
130 _mav_put_uint64_t(buf
, 0, time_usec
);
131 _mav_put_float(buf
, 8, angle_x
);
132 _mav_put_float(buf
, 12, angle_y
);
133 _mav_put_float(buf
, 16, distance
);
134 _mav_put_float(buf
, 20, size_x
);
135 _mav_put_float(buf
, 24, size_y
);
136 _mav_put_uint8_t(buf
, 28, target_num
);
137 _mav_put_uint8_t(buf
, 29, frame
);
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_LANDING_TARGET_LEN
);
141 mavlink_landing_target_t packet
;
142 packet
.time_usec
= time_usec
;
143 packet
.angle_x
= angle_x
;
144 packet
.angle_y
= angle_y
;
145 packet
.distance
= distance
;
146 packet
.size_x
= size_x
;
147 packet
.size_y
= size_y
;
148 packet
.target_num
= target_num
;
149 packet
.frame
= frame
;
151 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_LANDING_TARGET_LEN
);
154 msg
->msgid
= MAVLINK_MSG_ID_LANDING_TARGET
;
155 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
);
159 * @brief Encode a landing_target struct
161 * @param system_id ID of this system
162 * @param component_id ID of this component (e.g. 200 for IMU)
163 * @param msg The MAVLink message to compress the data into
164 * @param landing_target C-struct to read the message contents from
166 static 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
)
168 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
);
172 * @brief Encode a landing_target struct on a channel
174 * @param system_id ID of this system
175 * @param component_id ID of this component (e.g. 200 for IMU)
176 * @param chan The MAVLink channel this message will be sent over
177 * @param msg The MAVLink message to compress the data into
178 * @param landing_target C-struct to read the message contents from
180 static 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
)
182 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
);
186 * @brief Send a landing_target message
187 * @param chan MAVLink channel to send the message
189 * @param time_usec Timestamp (micros since boot or Unix epoch)
190 * @param target_num The ID of the target if multiple targets are present
191 * @param frame MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc.
192 * @param angle_x X-axis angular offset (in radians) of the target from the center of the image
193 * @param angle_y Y-axis angular offset (in radians) of the target from the center of the image
194 * @param distance Distance to the target from the vehicle in meters
195 * @param size_x Size in radians of target along x-axis
196 * @param size_y Size in radians of target along y-axis
198 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
200 static 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
)
202 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
203 char buf
[MAVLINK_MSG_ID_LANDING_TARGET_LEN
];
204 _mav_put_uint64_t(buf
, 0, time_usec
);
205 _mav_put_float(buf
, 8, angle_x
);
206 _mav_put_float(buf
, 12, angle_y
);
207 _mav_put_float(buf
, 16, distance
);
208 _mav_put_float(buf
, 20, size_x
);
209 _mav_put_float(buf
, 24, size_y
);
210 _mav_put_uint8_t(buf
, 28, target_num
);
211 _mav_put_uint8_t(buf
, 29, frame
);
213 _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
);
215 mavlink_landing_target_t packet
;
216 packet
.time_usec
= time_usec
;
217 packet
.angle_x
= angle_x
;
218 packet
.angle_y
= angle_y
;
219 packet
.distance
= distance
;
220 packet
.size_x
= size_x
;
221 packet
.size_y
= size_y
;
222 packet
.target_num
= target_num
;
223 packet
.frame
= frame
;
225 _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
);
230 * @brief Send a landing_target message
231 * @param chan MAVLink channel to send the message
232 * @param struct The MAVLink struct to serialize
234 static inline void mavlink_msg_landing_target_send_struct(mavlink_channel_t chan
, const mavlink_landing_target_t
* landing_target
)
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 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
);
239 _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
);
243 #if MAVLINK_MSG_ID_LANDING_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
245 This varient of _send() can be used to save stack space by re-using
246 memory from the receive buffer. The caller provides a
247 mavlink_message_t which is the size of a full mavlink message. This
248 is usually the receive buffer for the channel, and allows a reply to an
249 incoming message with minimum stack space usage.
251 static 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
)
253 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
254 char *buf
= (char *)msgbuf
;
255 _mav_put_uint64_t(buf
, 0, time_usec
);
256 _mav_put_float(buf
, 8, angle_x
);
257 _mav_put_float(buf
, 12, angle_y
);
258 _mav_put_float(buf
, 16, distance
);
259 _mav_put_float(buf
, 20, size_x
);
260 _mav_put_float(buf
, 24, size_y
);
261 _mav_put_uint8_t(buf
, 28, target_num
);
262 _mav_put_uint8_t(buf
, 29, frame
);
264 _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
);
266 mavlink_landing_target_t
*packet
= (mavlink_landing_target_t
*)msgbuf
;
267 packet
->time_usec
= time_usec
;
268 packet
->angle_x
= angle_x
;
269 packet
->angle_y
= angle_y
;
270 packet
->distance
= distance
;
271 packet
->size_x
= size_x
;
272 packet
->size_y
= size_y
;
273 packet
->target_num
= target_num
;
274 packet
->frame
= frame
;
276 _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
);
283 // MESSAGE LANDING_TARGET UNPACKING
287 * @brief Get field time_usec from landing_target message
289 * @return Timestamp (micros since boot or Unix epoch)
291 static inline uint64_t mavlink_msg_landing_target_get_time_usec(const mavlink_message_t
* msg
)
293 return _MAV_RETURN_uint64_t(msg
, 0);
297 * @brief Get field target_num from landing_target message
299 * @return The ID of the target if multiple targets are present
301 static inline uint8_t mavlink_msg_landing_target_get_target_num(const mavlink_message_t
* msg
)
303 return _MAV_RETURN_uint8_t(msg
, 28);
307 * @brief Get field frame from landing_target message
309 * @return MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc.
311 static inline uint8_t mavlink_msg_landing_target_get_frame(const mavlink_message_t
* msg
)
313 return _MAV_RETURN_uint8_t(msg
, 29);
317 * @brief Get field angle_x from landing_target message
319 * @return X-axis angular offset (in radians) of the target from the center of the image
321 static inline float mavlink_msg_landing_target_get_angle_x(const mavlink_message_t
* msg
)
323 return _MAV_RETURN_float(msg
, 8);
327 * @brief Get field angle_y from landing_target message
329 * @return Y-axis angular offset (in radians) of the target from the center of the image
331 static inline float mavlink_msg_landing_target_get_angle_y(const mavlink_message_t
* msg
)
333 return _MAV_RETURN_float(msg
, 12);
337 * @brief Get field distance from landing_target message
339 * @return Distance to the target from the vehicle in meters
341 static inline float mavlink_msg_landing_target_get_distance(const mavlink_message_t
* msg
)
343 return _MAV_RETURN_float(msg
, 16);
347 * @brief Get field size_x from landing_target message
349 * @return Size in radians of target along x-axis
351 static inline float mavlink_msg_landing_target_get_size_x(const mavlink_message_t
* msg
)
353 return _MAV_RETURN_float(msg
, 20);
357 * @brief Get field size_y from landing_target message
359 * @return Size in radians of target along y-axis
361 static inline float mavlink_msg_landing_target_get_size_y(const mavlink_message_t
* msg
)
363 return _MAV_RETURN_float(msg
, 24);
367 * @brief Decode a landing_target message into a struct
369 * @param msg The message to decode
370 * @param landing_target C-struct to decode the message contents into
372 static inline void mavlink_msg_landing_target_decode(const mavlink_message_t
* msg
, mavlink_landing_target_t
* landing_target
)
374 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 landing_target
->time_usec
= mavlink_msg_landing_target_get_time_usec(msg
);
376 landing_target
->angle_x
= mavlink_msg_landing_target_get_angle_x(msg
);
377 landing_target
->angle_y
= mavlink_msg_landing_target_get_angle_y(msg
);
378 landing_target
->distance
= mavlink_msg_landing_target_get_distance(msg
);
379 landing_target
->size_x
= mavlink_msg_landing_target_get_size_x(msg
);
380 landing_target
->size_y
= mavlink_msg_landing_target_get_size_y(msg
);
381 landing_target
->target_num
= mavlink_msg_landing_target_get_target_num(msg
);
382 landing_target
->frame
= mavlink_msg_landing_target_get_frame(msg
);
384 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_LANDING_TARGET_LEN
? msg
->len
: MAVLINK_MSG_ID_LANDING_TARGET_LEN
;
385 memset(landing_target
, 0, MAVLINK_MSG_ID_LANDING_TARGET_LEN
);
386 memcpy(landing_target
, _MAV_PAYLOAD(msg
), len
);