source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_follow_target.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

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