39static void send_ctc(
struct transport_tx *trans,
struct link_device *
dev)
55#define CTC_GAIN_K1 0.001
58#define CTC_GAIN_K2 0.001
61#define CTC_GAIN_ALPHA 0.01
65#define CTC_TIMEOUT 1500
73#define CTC_TIME_BROAD 100
77 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
CTC_OMEGA,
CTC_TIME_BROAD
102#if PERIODIC_TELEMETRY
174 float dt = (now -
before) / 1000.0;
177 int num_neighbors = 0;
179 int num_neighbors = 0;
189 float vx_nei =
tableNei[i][1] / 100.0;
190 float vy_nei =
tableNei[i][2] / 100.0;
191 float px_nei =
tableNei[i][3] / 100.0;
192 float py_nei =
tableNei[i][4] / 100.0;
203 int num_neighbors = 0;
213 float vx_nei =
tableNei[i][1] / 100.0;
214 float vy_nei =
tableNei[i][2] / 100.0;
215 float px_nei =
tableNei[i][3] / 100.0;
216 float py_nei =
tableNei[i][4] / 100.0;
227 if (num_neighbors != 0) {
238 if(num_neighbors != 0){
249 float distance_target_ref = sqrtf(error_target_ref_x*error_target_ref_x + error_target_ref_y*error_target_ref_y);
250 if(distance_target_ref < 0.1)
251 distance_target_ref = 0.1;
252 float aux = (1-expf(-
ctc_control.alpha*distance_target_ref)) / distance_target_ref;
253 float v_ref_x =
ctc_control.target_vx + aux*(error_target_x);
254 float v_ref_y =
ctc_control.target_vy + aux*(error_target_y);
259 float error_v_x =
ctc_control.v_centroid_x - v_ref_x;
260 float error_v_y =
ctc_control.v_centroid_y - v_ref_y;
261 u_vel = -
ctc_control.k1*(-error_v_x*vy + error_v_y*vx);
269 float u = u_vel + u_spa;
273 -atanf(u * (sqrtf(vx * vx + vy * vy)) / 9.8 / cosf(att->
theta));
287 struct pprzlink_msg
msg;
293 msg.sender_id = AC_ID;
295 msg.component_id = 0;
302 uint8_t ac_id = DL_CTC_REG_TABLE_ac_id(buf);
303 if (ac_id == AC_ID) {
304 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)
static struct uart_periph * dev
#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
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_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.