31 #include "generated/modules.h"
33 #ifndef COMMAND_THRUST_X
34 #error "Quadplanes require a forward thrust actuator"
37 #ifndef GUIDANCE_INDI_PUSHER_INDEX
38 #error "You need to define GUIDANCE_INDI_PUSHER_INDEX"
41 #ifndef GUIDANCE_INDI_THRUST_Z_EFF
42 #error "You need to define GUIDANCE_INDI_THRUST_Z_EFF"
57 float sample_time = 1.0 / PERIODIC_FREQUENCY;
93 #ifndef GUIDANCE_INDI_PITCH_EFF_SCALING
94 #define GUIDANCE_INDI_PITCH_EFF_SCALING 1.0
103 Gmat[0][0] = -sphi*stheta*lift_thrust_bz;
104 Gmat[1][0] = -cphi*lift_thrust_bz;
105 Gmat[2][0] = -sphi*ctheta*lift_thrust_bz;
111 Gmat[0][2] = cphi*stheta;
113 Gmat[2][2] = cphi*ctheta;
117 Gmat[2][3] = -stheta;
122 body_v[0] = cpsi * a_diff.
x + spsi * a_diff.
y;
123 body_v[1] = -spsi * a_diff.
x + cpsi * a_diff.
y;
124 body_v[2] = a_diff.
z;
137 wls_guid_p.u_min[1] = min_pitch_limit_rad - pitch_angle;
143 wls_guid_p.u_max[1] = max_pitch_limit_rad - pitch_angle;
148 wls_guid_p.u_pref[0] = -roll_angle;
149 wls_guid_p.u_pref[1] = -pitch_angle + pitch_pref_rad;
150 wls_guid_p.u_pref[2] = wls_guid_p.u_max[2];
151 wls_guid_p.u_pref[3] = body_v[0];
Core autopilot interface common to all firmwares.
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 ACCEL_FLOAT_OF_BFP(_ai)
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
static struct Int32Vect3 * stateGetAccelBody_i(void)
Get acceleration in Body coordinates (int).
float guidance_indi_max_bank
float guidance_indi_pitch_pref_deg
float WEAK guidance_indi_get_liftd(float airspeed, float theta)
Get the derivative of lift w.r.t.
struct FloatEulers eulers_zxy
state eulers in zxy order
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to ICRA2016 to learn more!
float guidance_indi_thrust_z_eff
void guidance_indi_quadplane_propagate_filters(void)
Low pass the accelerometer measurements to remove noise from vibrations.
float bodyz_filter_cutoff
void guidance_indi_quadplane_init(void)
Call upon entering indi guidance.
bool autopilot_in_flight_end_detection(bool motors_on UNUSED)
Quadplanes can still be in-flight with COMMAND_THRUST==0 and can even soar not descending in updrafts...
#define GUIDANCE_INDI_PITCH_EFF_SCALING
void guidance_indi_calcg_wing(float Gmat[GUIDANCE_INDI_HYBRID_V][GUIDANCE_INDI_HYBRID_U], struct FloatVect3 a_diff, float body_v[GUIDANCE_INDI_HYBRID_V])
Perform WLS.
void WEAK guidance_indi_hybrid_set_wls_settings(float body_v[3], float roll_angle, float pitch_angle)
Butterworth2LowPass accel_bodyz_filt
#define GUIDANCE_INDI_MAX_PITCH
#define GUIDANCE_INDI_MIN_PITCH
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.
struct Stabilization stabilization
int32_t cmd[COMMANDS_NB]
output command vector, range from [-MAX_PPRZ:MAX_PPRZ] (store for messages)
float g1g2[INDI_OUTPUTS][INDI_NUM_ACT]
API to get/set the generic vehicle states.