Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_follow_target.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE FOLLOW_TARGET PACKING
3
4#define MAVLINK_MSG_ID_FOLLOW_TARGET 144
5
6
8 uint64_t timestamp; /*< [ms] Timestamp (time since system boot).*/
9 uint64_t custom_state; /*< button states or switches of a tracker device*/
10 int32_t lat; /*< [degE7] Latitude (WGS84)*/
11 int32_t lon; /*< [degE7] Longitude (WGS84)*/
12 float alt; /*< [m] Altitude (MSL)*/
13 float vel[3]; /*< [m/s] target velocity (0,0,0) for unknown*/
14 float acc[3]; /*< [m/s/s] linear target acceleration (0,0,0) for unknown*/
15 float attitude_q[4]; /*< (0 0 0 0 for unknown)*/
16 float rates[3]; /*< (0 0 0 for unknown)*/
17 float position_cov[3]; /*< eph epv*/
18 uint8_t est_capabilities; /*< bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)*/
19} mavlink_follow_target_t;
20
21#define MAVLINK_MSG_ID_FOLLOW_TARGET_LEN 93
22#define MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN 93
23#define MAVLINK_MSG_ID_144_LEN 93
24#define MAVLINK_MSG_ID_144_MIN_LEN 93
25
26#define MAVLINK_MSG_ID_FOLLOW_TARGET_CRC 127
27#define MAVLINK_MSG_ID_144_CRC 127
28
29#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_VEL_LEN 3
30#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ACC_LEN 3
31#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ATTITUDE_Q_LEN 4
32#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_RATES_LEN 3
33#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_POSITION_COV_LEN 3
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET {
37 144,
38 "FOLLOW_TARGET",
39 11,
40 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) },
41 { "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) },
42 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) },
43 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) },
44 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) },
45 { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) },
46 { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) },
47 { "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) },
48 { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) },
49 { "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) },
50 { "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) },
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET {
55 "FOLLOW_TARGET",
56 11,
57 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) },
58 { "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) },
59 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) },
60 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) },
61 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) },
62 { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) },
63 { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) },
64 { "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) },
65 { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) },
66 { "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) },
67 { "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) },
68 } \
69}
70#endif
71
72/**
73 * @brief Pack a follow_target message
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param msg The MAVLink message to compress the data into
77 *
78 * @param timestamp [ms] Timestamp (time since system boot).
79 * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
80 * @param lat [degE7] Latitude (WGS84)
81 * @param lon [degE7] Longitude (WGS84)
82 * @param alt [m] Altitude (MSL)
83 * @param vel [m/s] target velocity (0,0,0) for unknown
84 * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
85 * @param attitude_q (0 0 0 0 for unknown)
86 * @param rates (0 0 0 for unknown)
87 * @param position_cov eph epv
88 * @param custom_state button states or switches of a tracker device
89 * @return length of the message in bytes (excluding serial stream start sign)
90 */
91static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
92 uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
93{
94#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
96 _mav_put_uint64_t(buf, 0, timestamp);
97 _mav_put_uint64_t(buf, 8, custom_state);
98 _mav_put_int32_t(buf, 16, lat);
99 _mav_put_int32_t(buf, 20, lon);
100 _mav_put_float(buf, 24, alt);
101 _mav_put_uint8_t(buf, 92, est_capabilities);
102 _mav_put_float_array(buf, 28, vel, 3);
103 _mav_put_float_array(buf, 40, acc, 3);
104 _mav_put_float_array(buf, 52, attitude_q, 4);
105 _mav_put_float_array(buf, 68, rates, 3);
106 _mav_put_float_array(buf, 80, position_cov, 3);
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
108#else
109 mavlink_follow_target_t packet;
110 packet.timestamp = timestamp;
111 packet.custom_state = custom_state;
112 packet.lat = lat;
113 packet.lon = lon;
114 packet.alt = alt;
115 packet.est_capabilities = est_capabilities;
116 mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
117 mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
118 mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
119 mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
120 mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
122#endif
123
124 msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
125 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
126}
127
128/**
129 * @brief Pack a follow_target message
130 * @param system_id ID of this system
131 * @param component_id ID of this component (e.g. 200 for IMU)
132 * @param status MAVLink status structure
133 * @param msg The MAVLink message to compress the data into
134 *
135 * @param timestamp [ms] Timestamp (time since system boot).
136 * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
137 * @param lat [degE7] Latitude (WGS84)
138 * @param lon [degE7] Longitude (WGS84)
139 * @param alt [m] Altitude (MSL)
140 * @param vel [m/s] target velocity (0,0,0) for unknown
141 * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
142 * @param attitude_q (0 0 0 0 for unknown)
143 * @param rates (0 0 0 for unknown)
144 * @param position_cov eph epv
145 * @param custom_state button states or switches of a tracker device
146 * @return length of the message in bytes (excluding serial stream start sign)
147 */
148static inline uint16_t mavlink_msg_follow_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
149 uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
150{
151#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
153 _mav_put_uint64_t(buf, 0, timestamp);
154 _mav_put_uint64_t(buf, 8, custom_state);
155 _mav_put_int32_t(buf, 16, lat);
156 _mav_put_int32_t(buf, 20, lon);
157 _mav_put_float(buf, 24, alt);
158 _mav_put_uint8_t(buf, 92, est_capabilities);
159 _mav_put_float_array(buf, 28, vel, 3);
160 _mav_put_float_array(buf, 40, acc, 3);
161 _mav_put_float_array(buf, 52, attitude_q, 4);
162 _mav_put_float_array(buf, 68, rates, 3);
163 _mav_put_float_array(buf, 80, position_cov, 3);
164 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
165#else
166 mavlink_follow_target_t packet;
167 packet.timestamp = timestamp;
168 packet.custom_state = custom_state;
169 packet.lat = lat;
170 packet.lon = lon;
171 packet.alt = alt;
172 packet.est_capabilities = est_capabilities;
173 mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
174 mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
175 mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
176 mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
177 mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
179#endif
180
181 msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
182#if MAVLINK_CRC_EXTRA
183 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
184#else
185 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
186#endif
187}
188
189/**
190 * @brief Pack a follow_target message on a channel
191 * @param system_id ID of this system
192 * @param component_id ID of this component (e.g. 200 for IMU)
193 * @param chan The MAVLink channel this message will be sent over
194 * @param msg The MAVLink message to compress the data into
195 * @param timestamp [ms] Timestamp (time since system boot).
196 * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
197 * @param lat [degE7] Latitude (WGS84)
198 * @param lon [degE7] Longitude (WGS84)
199 * @param alt [m] Altitude (MSL)
200 * @param vel [m/s] target velocity (0,0,0) for unknown
201 * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
202 * @param attitude_q (0 0 0 0 for unknown)
203 * @param rates (0 0 0 for unknown)
204 * @param position_cov eph epv
205 * @param custom_state button states or switches of a tracker device
206 * @return length of the message in bytes (excluding serial stream start sign)
207 */
208static inline uint16_t mavlink_msg_follow_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
209 mavlink_message_t* msg,
210 uint64_t timestamp,uint8_t est_capabilities,int32_t lat,int32_t lon,float alt,const float *vel,const float *acc,const float *attitude_q,const float *rates,const float *position_cov,uint64_t custom_state)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
214 _mav_put_uint64_t(buf, 0, timestamp);
215 _mav_put_uint64_t(buf, 8, custom_state);
216 _mav_put_int32_t(buf, 16, lat);
217 _mav_put_int32_t(buf, 20, lon);
218 _mav_put_float(buf, 24, alt);
219 _mav_put_uint8_t(buf, 92, est_capabilities);
220 _mav_put_float_array(buf, 28, vel, 3);
221 _mav_put_float_array(buf, 40, acc, 3);
222 _mav_put_float_array(buf, 52, attitude_q, 4);
223 _mav_put_float_array(buf, 68, rates, 3);
224 _mav_put_float_array(buf, 80, position_cov, 3);
225 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
226#else
227 mavlink_follow_target_t packet;
228 packet.timestamp = timestamp;
229 packet.custom_state = custom_state;
230 packet.lat = lat;
231 packet.lon = lon;
232 packet.alt = alt;
233 packet.est_capabilities = est_capabilities;
234 mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
235 mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
236 mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
237 mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
238 mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
239 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
240#endif
241
242 msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
243 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
244}
245
246/**
247 * @brief Encode a follow_target struct
248 *
249 * @param system_id ID of this system
250 * @param component_id ID of this component (e.g. 200 for IMU)
251 * @param msg The MAVLink message to compress the data into
252 * @param follow_target C-struct to read the message contents from
253 */
254static inline uint16_t mavlink_msg_follow_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
255{
256 return mavlink_msg_follow_target_pack(system_id, component_id, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
257}
258
259/**
260 * @brief Encode a follow_target struct on a channel
261 *
262 * @param system_id ID of this system
263 * @param component_id ID of this component (e.g. 200 for IMU)
264 * @param chan The MAVLink channel this message will be sent over
265 * @param msg The MAVLink message to compress the data into
266 * @param follow_target C-struct to read the message contents from
267 */
268static inline uint16_t mavlink_msg_follow_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
269{
270 return mavlink_msg_follow_target_pack_chan(system_id, component_id, chan, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
271}
272
273/**
274 * @brief Encode a follow_target struct with provided status structure
275 *
276 * @param system_id ID of this system
277 * @param component_id ID of this component (e.g. 200 for IMU)
278 * @param status MAVLink status structure
279 * @param msg The MAVLink message to compress the data into
280 * @param follow_target C-struct to read the message contents from
281 */
282static inline uint16_t mavlink_msg_follow_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
283{
284 return mavlink_msg_follow_target_pack_status(system_id, component_id, _status, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
285}
286
287/**
288 * @brief Send a follow_target message
289 * @param chan MAVLink channel to send the message
290 *
291 * @param timestamp [ms] Timestamp (time since system boot).
292 * @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
293 * @param lat [degE7] Latitude (WGS84)
294 * @param lon [degE7] Longitude (WGS84)
295 * @param alt [m] Altitude (MSL)
296 * @param vel [m/s] target velocity (0,0,0) for unknown
297 * @param acc [m/s/s] linear target acceleration (0,0,0) for unknown
298 * @param attitude_q (0 0 0 0 for unknown)
299 * @param rates (0 0 0 for unknown)
300 * @param position_cov eph epv
301 * @param custom_state button states or switches of a tracker device
302 */
303#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
304
305static inline void mavlink_msg_follow_target_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
306{
307#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
308 char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
309 _mav_put_uint64_t(buf, 0, timestamp);
310 _mav_put_uint64_t(buf, 8, custom_state);
311 _mav_put_int32_t(buf, 16, lat);
312 _mav_put_int32_t(buf, 20, lon);
313 _mav_put_float(buf, 24, alt);
314 _mav_put_uint8_t(buf, 92, est_capabilities);
315 _mav_put_float_array(buf, 28, vel, 3);
316 _mav_put_float_array(buf, 40, acc, 3);
317 _mav_put_float_array(buf, 52, attitude_q, 4);
318 _mav_put_float_array(buf, 68, rates, 3);
319 _mav_put_float_array(buf, 80, position_cov, 3);
320 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
321#else
322 mavlink_follow_target_t packet;
323 packet.timestamp = timestamp;
324 packet.custom_state = custom_state;
325 packet.lat = lat;
326 packet.lon = lon;
327 packet.alt = alt;
328 packet.est_capabilities = est_capabilities;
329 mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
330 mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
331 mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
332 mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
333 mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
334 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
335#endif
336}
337
338/**
339 * @brief Send a follow_target message
340 * @param chan MAVLink channel to send the message
341 * @param struct The MAVLink struct to serialize
342 */
343static inline void mavlink_msg_follow_target_send_struct(mavlink_channel_t chan, const mavlink_follow_target_t* follow_target)
344{
345#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
346 mavlink_msg_follow_target_send(chan, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
347#else
348 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)follow_target, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
349#endif
350}
351
352#if MAVLINK_MSG_ID_FOLLOW_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
353/*
354 This variant of _send() can be used to save stack space by reusing
355 memory from the receive buffer. The caller provides a
356 mavlink_message_t which is the size of a full mavlink message. This
357 is usually the receive buffer for the channel, and allows a reply to an
358 incoming message with minimum stack space usage.
359 */
360static inline void mavlink_msg_follow_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
361{
362#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
363 char *buf = (char *)msgbuf;
364 _mav_put_uint64_t(buf, 0, timestamp);
365 _mav_put_uint64_t(buf, 8, custom_state);
366 _mav_put_int32_t(buf, 16, lat);
367 _mav_put_int32_t(buf, 20, lon);
368 _mav_put_float(buf, 24, alt);
369 _mav_put_uint8_t(buf, 92, est_capabilities);
370 _mav_put_float_array(buf, 28, vel, 3);
371 _mav_put_float_array(buf, 40, acc, 3);
372 _mav_put_float_array(buf, 52, attitude_q, 4);
373 _mav_put_float_array(buf, 68, rates, 3);
374 _mav_put_float_array(buf, 80, position_cov, 3);
375 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
376#else
377 mavlink_follow_target_t *packet = (mavlink_follow_target_t *)msgbuf;
378 packet->timestamp = timestamp;
379 packet->custom_state = custom_state;
380 packet->lat = lat;
381 packet->lon = lon;
382 packet->alt = alt;
383 packet->est_capabilities = est_capabilities;
384 mav_array_memcpy(packet->vel, vel, sizeof(float)*3);
385 mav_array_memcpy(packet->acc, acc, sizeof(float)*3);
386 mav_array_memcpy(packet->attitude_q, attitude_q, sizeof(float)*4);
387 mav_array_memcpy(packet->rates, rates, sizeof(float)*3);
388 mav_array_memcpy(packet->position_cov, position_cov, sizeof(float)*3);
389 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
390#endif
391}
392#endif
393
394#endif
395
396// MESSAGE FOLLOW_TARGET UNPACKING
397
398
399/**
400 * @brief Get field timestamp from follow_target message
401 *
402 * @return [ms] Timestamp (time since system boot).
403 */
404static inline uint64_t mavlink_msg_follow_target_get_timestamp(const mavlink_message_t* msg)
405{
406 return _MAV_RETURN_uint64_t(msg, 0);
407}
408
409/**
410 * @brief Get field est_capabilities from follow_target message
411 *
412 * @return bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
413 */
414static inline uint8_t mavlink_msg_follow_target_get_est_capabilities(const mavlink_message_t* msg)
415{
416 return _MAV_RETURN_uint8_t(msg, 92);
417}
418
419/**
420 * @brief Get field lat from follow_target message
421 *
422 * @return [degE7] Latitude (WGS84)
423 */
424static inline int32_t mavlink_msg_follow_target_get_lat(const mavlink_message_t* msg)
425{
426 return _MAV_RETURN_int32_t(msg, 16);
427}
428
429/**
430 * @brief Get field lon from follow_target message
431 *
432 * @return [degE7] Longitude (WGS84)
433 */
434static inline int32_t mavlink_msg_follow_target_get_lon(const mavlink_message_t* msg)
435{
436 return _MAV_RETURN_int32_t(msg, 20);
437}
438
439/**
440 * @brief Get field alt from follow_target message
441 *
442 * @return [m] Altitude (MSL)
443 */
444static inline float mavlink_msg_follow_target_get_alt(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_float(msg, 24);
447}
448
449/**
450 * @brief Get field vel from follow_target message
451 *
452 * @return [m/s] target velocity (0,0,0) for unknown
453 */
454static inline uint16_t mavlink_msg_follow_target_get_vel(const mavlink_message_t* msg, float *vel)
455{
456 return _MAV_RETURN_float_array(msg, vel, 3, 28);
457}
458
459/**
460 * @brief Get field acc from follow_target message
461 *
462 * @return [m/s/s] linear target acceleration (0,0,0) for unknown
463 */
464static inline uint16_t mavlink_msg_follow_target_get_acc(const mavlink_message_t* msg, float *acc)
465{
466 return _MAV_RETURN_float_array(msg, acc, 3, 40);
467}
468
469/**
470 * @brief Get field attitude_q from follow_target message
471 *
472 * @return (0 0 0 0 for unknown)
473 */
474static inline uint16_t mavlink_msg_follow_target_get_attitude_q(const mavlink_message_t* msg, float *attitude_q)
475{
476 return _MAV_RETURN_float_array(msg, attitude_q, 4, 52);
477}
478
479/**
480 * @brief Get field rates from follow_target message
481 *
482 * @return (0 0 0 for unknown)
483 */
484static inline uint16_t mavlink_msg_follow_target_get_rates(const mavlink_message_t* msg, float *rates)
485{
486 return _MAV_RETURN_float_array(msg, rates, 3, 68);
487}
488
489/**
490 * @brief Get field position_cov from follow_target message
491 *
492 * @return eph epv
493 */
494static inline uint16_t mavlink_msg_follow_target_get_position_cov(const mavlink_message_t* msg, float *position_cov)
495{
496 return _MAV_RETURN_float_array(msg, position_cov, 3, 80);
497}
498
499/**
500 * @brief Get field custom_state from follow_target message
501 *
502 * @return button states or switches of a tracker device
503 */
504static inline uint64_t mavlink_msg_follow_target_get_custom_state(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_uint64_t(msg, 8);
507}
508
509/**
510 * @brief Decode a follow_target message into a struct
511 *
512 * @param msg The message to decode
513 * @param follow_target C-struct to decode the message contents into
514 */
515static inline void mavlink_msg_follow_target_decode(const mavlink_message_t* msg, mavlink_follow_target_t* follow_target)
516{
517#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
518 follow_target->timestamp = mavlink_msg_follow_target_get_timestamp(msg);
519 follow_target->custom_state = mavlink_msg_follow_target_get_custom_state(msg);
520 follow_target->lat = mavlink_msg_follow_target_get_lat(msg);
521 follow_target->lon = mavlink_msg_follow_target_get_lon(msg);
522 follow_target->alt = mavlink_msg_follow_target_get_alt(msg);
523 mavlink_msg_follow_target_get_vel(msg, follow_target->vel);
524 mavlink_msg_follow_target_get_acc(msg, follow_target->acc);
525 mavlink_msg_follow_target_get_attitude_q(msg, follow_target->attitude_q);
526 mavlink_msg_follow_target_get_rates(msg, follow_target->rates);
527 mavlink_msg_follow_target_get_position_cov(msg, follow_target->position_cov);
528 follow_target->est_capabilities = mavlink_msg_follow_target_get_est_capabilities(msg);
529#else
530 uint8_t len = msg->len < MAVLINK_MSG_ID_FOLLOW_TARGET_LEN? msg->len : MAVLINK_MSG_ID_FOLLOW_TARGET_LEN;
531 memset(follow_target, 0, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
532 memcpy(follow_target, _MAV_PAYLOAD(msg), len);
533#endif
534}