NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_detection_stats.h
Go to the documentation of this file.
1 // MESSAGE DETECTION_STATS PACKING
2 
3 #define MAVLINK_MSG_ID_DETECTION_STATS 205
4 
6 {
7  uint32_t detections;
8  uint32_t cluster_iters;
9  float best_score;
10  int32_t best_lat;
11  int32_t best_lon;
12  int32_t best_alt;
13  uint32_t best_detection_id;
14  uint32_t best_cluster_id;
16  uint32_t images_done;
17  uint32_t images_todo;
18  float fps;
20 
21 #define MAVLINK_MSG_ID_DETECTION_STATS_LEN 48
22 #define MAVLINK_MSG_ID_205_LEN 48
23 
24 #define MAVLINK_MSG_ID_DETECTION_STATS_CRC 87
25 #define MAVLINK_MSG_ID_205_CRC 87
26 
27 
28 
29 #define MAVLINK_MESSAGE_INFO_DETECTION_STATS { \
30  "DETECTION_STATS", \
31  12, \
32  { { "detections", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_detection_stats_t, detections) }, \
33  { "cluster_iters", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_detection_stats_t, cluster_iters) }, \
34  { "best_score", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_detection_stats_t, best_score) }, \
35  { "best_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_detection_stats_t, best_lat) }, \
36  { "best_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_detection_stats_t, best_lon) }, \
37  { "best_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_detection_stats_t, best_alt) }, \
38  { "best_detection_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_detection_stats_t, best_detection_id) }, \
39  { "best_cluster_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_detection_stats_t, best_cluster_id) }, \
40  { "best_cluster_iter_id", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_detection_stats_t, best_cluster_iter_id) }, \
41  { "images_done", NULL, MAVLINK_TYPE_UINT32_T, 0, 36, offsetof(mavlink_detection_stats_t, images_done) }, \
42  { "images_todo", NULL, MAVLINK_TYPE_UINT32_T, 0, 40, offsetof(mavlink_detection_stats_t, images_todo) }, \
43  { "fps", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_detection_stats_t, fps) }, \
44  } \
45 }
46 
47 
68 static inline uint16_t mavlink_msg_detection_stats_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
69  uint32_t detections, uint32_t cluster_iters, float best_score, int32_t best_lat, int32_t best_lon, int32_t best_alt, uint32_t best_detection_id, uint32_t best_cluster_id, uint32_t best_cluster_iter_id, uint32_t images_done, uint32_t images_todo, float fps)
70 {
71 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
73  _mav_put_uint32_t(buf, 0, detections);
74  _mav_put_uint32_t(buf, 4, cluster_iters);
75  _mav_put_float(buf, 8, best_score);
76  _mav_put_int32_t(buf, 12, best_lat);
77  _mav_put_int32_t(buf, 16, best_lon);
78  _mav_put_int32_t(buf, 20, best_alt);
79  _mav_put_uint32_t(buf, 24, best_detection_id);
80  _mav_put_uint32_t(buf, 28, best_cluster_id);
81  _mav_put_uint32_t(buf, 32, best_cluster_iter_id);
82  _mav_put_uint32_t(buf, 36, images_done);
83  _mav_put_uint32_t(buf, 40, images_todo);
84  _mav_put_float(buf, 44, fps);
85 
87 #else
89  packet.detections = detections;
90  packet.cluster_iters = cluster_iters;
91  packet.best_score = best_score;
92  packet.best_lat = best_lat;
93  packet.best_lon = best_lon;
94  packet.best_alt = best_alt;
95  packet.best_detection_id = best_detection_id;
96  packet.best_cluster_id = best_cluster_id;
97  packet.best_cluster_iter_id = best_cluster_iter_id;
98  packet.images_done = images_done;
99  packet.images_todo = images_todo;
100  packet.fps = fps;
101 
103 #endif
104 
105  msg->msgid = MAVLINK_MSG_ID_DETECTION_STATS;
106 #if MAVLINK_CRC_EXTRA
108 #else
109  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
110 #endif
111 }
112 
133 static inline uint16_t mavlink_msg_detection_stats_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
134  mavlink_message_t* msg,
135  uint32_t detections,uint32_t cluster_iters,float best_score,int32_t best_lat,int32_t best_lon,int32_t best_alt,uint32_t best_detection_id,uint32_t best_cluster_id,uint32_t best_cluster_iter_id,uint32_t images_done,uint32_t images_todo,float fps)
136 {
137 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
139  _mav_put_uint32_t(buf, 0, detections);
140  _mav_put_uint32_t(buf, 4, cluster_iters);
141  _mav_put_float(buf, 8, best_score);
142  _mav_put_int32_t(buf, 12, best_lat);
143  _mav_put_int32_t(buf, 16, best_lon);
144  _mav_put_int32_t(buf, 20, best_alt);
145  _mav_put_uint32_t(buf, 24, best_detection_id);
146  _mav_put_uint32_t(buf, 28, best_cluster_id);
147  _mav_put_uint32_t(buf, 32, best_cluster_iter_id);
148  _mav_put_uint32_t(buf, 36, images_done);
149  _mav_put_uint32_t(buf, 40, images_todo);
150  _mav_put_float(buf, 44, fps);
151 
153 #else
155  packet.detections = detections;
156  packet.cluster_iters = cluster_iters;
157  packet.best_score = best_score;
158  packet.best_lat = best_lat;
159  packet.best_lon = best_lon;
160  packet.best_alt = best_alt;
161  packet.best_detection_id = best_detection_id;
162  packet.best_cluster_id = best_cluster_id;
163  packet.best_cluster_iter_id = best_cluster_iter_id;
164  packet.images_done = images_done;
165  packet.images_todo = images_todo;
166  packet.fps = fps;
167 
169 #endif
170 
171  msg->msgid = MAVLINK_MSG_ID_DETECTION_STATS;
172 #if MAVLINK_CRC_EXTRA
174 #else
175  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
176 #endif
177 }
178 
187 static inline uint16_t mavlink_msg_detection_stats_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_detection_stats_t* detection_stats)
188 {
189  return mavlink_msg_detection_stats_pack(system_id, component_id, msg, detection_stats->detections, detection_stats->cluster_iters, detection_stats->best_score, detection_stats->best_lat, detection_stats->best_lon, detection_stats->best_alt, detection_stats->best_detection_id, detection_stats->best_cluster_id, detection_stats->best_cluster_iter_id, detection_stats->images_done, detection_stats->images_todo, detection_stats->fps);
190 }
191 
201 static inline uint16_t mavlink_msg_detection_stats_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_detection_stats_t* detection_stats)
202 {
203  return mavlink_msg_detection_stats_pack_chan(system_id, component_id, chan, msg, detection_stats->detections, detection_stats->cluster_iters, detection_stats->best_score, detection_stats->best_lat, detection_stats->best_lon, detection_stats->best_alt, detection_stats->best_detection_id, detection_stats->best_cluster_id, detection_stats->best_cluster_iter_id, detection_stats->images_done, detection_stats->images_todo, detection_stats->fps);
204 }
205 
223 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
224 
225 static inline void mavlink_msg_detection_stats_send(mavlink_channel_t chan, uint32_t detections, uint32_t cluster_iters, float best_score, int32_t best_lat, int32_t best_lon, int32_t best_alt, uint32_t best_detection_id, uint32_t best_cluster_id, uint32_t best_cluster_iter_id, uint32_t images_done, uint32_t images_todo, float fps)
226 {
227 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
229  _mav_put_uint32_t(buf, 0, detections);
230  _mav_put_uint32_t(buf, 4, cluster_iters);
231  _mav_put_float(buf, 8, best_score);
232  _mav_put_int32_t(buf, 12, best_lat);
233  _mav_put_int32_t(buf, 16, best_lon);
234  _mav_put_int32_t(buf, 20, best_alt);
235  _mav_put_uint32_t(buf, 24, best_detection_id);
236  _mav_put_uint32_t(buf, 28, best_cluster_id);
237  _mav_put_uint32_t(buf, 32, best_cluster_iter_id);
238  _mav_put_uint32_t(buf, 36, images_done);
239  _mav_put_uint32_t(buf, 40, images_todo);
240  _mav_put_float(buf, 44, fps);
241 
242 #if MAVLINK_CRC_EXTRA
244 #else
245  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, buf, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
246 #endif
247 #else
249  packet.detections = detections;
250  packet.cluster_iters = cluster_iters;
251  packet.best_score = best_score;
252  packet.best_lat = best_lat;
253  packet.best_lon = best_lon;
254  packet.best_alt = best_alt;
255  packet.best_detection_id = best_detection_id;
256  packet.best_cluster_id = best_cluster_id;
257  packet.best_cluster_iter_id = best_cluster_iter_id;
258  packet.images_done = images_done;
259  packet.images_todo = images_todo;
260  packet.fps = fps;
261 
262 #if MAVLINK_CRC_EXTRA
263  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, (const char *)&packet, MAVLINK_MSG_ID_DETECTION_STATS_LEN, MAVLINK_MSG_ID_DETECTION_STATS_CRC);
264 #else
265  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, (const char *)&packet, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
266 #endif
267 #endif
268 }
269 
270 #if MAVLINK_MSG_ID_DETECTION_STATS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
271 /*
272  This varient of _send() can be used to save stack space by re-using
273  memory from the receive buffer. The caller provides a
274  mavlink_message_t which is the size of a full mavlink message. This
275  is usually the receive buffer for the channel, and allows a reply to an
276  incoming message with minimum stack space usage.
277  */
278 static inline void mavlink_msg_detection_stats_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t detections, uint32_t cluster_iters, float best_score, int32_t best_lat, int32_t best_lon, int32_t best_alt, uint32_t best_detection_id, uint32_t best_cluster_id, uint32_t best_cluster_iter_id, uint32_t images_done, uint32_t images_todo, float fps)
279 {
280 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
281  char *buf = (char *)msgbuf;
282  _mav_put_uint32_t(buf, 0, detections);
283  _mav_put_uint32_t(buf, 4, cluster_iters);
284  _mav_put_float(buf, 8, best_score);
285  _mav_put_int32_t(buf, 12, best_lat);
286  _mav_put_int32_t(buf, 16, best_lon);
287  _mav_put_int32_t(buf, 20, best_alt);
288  _mav_put_uint32_t(buf, 24, best_detection_id);
289  _mav_put_uint32_t(buf, 28, best_cluster_id);
290  _mav_put_uint32_t(buf, 32, best_cluster_iter_id);
291  _mav_put_uint32_t(buf, 36, images_done);
292  _mav_put_uint32_t(buf, 40, images_todo);
293  _mav_put_float(buf, 44, fps);
294 
295 #if MAVLINK_CRC_EXTRA
297 #else
298  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, buf, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
299 #endif
300 #else
302  packet->detections = detections;
303  packet->cluster_iters = cluster_iters;
304  packet->best_score = best_score;
305  packet->best_lat = best_lat;
306  packet->best_lon = best_lon;
307  packet->best_alt = best_alt;
308  packet->best_detection_id = best_detection_id;
309  packet->best_cluster_id = best_cluster_id;
310  packet->best_cluster_iter_id = best_cluster_iter_id;
311  packet->images_done = images_done;
312  packet->images_todo = images_todo;
313  packet->fps = fps;
314 
315 #if MAVLINK_CRC_EXTRA
316  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, (const char *)packet, MAVLINK_MSG_ID_DETECTION_STATS_LEN, MAVLINK_MSG_ID_DETECTION_STATS_CRC);
317 #else
318  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DETECTION_STATS, (const char *)packet, MAVLINK_MSG_ID_DETECTION_STATS_LEN);
319 #endif
320 #endif
321 }
322 #endif
323 
324 #endif
325 
326 // MESSAGE DETECTION_STATS UNPACKING
327 
328 
334 static inline uint32_t mavlink_msg_detection_stats_get_detections(const mavlink_message_t* msg)
335 {
336  return _MAV_RETURN_uint32_t(msg, 0);
337 }
338 
344 static inline uint32_t mavlink_msg_detection_stats_get_cluster_iters(const mavlink_message_t* msg)
345 {
346  return _MAV_RETURN_uint32_t(msg, 4);
347 }
348 
354 static inline float mavlink_msg_detection_stats_get_best_score(const mavlink_message_t* msg)
355 {
356  return _MAV_RETURN_float(msg, 8);
357 }
358 
364 static inline int32_t mavlink_msg_detection_stats_get_best_lat(const mavlink_message_t* msg)
365 {
366  return _MAV_RETURN_int32_t(msg, 12);
367 }
368 
374 static inline int32_t mavlink_msg_detection_stats_get_best_lon(const mavlink_message_t* msg)
375 {
376  return _MAV_RETURN_int32_t(msg, 16);
377 }
378 
384 static inline int32_t mavlink_msg_detection_stats_get_best_alt(const mavlink_message_t* msg)
385 {
386  return _MAV_RETURN_int32_t(msg, 20);
387 }
388 
394 static inline uint32_t mavlink_msg_detection_stats_get_best_detection_id(const mavlink_message_t* msg)
395 {
396  return _MAV_RETURN_uint32_t(msg, 24);
397 }
398 
404 static inline uint32_t mavlink_msg_detection_stats_get_best_cluster_id(const mavlink_message_t* msg)
405 {
406  return _MAV_RETURN_uint32_t(msg, 28);
407 }
408 
414 static inline uint32_t mavlink_msg_detection_stats_get_best_cluster_iter_id(const mavlink_message_t* msg)
415 {
416  return _MAV_RETURN_uint32_t(msg, 32);
417 }
418 
424 static inline uint32_t mavlink_msg_detection_stats_get_images_done(const mavlink_message_t* msg)
425 {
426  return _MAV_RETURN_uint32_t(msg, 36);
427 }
428 
434 static inline uint32_t mavlink_msg_detection_stats_get_images_todo(const mavlink_message_t* msg)
435 {
436  return _MAV_RETURN_uint32_t(msg, 40);
437 }
438 
444 static inline float mavlink_msg_detection_stats_get_fps(const mavlink_message_t* msg)
445 {
446  return _MAV_RETURN_float(msg, 44);
447 }
448 
455 static inline void mavlink_msg_detection_stats_decode(const mavlink_message_t* msg, mavlink_detection_stats_t* detection_stats)
456 {
457 #if MAVLINK_NEED_BYTE_SWAP
458  detection_stats->detections = mavlink_msg_detection_stats_get_detections(msg);
459  detection_stats->cluster_iters = mavlink_msg_detection_stats_get_cluster_iters(msg);
460  detection_stats->best_score = mavlink_msg_detection_stats_get_best_score(msg);
461  detection_stats->best_lat = mavlink_msg_detection_stats_get_best_lat(msg);
462  detection_stats->best_lon = mavlink_msg_detection_stats_get_best_lon(msg);
463  detection_stats->best_alt = mavlink_msg_detection_stats_get_best_alt(msg);
464  detection_stats->best_detection_id = mavlink_msg_detection_stats_get_best_detection_id(msg);
465  detection_stats->best_cluster_id = mavlink_msg_detection_stats_get_best_cluster_id(msg);
466  detection_stats->best_cluster_iter_id = mavlink_msg_detection_stats_get_best_cluster_iter_id(msg);
467  detection_stats->images_done = mavlink_msg_detection_stats_get_images_done(msg);
468  detection_stats->images_todo = mavlink_msg_detection_stats_get_images_todo(msg);
469  detection_stats->fps = mavlink_msg_detection_stats_get_fps(msg);
470 #else
471  memcpy(detection_stats, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DETECTION_STATS_LEN);
472 #endif
473 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:142
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141