Skip to content

Commit

Permalink
[fix] fix some bugs from #3190 (#3195)
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Dec 4, 2023
1 parent 12c6524 commit 7279d9b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conf/conf_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
telemetry="telemetry/highspeed_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic_geofence.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"
/>
<aircraft
Expand Down
2 changes: 2 additions & 0 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_indi.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ static void guidance_indi_filter_thrust(void);
#endif

#ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
#ifndef GUIDANCE_INDI_THRUST_DYNAMICS
#ifndef STABILIZATION_INDI_ACT_FREQ_P
#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)
#define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P
#endif
#endif // GUIDANCE_INDI_THRUST_DYN_FREQ
#endif //GUIDANCE_INDI_THRUST_DYNAMICS_FREQ


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ float act_pref[INDI_NUM_ACT] = {0.0};
#ifdef STABILIZATION_INDI_ACT_DYN
#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 "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;
#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_DYN;
float act_dyn_discrete[INDI_NUM_ACT];
#else
float act_dyn_discrete[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_DYN;
float act_dyn_discrete[INDI_NUM_ACT] = STABILIZATION_INDI_ACT_FREQ;
#endif

#ifdef STABILIZATION_INDI_WLS_PRIORITIES
Expand Down Expand Up @@ -349,8 +349,8 @@ void stabilization_indi_init(void)
// Initialize filters
init_filters();

#ifdef STABILIZATION_INDI_ACT_FREQ
int8_t i;
#ifdef STABILIZATION_INDI_ACT_FREQ
// Initialize the array of pointers to the rows of g1g2
for (i = 0; i < INDI_NUM_ACT; i++) {
act_dyn_discrete[i] = 1-exp(-act_first_order_cutoff[i]/PERIODIC_FREQUENCY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
#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 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
#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!
#endif
#endif

// these parameters are used in the filtering of the angular acceleration
// define them in the airframe file if different values are required
Expand Down

0 comments on commit 7279d9b

Please sign in to comment.