Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
tag_tracking.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3 *
4 * This file is part of paparazzi
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
32#include "generated/modules.h"
33#include "state.h"
34#include "modules/core/abi.h"
35#include <math.h>
37
38#include "generated/flight_plan.h"
39
40
41// use WP_TARGET by default for simulation
42#if !(defined TAG_TRACKING_SIM_WP) && (defined WP_TARGET)
43#define TAG_TRACKING_SIM_WP WP_TARGET
44#endif
45
46#if defined SITL && defined TAG_TRACKING_SIM_WP
47static void tag_tracking_sim(void);
48static void tag_motion_sim(void);
49
50// select print function for debug
51#include <stdio.h>
52#define PRINTF printf
53// #define PRINTF(...) {}
54
55#define TAG_MOTION_NONE 0
56#define TAG_MOTION_LINE 1
57#define TAG_MOTION_CIRCLE 2
58
59#define TAG_MOTION_SPEED_X 0.25f //0.5f
60#define TAG_MOTION_SPEED_Y 0.f
61#define TAG_MOTION_RANGE_X 4.f
62#define TAG_MOTION_RANGE_Y 4.f
63
64#ifndef TAG_TRACKING_SIM_ID
65#define TAG_TRACKING_SIM_ID "U1"
66#endif
67
70
71// variables for circle
72int time_circle = 0;
74float speed_circle = 0.03;
75
76#endif // SITL
77
78// Default parameters
79// Camera is looking down and is placed at the center of the frame
80// With cam X axis pointing to the right, Y down and Z forward of image frame,
81// the camera is just rotated of pi/2 around body Z axis
82
83#ifndef TAG_TRACKING_BODY_TO_CAM_PHI
84#define TAG_TRACKING_BODY_TO_CAM_PHI 0.f
85#endif
86
87#ifndef TAG_TRACKING_BODY_TO_CAM_THETA
88#define TAG_TRACKING_BODY_TO_CAM_THETA 0.f
89#endif
90
91#ifndef TAG_TRACKING_BODY_TO_CAM_PSI
92#define TAG_TRACKING_BODY_TO_CAM_PSI M_PI_2
93#endif
94
95#ifndef TAG_TRACKING_CAM_POS_X
96#define TAG_TRACKING_CAM_POS_X 0.f
97#endif
98
99#ifndef TAG_TRACKING_CAM_POS_Y
100#define TAG_TRACKING_CAM_POS_Y 0.f
101#endif
102
103#ifndef TAG_TRACKING_CAM_POS_Z
104#define TAG_TRACKING_CAM_POS_Z 0.f
105#endif
106
107#ifndef TAG_TRACKING_COORD_TO_M
108#define TAG_TRACKING_COORD_TO_M (1.f / 1000.f)
109#endif
110
111#ifndef TAG_TRACKING_R
112#define TAG_TRACKING_R 1.f
113#endif
114
115#ifndef TAG_TRACKING_Q_SIGMA2
116#define TAG_TRACKING_Q_SIGMA2 1.f
117#endif
118
119#ifndef TAG_TRACKING_P0_POS
120#define TAG_TRACKING_P0_POS 10.f
121#endif
122
123#ifndef TAG_TRACKING_P0_SPEED
124#define TAG_TRACKING_P0_SPEED 10.f
125#endif
126
127#ifndef TAG_TRACKING_TIMEOUT
128#define TAG_TRACKING_TIMEOUT 5.f
129#endif
130
131#ifndef TAG_TRACKING_PREDICT_TIME
132#define TAG_TRACKING_PREDICT_TIME 1.f
133#endif
134
135#ifndef TAG_TRACKING_MAX_OFFSET
136#define TAG_TRACKING_MAX_OFFSET 2.0f
137#endif
138
139#ifndef TAG_TRACKING_KP
140#define TAG_TRACKING_KP 0.5f
141#endif
142
143#ifndef TAG_TRACKING_KPZ
144#define TAG_TRACKING_KPZ 0.2f
145#endif
146
147#ifndef TAG_TRACKING_MAX_SPEED
148#define TAG_TRACKING_MAX_SPEED 4.f
149#endif
150
151#ifndef TAG_TRACKING_MAX_VZ
152#define TAG_TRACKING_MAX_VZ 2.f
153#endif
154
155
156#define TAG_UNUSED_ID -1
157
158// generated in modules.h
160
161// global state structure
175
176
177
184
189
190
191#if (defined TAG_TRACKING_WPS)
193const uint8_t tag_tracking_wps_len = sizeof(wp_track) / sizeof(struct wp_tracking);
194#else
195struct wp_tracking wp_track[] = {};
197#endif
198
199
201
203
204struct FloatQuat rot_x_quat; // quaternion to rotate tag to have Z down
205
206// Abi bindings
207#ifndef TAG_TRACKING_ID
208#define TAG_TRACKING_ID ABI_BROADCAST
209#endif
210
212
214
216 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
217 if(tag_infos[i].tag_track_private.id == tag_id) {
218 return &tag_infos[i].tag_tracking;
219 }
220
221 // tag_id == TAG_TRACKING_ANY, returns the first running tag.
222 if (tag_id == TAG_TRACKING_ANY && tag_infos[i].tag_tracking.status == TAG_TRACKING_RUNNING) {
223 return &tag_infos[i].tag_tracking;
224 }
225 }
226
229 return &dummy;
230}
231
233{
234 return tag_tracking_get(tag_id)->status;
235}
236
241
243 struct tag_tracking_public* tag = tag_tracking_get(tag_id);
244 struct FloatEulers e;
246 return DegOfRad(e.psi);
247}
248
249// update measure vect before calling
251{
253 // compute target position in body frame (rotate and translate)
256 // rotate to ltp frame
257 struct FloatRMat *ltp_to_body_rmat = stateGetNedToBodyRMat_f();
259 // compute absolute position of tag in earth frame
262
263 // TODO filter in kalman ?
266
268 // don't run kalman, just update pos, set speed to zero
271 } else {
272 // update state and status
274 // reset state after first detection or lost tag
275 struct FloatVect3 speed = { 0.f, 0.f, 0.f };
278 }
279 else {
280 // RUNNING state, call correction step
282 }
283 // update public structure
285 }
286}
287
289 uint8_t type, char * id,
290 uint8_t nb UNUSED, int16_t * coord, uint16_t * dim UNUSED,
291 struct FloatQuat quat UNUSED, char * extra UNUSED)
292{
293 if (type == JEVOIS_MSG_D3) {
294 int16_t tag_id = (int16_t)jevois_extract_nb(id);
295 for (int i=0; i<TAG_TRACKING_NB_MAX; i++) {
296 // free slot, store tag ID
297 if (tag_infos[i].tag_track_private.id == TAG_UNUSED_ID) {
298 tag_infos[i].tag_track_private.id = tag_id;
299 }
300
301 if (tag_infos[i].tag_track_private.id == tag_id) {
302 // store data from Jevois detection
306
308 // rotate the quaternion so Z is down
309 float_quat_comp(&tag_infos[i].tag_track_private.cam_to_tag_quat, &quat, &rot_x_quat);
310 // update filter
312 // reset timeout and status
315 break;
316 }
317 }
318 }
319}
320
322{
323 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
324 // update x,y,z position from lat,lon,alt fields
328 // update filter
330 // store tag ID
332 // reset timeout and status
335 }
336}
337
338// Update and display tracking WP
339static void update_wp(struct tag_info* tag_info UNUSED, bool report UNUSED)
340{
341 if (tag_info->wp_id == 0) {
342 // not associated with any WP
343 return;
344 }
345
347 ENU_OF_TO_NED(target_pos_enu, tag_info->tag_tracking.pos); // convert local target pos to ENU
349 // when moving mode, predict tag position
353 VECT3_ADD(target_pos_enu, target_pos_pred); // add prediction offset
354 }
355 struct EnuCoor_i pos_i;
357 if (report) {
358 // move is a set + downlink report
360 } else {
362 }
363}
364
365// Init function
367{
368 struct FloatEulers rot_x = { M_PI, 0, 0};
370
371 // Init structure
372 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
373 FLOAT_VECT3_ZERO(tag_infos[i].tag_track_private.meas);
377 float_quat_identity(&tag_infos[i].tag_tracking.ned_to_tag_quat);
378 struct FloatEulers euler = {
382 };
383 float_rmat_of_eulers(&tag_infos[i].tag_track_private.body_to_cam, &euler);
384 float_quat_of_eulers(&tag_infos[i].tag_track_private.body_to_cam_quat, &euler);
385 VECT3_ASSIGN(tag_infos[i].tag_track_private.cam_pos,
391
398 }
399
400 // reserve slots for tag_ids we are looking for, and associate wp_ids.
401 for(int i=0; i<Min(tag_tracking_wps_len, TAG_TRACKING_NB_MAX); i++) {
404 }
405
406 // Bind to ABI message
408}
409
410
411// Propagation function
413{
414#if defined SITL && defined TAG_TRACKING_SIM_WP
417 }
419#endif
420 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
421 switch (tag_infos[i].tag_tracking.status) {
423 // don't propagate, wait for first detection
424 break;
426 // call kalman propagation step
428 // force speed to zero for fixed tag
429 if (tag_infos[i].tag_tracking.motion_type == TAG_TRACKING_FIXED_POS) {
430 struct FloatVect3 zero = { 0.f, 0.f, 0.f };
432 }
433 // update public structure
435 // update WP
436 update_wp(&tag_infos[i], false);
437 // increment timeout counter
439 if (tag_infos[i].tag_track_private.timeout > TAG_TRACKING_TIMEOUT) {
441 }
442 break;
444 // tag is lost, restart filter and wait for a new detection
446 break;
447 default:
448 break;
449 }
450 }
451}
452
453// Propagation start function (called at each start state)
460
466
467// Report function
469{
470 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
471 if(tag_infos[i].tag_track_private.id == TAG_UNUSED_ID) {
472 continue;
473 }
474#if TAG_TRACKING_DEBUG
475 float msg[] = {
476 tag_infos[i].kalman.state[0],
477 tag_infos[i].kalman.state[1],
478 tag_infos[i].kalman.state[2],
479 tag_infos[i].kalman.state[3],
480 tag_infos[i].kalman.state[4],
481 tag_infos[i].kalman.state[5],
482 (float)tag_infos[i].tag_tracking.status
483 };
485#endif
486
488 // compute absolute position
489 struct LlaCoor_f tag_lla;
490 struct EcefCoor_f tag_ecef;
493 float lat_deg = DegOfRad(tag_lla.lat);
494 float lon_deg = DegOfRad(tag_lla.lon);
495 uint8_t id =(uint8_t)tag_infos[i].tag_track_private.id;
497 update_wp(&tag_infos[i], true);
499 }
500 }
501}
502
510{
511 for (int i = 0; i < TAG_TRACKING_NB_MAX; i++) {
513 // compute speed command as estimated tag speed + gain * position error
514 struct NedCoor_f pos = *stateGetPositionNed_f();
518 VECT2_STRIM(tag_infos[i].tag_tracking.speed_cmd, -TAG_TRACKING_MAX_SPEED, TAG_TRACKING_MAX_SPEED); // trim max horizontal speed
519 BoundAbs(tag_infos[i].tag_tracking.speed_cmd.z, TAG_TRACKING_MAX_VZ); // tim max vertical speed
520 }
521 else {
522 // filter is not runing, set speed command to zero
524 }
525 }
526}
527
529{
530 for (int i = 0; i < TAG_TRACKING_NB_MAX; i++) {
531 if (tag_infos[i].tag_track_private.id == TAG_UNUSED_ID || tag_infos[i].tag_track_private.id == tag_id) {
532 tag_infos[i].tag_track_private.id = tag_id;
533 tag_infos[i].wp_id = wp_id;
534 return true;
535 }
536 }
537 return false; // fail to set tracker id
538}
539
540// Simulate detection using a WP coordinate
541#if defined SITL && defined TAG_TRACKING_SIM_WP
542static void tag_tracking_sim(void)
543{
544 // Compute image coordinates of a WP given fake camera parameters
545 struct FloatRMat *ltp_to_body_rmat = stateGetNedToBodyRMat_f();
547 float_rmat_comp(&ltp_to_cam_rmat, ltp_to_body_rmat, &tag_infos[0].tag_track_private.body_to_cam);
548 // Prepare cam world position
549 // C_w = P_w + R_w2b * C_b
550 struct FloatVect3 cam_pos_ltp;
551 float_rmat_vmult(&cam_pos_ltp, ltp_to_body_rmat, &tag_infos[0].tag_track_private.cam_pos);
553 // Target
554 struct NedCoor_f target_ltp;
556 target_ltp.z = 0.f; // force on the ground
557 // Compute target in camera frame Pc = R * (Pw - C)
558 struct FloatVect3 target_cam, tmp;
561 if (fabsf(target_cam.z) > 1.) {
562 // If we are not too close from target
563 // Compute target in image frame x = X/Z, y = X/Z
564 if (fabsf(target_cam.x / target_cam.z) < 0.3f &&
565 fabsf(target_cam.y / target_cam.z) < 0.3f) {
566 // If in field of view (~tan(60)/2)
567 // send coordinates in millimeter
568 int16_t coord[3] = {
569 (int16_t) (target_cam.x * 1000.f),
570 (int16_t) (target_cam.y * 1000.f),
571 (int16_t) (target_cam.z * 1000.f)
572 };
573 uint16_t dim[3] = { 100, 100, 0 };
574 struct FloatQuat quat; // TODO
575 float_quat_identity(&quat);
576 AbiSendMsgJEVOIS_MSG(42, JEVOIS_MSG_D3, TAG_TRACKING_SIM_ID, 3, coord, dim, quat, "");
577 }
578 }
579}
580
581static void tag_motion_sim(void)
582{
583 switch (tag_motion_sim_type) {
584 case TAG_MOTION_LINE:
585 {
586 struct EnuCoor_f pos = waypoints[TAG_TRACKING_SIM_WP].enu_f;
589 if (pos.x < -TAG_MOTION_RANGE_X || pos.x > TAG_MOTION_RANGE_X ||
590 pos.y < -TAG_MOTION_RANGE_Y || pos.y > TAG_MOTION_RANGE_Y) {
593 speed_dt.x = -speed_dt.x;
594 speed_dt.y = -speed_dt.y;
595 }
596 VECT2_ADD(pos, speed_dt);
597 struct EnuCoor_i pos_i;
600 break;
601 }
603 {
604 time_circle += 1;
606 struct EnuCoor_f pos = waypoints[TAG_TRACKING_SIM_WP].enu_f;
613 VECT2_ADD(pos, speed_dt);
614 struct EnuCoor_i pos_i;
617 }
618 default:
619 break;
620 }
621}
622
623#endif
624
625
626
627
633
634
635void tag_tracking_set_motion_type(float motion_type) {
636 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
637 bool joker = (tag_tracking_setting_id == -1) && (tag_infos[i].tag_track_private.id != TAG_UNUSED_ID);
638 if(tag_infos[i].tag_track_private.id == tag_tracking_setting_id || joker) {
639 tag_infos[i].tag_tracking.motion_type = (uint8_t)motion_type;
640 tag_tracking_motion_type = (uint8_t)motion_type;;
641 }
642 }
643}
644
645void tag_tracking_set_predict_time(float predict_time) {
646 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
647 bool joker = (tag_tracking_setting_id == -1) && (tag_infos[i].tag_track_private.id != TAG_UNUSED_ID);
648 if(tag_infos[i].tag_track_private.id == tag_tracking_setting_id || joker) {
649 tag_infos[i].tag_tracking.predict_time = predict_time;
650 tag_tracking_predict_time = predict_time;
651 }
652 }
653}
654
655void tag_tracking_set_kp(float kp) {
656 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
657 bool joker = (tag_tracking_setting_id == -1) && (tag_infos[i].tag_track_private.id != TAG_UNUSED_ID);
658 if(tag_infos[i].tag_track_private.id == tag_tracking_setting_id || joker) {
659 tag_infos[i].tag_tracking.kp = kp;
660 tag_tracking_kp = kp;
661 }
662 }
663}
664
665void tag_tracking_set_kpz(float kpz) {
666 for(int i=0; i<TAG_TRACKING_NB_MAX; i++) {
667 bool joker = (tag_tracking_setting_id == -1) && (tag_infos[i].tag_track_private.id != TAG_UNUSED_ID);
668 if(tag_infos[i].tag_track_private.id == tag_tracking_setting_id || joker) {
669 tag_infos[i].tag_tracking.kpz = kpz;
670 tag_tracking_kpz = kpz;
671 }
672 }
673}
674
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
Definition abi_common.h:67
#define UNUSED(x)
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition common_nav.c:44
#define Min(x, y)
Definition esc_dshot.c:109
float psi
in radians
static void float_quat_normalize(struct FloatQuat *q)
static void float_quat_identity(struct FloatQuat *q)
initialises a quaternion to identity
#define FLOAT_VECT3_ZERO(_v)
#define float_rmat_of_eulers
void float_rmat_comp(struct FloatRMat *m_a2c, struct FloatRMat *m_a2b, struct FloatRMat *m_b2c)
Composition (multiplication) of two rotation matrices.
void float_quat_of_eulers(struct FloatQuat *q, struct FloatEulers *e)
quat of euler roation 'ZYX'
void float_rmat_transp_vmult(struct FloatVect3 *vb, struct FloatRMat *m_b2a, struct FloatVect3 *va)
rotate 3D vector by transposed rotation matrix.
void float_eulers_of_quat(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZYX'
void float_quat_comp(struct FloatQuat *a2c, struct FloatQuat *a2b, struct FloatQuat *b2c)
Composition (multiplication) of two quaternions.
void float_rmat_vmult(struct FloatVect3 *vb, struct FloatRMat *m_a2b, struct FloatVect3 *va)
rotate 3D vector by rotation matrix.
euler angles
Roation quaternion.
rotation matrix
#define VECT2_ADD(_a, _b)
#define VECT2_SMUL(_vo, _vi, _s)
#define VECT2_STRIM(_v, _min, _max)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define VECT3_DIFF(_c, _a, _b)
#define VECT3_ADD(_a, _b)
#define ENU_OF_TO_NED(_po, _pi)
#define ENU_BFP_OF_REAL(_o, _i)
vector in East North Up coordinates
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
Definition state.h:1300
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition state.h:1294
static struct LtpDef_f * stateGetNedOrigin_f(void)
Get the coordinate NED frame origin (float)
Definition state.h:566
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition state.h:839
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
int jevois_extract_nb(char *in)
Extract a number from jevoid ID field.
Definition jevois.c:130
#define JEVOIS_MSG_D3
Definition jevois.h:41
uint16_t foo
Definition main_demo5.c:58
void waypoint_move_enu_i(uint8_t wp_id, struct EnuCoor_i *new_pos)
Definition waypoints.c:189
void waypoint_set_enu_i(uint8_t wp_id, struct EnuCoor_i *enu)
Definition waypoints.c:165
void ecef_of_ned_point_f(struct EcefCoor_f *ecef, struct LtpDef_f *def, struct NedCoor_f *ned)
void lla_of_ecef_f(struct LlaCoor_f *out, struct EcefCoor_f *in)
float y
in meters
float x
in meters
float z
in meters
float x
in meters
float y
in meters
vector in EarthCenteredEarthFixed coordinates
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
vector in North East Down coordinates Units: meters
void simple_kinematic_kalman_get_state(struct SimpleKinematicKalman *kalman, struct FloatVect3 *pos, struct FloatVect3 *speed)
Get current state.
void simple_kinematic_kalman_predict(struct SimpleKinematicKalman *kalman)
propagate dynamic model
void simple_kinematic_kalman_set_state(struct SimpleKinematicKalman *kalman, struct FloatVect3 pos, struct FloatVect3 speed)
Set initial state vector.
void simple_kinematic_kalman_update_pos(struct SimpleKinematicKalman *kalman, struct FloatVect3 pos)
correction step for position
void simple_kinematic_kalman_init(struct SimpleKinematicKalman *kalman, float P0_pos, float P0_speed, float Q_sigma2, float r, float dt)
Init SimpleKinematicKalman internal struct.
void simple_kinematic_kalman_update_speed(struct SimpleKinematicKalman *kalman, struct FloatVect3 speed, uint8_t type)
correction step for speed
#define SIMPLE_KINEMATIC_KALMAN_SPEED_3D
float state[SIMPLE_KINEMATIC_KALMAN_DIM]
state vector
API to get/set the generic vehicle states.
struct tag_tracking_public tag_tracking
int16_t tag_id
void tag_tracking_propagate_start()
void tag_tracking_set_kpz(float kpz)
static void update_tag_position(struct tag_info *tag_info)
int tag_tracking_setting_id
static abi_event tag_track_ev
static void tag_track_cb(uint8_t sender_id UNUSED, uint8_t type, char *id, uint8_t nb UNUSED, int16_t *coord, uint16_t *dim UNUSED, struct FloatQuat quat UNUSED, char *extra UNUSED)
static const float tag_track_dt
#define TAG_TRACKING_TIMEOUT
#define TAG_TRACKING_KP
struct tag_tracking_public * tag_tracking_get(int16_t tag_id)
void tag_tracking_init()
bool tag_tracking_set_tracker_id(int16_t tag_id, uint8_t wp_id)
struct FloatVect3 meas
measured position
void tag_tracking_set_kp(float kp)
#define TAG_TRACKING_MAX_VZ
#define TAG_TRACKING_CAM_POS_Z
#define TAG_TRACKING_CAM_POS_Y
float tag_tracking_predict_time
#define TAG_TRACKING_BODY_TO_CAM_THETA
uint8_t tag_tracking_get_motion_type(int16_t tag_id)
void tag_tracking_propagate()
#define TAG_TRACKING_PREDICT_TIME
#define TAG_TRACKING_Q_SIGMA2
float tag_tracking_motion_type
#define TAG_TRACKING_BODY_TO_CAM_PSI
float timeout
timeout for lost flag [sec]
void tag_tracking_set_setting_id(float id)
#define TAG_TRACKING_KPZ
struct FloatVect3 cam_pos
Position of camera in body frame.
#define TAG_TRACKING_BODY_TO_CAM_PHI
bool updated
updated state
struct tag_tracking_public dummy
#define TAG_TRACKING_COORD_TO_M
uint8_t wp_id
void tag_tracking_report()
void tag_tracking_parse_target_pos(uint8_t *buf)
const uint8_t tag_tracking_wps_len
static void tag_tracking_propagate_start_tag(struct tag_info *tag_info)
static void update_wp(struct tag_info *tag_info UNUSED, bool report UNUSED)
struct FloatQuat body_to_cam_quat
Body to camera rotation in quaternion.
struct tag_tracking tag_track_private
void tag_tracking_set_predict_time(float predict_time)
float tag_tracking_kpz
#define TAG_TRACKING_P0_POS
struct tag_info tag_infos[TAG_TRACKING_NB_MAX]
#define TAG_TRACKING_MAX_SPEED
struct FloatRMat body_to_cam
Body to camera rotation.
#define TAG_UNUSED_ID
struct SimpleKinematicKalman kalman
uint8_t wp_id
float tag_tracking_kp
#define TAG_TRACKING_CAM_POS_X
uint8_t tag_tracking_get_status(int16_t tag_id)
#define TAG_TRACKING_MAX_OFFSET
int16_t id
ID of detected tag.
void tag_tracking_set_motion_type(float motion_type)
#define TAG_TRACKING_P0_SPEED
struct FloatQuat rot_x_quat
struct wp_tracking wp_track[]
#define TAG_TRACKING_ID
void tag_tracking_compute_speed(void)
Control function.
#define TAG_TRACKING_R
float tag_tracking_get_heading(int16_t tag_id)
struct FloatQuat cam_to_tag_quat
measured quat
struct FloatQuat ned_to_tag_quat
estimated attitude in NED frame
#define TAG_TRACKING_MOVING
float kpz
vertical tracking command gain
#define TAG_TRACKING_ANY
#define TAG_TRACKING_DISABLE
struct FloatVect3 pos
estimated position
#define TAG_TRACKING_RUNNING
uint8_t status
tracking status flag
#define TAG_TRACKING_FIXED_POS
float predict_time
prediction time for WP tag
struct NedCoor_f speed_cmd
speed command to track the tag position
#define TAG_TRACKING_NB_MAX
#define TAG_TRACKING_SEARCHING
struct FloatQuat body_to_tag_quat
estimated attitude in body frame
#define TAG_TRACKING_LOST
uint8_t motion_type
type of tag motion
struct FloatVect3 speed
estimated speed
float kp
horizontal tracking command gain
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.