26 #include "generated/airframe.h"
30 #include "generated/modules.h"
36 #ifndef APPROACH_MOVING_TARGET_CUTOFF_FREQ_FILTERS_HZ
37 #define APPROACH_MOVING_TARGET_CUTOFF_FREQ_FILTERS_HZ 0.5
41 #ifndef APPROACH_MOVING_TARGET_SLOPE
42 #define APPROACH_MOVING_TARGET_SLOPE 35.0
46 #ifndef APPROACH_MOVING_TARGET_DISTANCE
47 #define APPROACH_MOVING_TARGET_DISTANCE 60.0
51 #ifndef APPROACH_MOVING_TARGET_SPEED
52 #define APPROACH_MOVING_TARGET_SPEED -1.0
56 #ifndef APPROACH_MOVING_TARGET_ERR_SLOWDOWN_GAIN
57 #define APPROACH_MOVING_TARGET_ERR_SLOWDOWN_GAIN 0.25
60 #ifndef APPROACH_MOVING_TARGET_POS_GAIN
61 #define APPROACH_MOVING_TARGET_POS_GAIN 0.3
64 #ifndef APPROACH_MOVING_TARGET_SPEED_GAIN
65 #define APPROACH_MOVING_TARGET_SPEED_GAIN 1.0
68 #ifndef APPROACH_MOVING_TARGET_RELVEL_GAIN
69 #define APPROACH_MOVING_TARGET_RELVEL_GAIN 1.0
76 #define DEBUG_AMT TRUE
104 #if PERIODIC_TELEMETRY
108 pprz_msg_send_APPROACH_MOVING_TARGET(trans,
dev, AC_ID,
122 #if PERIODIC_TELEMETRY
132 float sample_time = 1.0 / FOLLOW_DIAGONAL_APPROACH_FREQ;
133 for (
uint8_t i = 0; i < 3; i++) {
151 RunOnceEvery(100 / 2, {
180 struct NedCoor_f target_pos, target_vel = {0};
181 float target_heading;
186 if (target_heading > 360.f) {
223 float psi_ref = target_heading_filt_wrapped + RadOfDeg(
amt.
psi_ref);
235 VECT3_SUM(des_pos, ref_relpos, target_pos);
251 ref_relvel.
x + target_vel.
x + ec_vel.
x,
252 ref_relvel.
y + target_vel.
y + ec_vel.
y,
253 ref_relvel.
z + target_vel.
z + ec_vel.
z,
260 Bound(des_vel.
z, -4.0, 5.0);
271 float sin_gamma_ref = sinf(gamma_ref);
272 if (sin_gamma_ref > 0.05) {
286 float dt = FOLLOW_DIAGONAL_APPROACH_PERIOD;
291 VECT3_SUM(disp_pos_target, des_pos, *drone_pos);
Main include for ABI (AirBorneInterface).
#define APPROACH_MOVING_TARGET_CUTOFF_FREQ_FILTERS_HZ
#define APPROACH_MOVING_TARGET_POS_GAIN
void follow_diagonal_approach(void)
Generates a velocity reference from a diagonal approach path.
struct FloatVect3 nav_get_speed_sp_from_diagonal(struct EnuCoor_i target, float pos_gain, float rope_heading)
struct AmtTelem amt_telem
Butterworth2LowPass target_pos_filt[3]
Butterworth2LowPass target_heading_filt
#define APPROACH_MOVING_TARGET_RELVEL_GAIN
#define APPROACH_MOVING_TARGET_SPEED
#define APPROACH_MOVING_TARGET_SLOPE
void approach_moving_target_set_low_pass_freq(float filter_freq)
struct FloatVect3 des_vel
bool approach_moving_target_enabled
Butterworth2LowPass target_vel_filt[3]
struct FloatVect3 des_pos
static void send_approach_moving_target(struct transport_tx *trans, struct link_device *dev)
#define APPROACH_MOVING_TARGET_DISTANCE
void approach_moving_target_init(void)
void update_waypoint(uint8_t wp_id, struct FloatVect3 *target_ned)
#define APPROACH_MOVING_TARGET_SPEED_GAIN
void approach_moving_target_enable(uint8_t wp_id)
#define APPROACH_MOVING_TARGET_ERR_SLOWDOWN_GAIN
float cutoff_freq_filters_hz
struct FloatVect3 rel_unit_vec
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
#define FLOAT_ANGLE_NORMALIZE(_a)
void float_vect3_bound_in_3d(struct FloatVect3 *vect3, float bound)
#define VECT3_SUM(_c, _a, _b)
#define VECT3_SMUL(_vo, _vi, _s)
#define VECT3_COPY(_a, _b)
#define VECT3_DIFF(_c, _a, _b)
#define ENU_OF_TO_NED(_po, _pi)
vector in East North Up coordinates
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
static float stateGetAirspeed_f(void)
Get airspeed (float).
Simple first order low pass filter with bilinear transform.
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, float tau, float sample_time, float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, float value)
Update second order Butterworth low pass filter state with a new value.
Second order low pass filter structure.
void waypoint_set_enu(uint8_t wp_id, struct EnuCoor_f *enu)
Set local ENU waypoint coordinates.
#define NAVIGATION_FREQUENCY
Default fixedwing navigation frequency.
vector in East North Up coordinates Units: meters
vector in North East Down coordinates Units: meters
struct RotorcraftNavigation nav
float descend_vspeed
descend speed setting, mostly used in flight plans
float climb_vspeed
climb speed setting, mostly used in flight plans
static const struct usb_device_descriptor dev
bool target_get_pos(struct NedCoor_f *pos, float *heading)
Get the current target position (NED) and heading.
bool target_get_vel(struct NedCoor_f *vel)
Get the current target velocity (NED)
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 char uint8_t
Typedef defining 8 bit unsigned char type.