[fix] fix some bugs from #3190 (#3195)

This commit is contained in:
Gautier Hattenberger
2023-12-04 11:30:49 +01:00
committed by GitHub
parent 12c65241ab
commit 7279d9b0d1
4 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
telemetry="telemetry/highspeed_rotorcraft.xml" telemetry="telemetry/highspeed_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic_geofence.xml" flight_plan="flight_plans/rotorcraft_basic_geofence.xml"
settings="settings/rotorcraft_basic.xml" settings="settings/rotorcraft_basic.xml"
settings_modules="modules/air_data.xml modules/airspeed_ms45xx_i2c.xml modules/electrical.xml modules/gps.xml modules/gps_ublox.xml modules/gps_ubx_ucenter.xml modules/guidance_indi_hybrid.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/imu_heater.xml modules/ins_ekf2.xml modules/logger_sd_chibios.xml modules/nav_hybrid.xml modules/nav_rotorcraft.xml modules/scheduling_indi_simple.xml modules/stabilization_indi_simple.xml" settings_modules="modules/air_data.xml modules/airspeed_ms45xx_i2c.xml modules/electrical.xml modules/gps.xml modules/gps_ublox.xml modules/gps_ubx_ucenter.xml modules/guidance_indi_hybrid.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/imu_heater.xml modules/ins_ekf2.xml modules/logger_sd_chibios.xml modules/nav_hybrid.xml modules/nav_rotorcraft.xml modules/preflight_checks.xml modules/scheduling_indi_simple.xml modules/stabilization_indi_simple.xml"
gui_color="blue" gui_color="blue"
/> />
<aircraft <aircraft
@@ -88,11 +88,13 @@ static void guidance_indi_filter_thrust(void);
#endif #endif
#ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ #ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
#ifndef GUIDANCE_INDI_THRUST_DYNAMICS
#ifndef STABILIZATION_INDI_ACT_FREQ_P #ifndef STABILIZATION_INDI_ACT_FREQ_P
#error "You need to define GUIDANCE_INDI_THRUST_DYN_FREQ to be able to use indi vertical control" #error "You need to define GUIDANCE_INDI_THRUST_DYN_FREQ to be able to use indi vertical control"
#else // assume that the same actuators are used for thrust as for roll (e.g. quadrotor) #else // assume that the same actuators are used for thrust as for roll (e.g. quadrotor)
#define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P #define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P
#endif #endif
#endif // GUIDANCE_INDI_THRUST_DYN_FREQ
#endif //GUIDANCE_INDI_THRUST_DYNAMICS_FREQ #endif //GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
@@ -170,11 +170,11 @@ float act_pref[INDI_NUM_ACT] = {0.0};
#ifdef STABILIZATION_INDI_ACT_DYN #ifdef STABILIZATION_INDI_ACT_DYN
#warning STABILIZATION_INDI_ACT_DYN is deprecated, use STABILIZATION_INDI_ACT_FREQ instead. #warning STABILIZATION_INDI_ACT_DYN is deprecated, use STABILIZATION_INDI_ACT_FREQ instead.
#warning You now have to define the continuous time corner frequency in rad/s of the actuators. #warning You now have to define the continuous time corner frequency in rad/s of the actuators.
#warning "Use -log(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old values. #warning "Use -log(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old values."
float act_first_order_cutoff[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_FREQ; float act_first_order_cutoff[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_DYN;
float act_dyn_discrete[INDI_NUM_ACT]; float act_dyn_discrete[INDI_NUM_ACT];
#else #else
float act_dyn_discrete[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_DYN; float act_dyn_discrete[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_FREQ;
#endif #endif
#ifdef STABILIZATION_INDI_WLS_PRIORITIES #ifdef STABILIZATION_INDI_WLS_PRIORITIES
@@ -349,8 +349,8 @@ void stabilization_indi_init(void)
// Initialize filters // Initialize filters
init_filters(); init_filters();
#ifdef STABILIZATION_INDI_ACT_FREQ
int8_t i; int8_t i;
#ifdef STABILIZATION_INDI_ACT_FREQ
// Initialize the array of pointers to the rows of g1g2 // Initialize the array of pointers to the rows of g1g2
for (i = 0; i < INDI_NUM_ACT; i++) { for (i = 0; i < INDI_NUM_ACT; i++) {
act_dyn_discrete[i] = 1-exp(-act_first_order_cutoff[i]/PERIODIC_FREQUENCY); act_dyn_discrete[i] = 1-exp(-act_first_order_cutoff[i]/PERIODIC_FREQUENCY);
@@ -44,11 +44,12 @@
#if defined(STABILIZATION_INDI_ACT_DYN_P) && !defined(STABILIZATION_INDI_ACT_DYN_Q) && !defined(STABILIZATION_INDI_ACT_DYN_R) #if defined(STABILIZATION_INDI_ACT_DYN_P) && !defined(STABILIZATION_INDI_ACT_DYN_Q) && !defined(STABILIZATION_INDI_ACT_DYN_R)
#warning STABILIZATION_INDI_ACT_DYN is deprecated, use STABILIZATION_INDI_ACT_FREQ instead. #warning STABILIZATION_INDI_ACT_DYN is deprecated, use STABILIZATION_INDI_ACT_FREQ instead.
#warning You now have to define the continuous time corner frequency in rad/s of the actuators. #warning You now have to define the continuous time corner frequency in rad/s of the actuators.
#warning "Use -log(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old values. #warning "Use -log(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old values."
#else #else
#if !defined(STABILIZATION_INDI_ACT_FREQ_P) && !defined(STABILIZATION_INDI_ACT_FREQ_Q) && !defined(STABILIZATION_INDI_ACT_FREQ_R) #if !defined(STABILIZATION_INDI_ACT_FREQ_P) && !defined(STABILIZATION_INDI_ACT_FREQ_Q) && !defined(STABILIZATION_INDI_ACT_FREQ_R)
#warning You have to define the corner frequency of the first order actuator dynamics model in rad/s! #warning You have to define the corner frequency of the first order actuator dynamics model in rad/s!
#endif #endif
#endif
// these parameters are used in the filtering of the angular acceleration // these parameters are used in the filtering of the angular acceleration
// define them in the airframe file if different values are required // define them in the airframe file if different values are required