mavlink_msg_follow_target.h
Go to the documentation of this file.
1 // MESSAGE FOLLOW_TARGET PACKING
2 
3 #define MAVLINK_MSG_ID_FOLLOW_TARGET 144
4 
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)*/
19 
20 #define MAVLINK_MSG_ID_FOLLOW_TARGET_LEN 93
21 #define MAVLINK_MSG_ID_144_LEN 93
22 
23 #define MAVLINK_MSG_ID_FOLLOW_TARGET_CRC 127
24 #define MAVLINK_MSG_ID_144_CRC 127
25 
26 #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_VEL_LEN 3
27 #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ACC_LEN 3
28 #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ATTITUDE_Q_LEN 4
29 #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_RATES_LEN 3
30 #define MAVLINK_MSG_FOLLOW_TARGET_FIELD_POSITION_COV_LEN 3
31 
32 #define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET { \
33  "FOLLOW_TARGET", \
34  11, \
35  { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) }, \
36  { "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) }, \
37  { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) }, \
38  { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) }, \
39  { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) }, \
40  { "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) }, \
41  { "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) }, \
42  { "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) }, \
43  { "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) }, \
44  { "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) }, \
45  { "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) }, \
46  } \
47 }
48 
49 
69 static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
70  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)
71 {
72 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
74  _mav_put_uint64_t(buf, 0, timestamp);
75  _mav_put_uint64_t(buf, 8, custom_state);
76  _mav_put_int32_t(buf, 16, lat);
77  _mav_put_int32_t(buf, 20, lon);
78  _mav_put_float(buf, 24, alt);
79  _mav_put_uint8_t(buf, 92, est_capabilities);
80  _mav_put_float_array(buf, 28, vel, 3);
81  _mav_put_float_array(buf, 40, acc, 3);
82  _mav_put_float_array(buf, 52, attitude_q, 4);
83  _mav_put_float_array(buf, 68, rates, 3);
84  _mav_put_float_array(buf, 80, position_cov, 3);
86 #else
88  packet.timestamp = timestamp;
89  packet.custom_state = custom_state;
90  packet.lat = lat;
91  packet.lon = lon;
92  packet.alt = alt;
94  mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
95  mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
96  mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
97  mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
98  mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
100 #endif
101 
102  msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
103 #if MAVLINK_CRC_EXTRA
105 #else
106  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
107 #endif
108 }
109 
129 static inline uint16_t mavlink_msg_follow_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
130  mavlink_message_t* msg,
131  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)
132 {
133 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
135  _mav_put_uint64_t(buf, 0, timestamp);
136  _mav_put_uint64_t(buf, 8, custom_state);
137  _mav_put_int32_t(buf, 16, lat);
138  _mav_put_int32_t(buf, 20, lon);
139  _mav_put_float(buf, 24, alt);
140  _mav_put_uint8_t(buf, 92, est_capabilities);
141  _mav_put_float_array(buf, 28, vel, 3);
142  _mav_put_float_array(buf, 40, acc, 3);
143  _mav_put_float_array(buf, 52, attitude_q, 4);
144  _mav_put_float_array(buf, 68, rates, 3);
145  _mav_put_float_array(buf, 80, position_cov, 3);
147 #else
149  packet.timestamp = timestamp;
150  packet.custom_state = custom_state;
151  packet.lat = lat;
152  packet.lon = lon;
153  packet.alt = alt;
155  mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
156  mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
157  mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
158  mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
159  mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
161 #endif
162 
163  msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
164 #if MAVLINK_CRC_EXTRA
166 #else
167  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
168 #endif
169 }
170 
179 static 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)
180 {
181  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);
182 }
183 
193 static 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)
194 {
195  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);
196 }
197 
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
215 
216 static 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)
217 {
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
220  _mav_put_uint64_t(buf, 0, timestamp);
221  _mav_put_uint64_t(buf, 8, custom_state);
222  _mav_put_int32_t(buf, 16, lat);
223  _mav_put_int32_t(buf, 20, lon);
224  _mav_put_float(buf, 24, alt);
226  _mav_put_float_array(buf, 28, vel, 3);
227  _mav_put_float_array(buf, 40, acc, 3);
228  _mav_put_float_array(buf, 52, attitude_q, 4);
229  _mav_put_float_array(buf, 68, rates, 3);
230  _mav_put_float_array(buf, 80, position_cov, 3);
231 #if MAVLINK_CRC_EXTRA
233 #else
234  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
235 #endif
236 #else
238  packet.timestamp = timestamp;
239  packet.custom_state = custom_state;
240  packet.lat = lat;
241  packet.lon = lon;
242  packet.alt = alt;
244  mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
245  mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
246  mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
247  mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
248  mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
249 #if MAVLINK_CRC_EXTRA
250  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
251 #else
252  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
253 #endif
254 #endif
255 }
256 
257 #if MAVLINK_MSG_ID_FOLLOW_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
258 /*
259  This varient of _send() can be used to save stack space by re-using
260  memory from the receive buffer. The caller provides a
261  mavlink_message_t which is the size of a full mavlink message. This
262  is usually the receive buffer for the channel, and allows a reply to an
263  incoming message with minimum stack space usage.
264  */
265 static 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)
266 {
267 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
268  char *buf = (char *)msgbuf;
269  _mav_put_uint64_t(buf, 0, timestamp);
270  _mav_put_uint64_t(buf, 8, custom_state);
271  _mav_put_int32_t(buf, 16, lat);
272  _mav_put_int32_t(buf, 20, lon);
273  _mav_put_float(buf, 24, alt);
275  _mav_put_float_array(buf, 28, vel, 3);
276  _mav_put_float_array(buf, 40, acc, 3);
277  _mav_put_float_array(buf, 52, attitude_q, 4);
278  _mav_put_float_array(buf, 68, rates, 3);
279  _mav_put_float_array(buf, 80, position_cov, 3);
280 #if MAVLINK_CRC_EXTRA
282 #else
283  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
284 #endif
285 #else
287  packet->timestamp = timestamp;
288  packet->custom_state = custom_state;
289  packet->lat = lat;
290  packet->lon = lon;
291  packet->alt = alt;
293  mav_array_memcpy(packet->vel, vel, sizeof(float)*3);
294  mav_array_memcpy(packet->acc, acc, sizeof(float)*3);
295  mav_array_memcpy(packet->attitude_q, attitude_q, sizeof(float)*4);
296  mav_array_memcpy(packet->rates, rates, sizeof(float)*3);
297  mav_array_memcpy(packet->position_cov, position_cov, sizeof(float)*3);
298 #if MAVLINK_CRC_EXTRA
299  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
300 #else
301  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
302 #endif
303 #endif
304 }
305 #endif
306 
307 #endif
308 
309 // MESSAGE FOLLOW_TARGET UNPACKING
310 
311 
317 static inline uint64_t mavlink_msg_follow_target_get_timestamp(const mavlink_message_t* msg)
318 {
319  return _MAV_RETURN_uint64_t(msg, 0);
320 }
321 
327 static inline uint8_t mavlink_msg_follow_target_get_est_capabilities(const mavlink_message_t* msg)
328 {
329  return _MAV_RETURN_uint8_t(msg, 92);
330 }
331 
337 static inline int32_t mavlink_msg_follow_target_get_lat(const mavlink_message_t* msg)
338 {
339  return _MAV_RETURN_int32_t(msg, 16);
340 }
341 
347 static inline int32_t mavlink_msg_follow_target_get_lon(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_int32_t(msg, 20);
350 }
351 
357 static inline float mavlink_msg_follow_target_get_alt(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_float(msg, 24);
360 }
361 
367 static inline uint16_t mavlink_msg_follow_target_get_vel(const mavlink_message_t* msg, float *vel)
368 {
369  return _MAV_RETURN_float_array(msg, vel, 3, 28);
370 }
371 
377 static inline uint16_t mavlink_msg_follow_target_get_acc(const mavlink_message_t* msg, float *acc)
378 {
379  return _MAV_RETURN_float_array(msg, acc, 3, 40);
380 }
381 
387 static inline uint16_t mavlink_msg_follow_target_get_attitude_q(const mavlink_message_t* msg, float *attitude_q)
388 {
389  return _MAV_RETURN_float_array(msg, attitude_q, 4, 52);
390 }
391 
397 static inline uint16_t mavlink_msg_follow_target_get_rates(const mavlink_message_t* msg, float *rates)
398 {
399  return _MAV_RETURN_float_array(msg, rates, 3, 68);
400 }
401 
407 static inline uint16_t mavlink_msg_follow_target_get_position_cov(const mavlink_message_t* msg, float *position_cov)
408 {
409  return _MAV_RETURN_float_array(msg, position_cov, 3, 80);
410 }
411 
417 static inline uint64_t mavlink_msg_follow_target_get_custom_state(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_uint64_t(msg, 8);
420 }
421 
428 static inline void mavlink_msg_follow_target_decode(const mavlink_message_t* msg, mavlink_follow_target_t* follow_target)
429 {
430 #if MAVLINK_NEED_BYTE_SWAP
433  follow_target->lat = mavlink_msg_follow_target_get_lat(msg);
434  follow_target->lon = mavlink_msg_follow_target_get_lon(msg);
435  follow_target->alt = mavlink_msg_follow_target_get_alt(msg);
436  mavlink_msg_follow_target_get_vel(msg, follow_target->vel);
437  mavlink_msg_follow_target_get_acc(msg, follow_target->acc);
439  mavlink_msg_follow_target_get_rates(msg, follow_target->rates);
442 #else
443  memcpy(follow_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
444 #endif
445 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint64_t(buf, wire_offset, b)
Definition: protocol.h:149
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46