35 #include "generated/radio.h"
37 #define INDI_SCHEDULING_LOWER_BOUND_G1 0.0001
40 #ifndef INDI_SCHEDULING_LOW_AIRSPEED
41 #define INDI_SCHEDULING_LOW_AIRSPEED 12.0
50 static float g_forward[4][INDI_NUM_ACT] = {STABILIZATION_INDI_G1_ROLL_FWD, STABILIZATION_INDI_G1_PITCH_FWD, STABILIZATION_INDI_G1_YAW_FWD, STABILIZATION_INDI_G1_THRUST_FWD};
52 static float g_hover[4][INDI_NUM_ACT] = {STABILIZATION_INDI_G1_ROLL, STABILIZATION_INDI_G1_PITCH, STABILIZATION_INDI_G1_YAW, STABILIZATION_INDI_G1_THRUST};
68 for (
uint8_t i = 0; i < INDI_NUM_ACT; i++) {
107 Bound(ratio,0.0,1.0);
109 float stall_speed = 14.0;
110 float pitch_ratio = 0.0;
126 Bound(pitch_ratio,0.0,1.0);
128 float airspeed_pitch_eff = airspeed;
129 Bound(airspeed_pitch_eff, 8.0, 30.0);
131 for (
uint8_t i = 0; i < INDI_NUM_ACT; i++) {
139 g1g2[1][i] =
g_hover[1][i] * (1.0 - pitch_ratio) +
g_forward[1][i] * pitch_ratio * airspeed_pitch_eff * airspeed_pitch_eff / (16.0*16.0);
145 float wing_thrust_scaling = 1.0;
146 #if INDI_NUM_ACT != 8
147 #error "ctfl_eff_scheduling_nederdrone is very specific and only works for one Nederdrone configuration!"
150 float wing_thrust = actuators_pprz[i-4];
151 Bound(wing_thrust,3000.0,9600.0);
152 wing_thrust_scaling = wing_thrust/9600.0/0.8;
155 g1g2[0][i] *= wing_thrust_scaling;
156 g1g2[1][i] *= wing_thrust_scaling;
157 g1g2[2][i] *= wing_thrust_scaling;
161 float ratio_spec_force = 0.0;
162 float airspeed_spec_force = airspeed;
163 Bound(airspeed_spec_force, 8.0, 20.0);
164 ratio_spec_force = (airspeed_spec_force-8.0) / 12.0;
166 for (
uint8_t i = 0; i < INDI_NUM_ACT; i++) {
Core autopilot interface common to all firmwares.
#define INDI_SCHEDULING_LOW_AIRSPEED
float sched_tip_prop_upper_pitch_limit_deg
float sched_ratio_tip_props
void ctrl_eff_scheduling_periodic(void)
Periodic function that interpolates between gain sets depending on the scheduling variable.
void schdule_control_effectiveness(void)
Function that calculates control effectiveness values for the Nederdrone inner loop.
bool sched_tip_props_always_on
static float g_hover[4][INDI_NUM_ACT]
float sched_tip_prop_lower_pitch_limit_deg
static float g_forward[4][INDI_NUM_ACT]
void ctrl_eff_scheduling_init(void)
Initialises periodic loop;.
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
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
static float stateGetAirspeed_f(void)
Get airspeed (float).
struct FloatEulers eulers_zxy
state eulers in zxy order
Hardware independent API for actuators (servos, motor controllers).
struct RadioControl radio_control
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
float g1g2[INDI_OUTPUTS][INDI_NUM_ACT]
API to get/set the generic vehicle states.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.