39 #if PERIODIC_TELEMETRY
40 static void send_ctc(
struct transport_tx *trans,
struct link_device *
dev)
56 #define CTC_GAIN_K1 0.001
59 #define CTC_GAIN_K2 0.001
61 #ifndef CTC_GAIN_ALPHA
62 #define CTC_GAIN_ALPHA 0.01
66 #define CTC_TIMEOUT 1500
70 #define CTC_OMEGA 0.25
73 #ifndef CTC_TIME_BROAD
74 #define CTC_TIME_BROAD 100
78 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
CTC_OMEGA,
CTC_TIME_BROAD
103 #if PERIODIC_TELEMETRY
175 float dt = (now -
before) / 1000.0;
178 int num_neighbors = 0;
180 int num_neighbors = 0;
190 float vx_nei =
tableNei[i][1] / 100.0;
191 float vy_nei =
tableNei[i][2] / 100.0;
192 float px_nei =
tableNei[i][3] / 100.0;
193 float py_nei =
tableNei[i][4] / 100.0;
204 int num_neighbors = 0;
214 float vx_nei =
tableNei[i][1] / 100.0;
215 float vy_nei =
tableNei[i][2] / 100.0;
216 float px_nei =
tableNei[i][3] / 100.0;
217 float py_nei =
tableNei[i][4] / 100.0;
228 if (num_neighbors != 0) {
239 if(num_neighbors != 0){
250 float distance_target_ref = sqrtf(error_target_ref_x*error_target_ref_x + error_target_ref_y*error_target_ref_y);
251 if(distance_target_ref < 0.1)
252 distance_target_ref = 0.1;
253 float aux = (1-expf(-
ctc_control.
alpha*distance_target_ref)) / distance_target_ref;
270 float u = u_vel + u_spa;
274 -atanf(u * (sqrtf(vx * vx + vy * vy)) / 9.8 / cosf(att->
theta));
288 struct pprzlink_msg
msg;
294 msg.sender_id = AC_ID;
296 msg.component_id = 0;
303 uint8_t ac_id = DL_CTC_REG_TABLE_ac_id(buf);
304 if (ac_id == AC_ID) {
305 uint8_t nei_id = DL_CTC_REG_TABLE_nei_id(buf);
uint8_t autopilot_get_mode(void)
get autopilot mode
Core autopilot interface common to all firmwares.
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
bool collective_tracking_vehicle()
static void send_ctc_control(struct transport_tx *trans, struct link_device *dev)
uint32_t last_transmision
void collective_tracking_control()
bool collective_tracking_waypoint(uint8_t wp)
static void send_ctc(struct transport_tx *trans, struct link_device *dev)
uint32_t last_info[CTC_MAX_AC]
int16_t tableNei[CTC_MAX_AC][6]
bool collective_tracking_point(float x, float y)
Collective Tracking Control.
void parse_ctc_NeiInfoTable(uint8_t *buf)
void parse_ctc_TargetInfo(uint8_t *buf)
void ctc_send_info_to_nei(void)
void parse_ctc_RegTable(uint8_t *buf)
void parse_ctc_CleanTable(uint8_t *buf)
#define LATERAL_MODE_ROLL
Fixed wing horizontal control.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
vector in East North Up coordinates Units: meters
float h_ctl_roll_max_setpoint
float h_ctl_roll_setpoint
static const struct usb_device_descriptor dev
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.