34 #include "generated/modules.h"
37 #ifndef ROT_WING_AUTOMATION_TRANS_ACCEL
38 #define ROT_WING_AUTOMATION_TRANS_ACCEL 1.0
42 #ifndef ROT_WING_AUTOMATION_TRANS_DECEL
43 #define ROT_WING_AUTOMATION_TRANS_DECEL 0.5
47 #ifndef ROT_WING_AUTOMATION_TRANS_LENGTH
48 #define ROT_WING_AUTOMATION_TRANS_LENGTH 200.0
52 #ifndef ROT_WING_AUTOMATION_TRANS_AIRSPEED
53 #define ROT_WING_AUTOMATION_TRANS_AIRSPEED 15.0
57 #ifndef ROT_WING_AUTOMATION_WIND_FILT_CUTOFF
58 #define ROT_WING_AUTOMATION_WIND_FILT_CUTOFF 0.001
85 float sample_time = 1.0 / PERIODIC_ROT_WING_AUTOMATION_FREQ;
112 RunOnceEvery(100 / 2, {
125 float cpsi = cosf(psi);
126 float spsi = sinf(psi);
130 struct FloatVect2 airspeed_v = { cpsi * airspeed, spsi * airspeed };
147 float cpsi = cosf(
psi);
148 float spsi = sinf(
psi);
161 VECT3_COPY(end_transition_rel_pos, *drone_pos);
165 VECT3_SUM(end_transition_pos, end_transition_rel_pos, *drone_pos);
166 end_transition_pos.
z = drone_pos->
z;
172 float average_ground_speed =
ground_speed + airspeed_error / 2.;
173 float transition_distance = average_ground_speed * transition_time;
177 transition_rel_pos.
x = cpsi * transition_distance;
178 transition_rel_pos.
y = spsi * transition_distance;
180 VECT3_SUM(transition_pos, transition_rel_pos, *drone_pos);
181 transition_pos.
z = drone_pos->
z;
185 float final_groundspeed =
ground_speed + airspeed_error;
187 float decel_distance = (final_groundspeed / 2.) * decel_time;
192 decel_rel_pos.
x = cpsi * decel_distance_from_drone;
193 decel_rel_pos.
y = spsi * decel_distance_from_drone;
195 VECT3_SUM(decel_pos, decel_rel_pos, *drone_pos);
196 decel_pos.
z = drone_pos->
z;
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
static float ground_speed
void float_eulers_of_quat_zxy(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZXY' This rotation order is useful if you need 90 deg pitch
#define VECT3_SUM(_c, _a, _b)
#define VECT2_DIFF(_c, _a, _b)
#define VECT3_COPY(_a, _b)
#define ENU_OF_TO_NED(_po, _pi)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
static float stateGetAirspeed_f(void)
Get airspeed (float).
struct FloatEulers eulers_zxy
state eulers in zxy order
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.
Paparazzi floating point algebra.
vector in East North Up coordinates Units: meters
vector in North East Down coordinates Units: meters
struct rot_wing_automation rot_wing_a
#define ROT_WING_AUTOMATION_WIND_FILT_CUTOFF
void update_waypoint_rot_wing_automation(uint8_t wp_id, struct FloatVect3 *target_ned)
void init_rot_wing_automation(void)
void rot_wing_vis_transition(uint8_t wp_transition_id, uint8_t wp_decel_id, uint8_t wp_end_id)
Butterworth2LowPass rot_wing_automation_wind_filter[2]
#define ROT_WING_AUTOMATION_TRANS_ACCEL
#define ROT_WING_AUTOMATION_TRANS_AIRSPEED
#define ROT_WING_AUTOMATION_TRANS_DECEL
void update_wind_vector(void)
#define ROT_WING_AUTOMATION_TRANS_LENGTH
void periodic_rot_wing_automation(void)
struct FloatVect2 windvect
struct FloatVect2 windvect_f
API to get/set the generic vehicle states.
Periodic telemetry system header (includes downlink utility and generated code).
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.