diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index fc93264ed5d7f9..d215f349c7f26b 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -103,12 +103,7 @@ const AP_Param::GroupInfo AP_MotorsHeli::var_info[] = { // @User: Advanced AP_GROUPINFO("HOVER_LEARN", 27, AP_MotorsHeli, _collective_hover_learn, HOVER_LEARN_AND_SAVE), - // @Param: OPTIONS - // @DisplayName: Heli_Options - // @Description: Bitmask of heli options. Bit 0 changes how the pitch, roll, and yaw axis integrator term is managed for low speed and takeoff/landing. In AC 4.0 and earlier, scheme uses a leaky integrator for ground speeds less than 5 m/s and won't let the steady state integrator build above ILMI. The integrator is allowed to build to the ILMI value when it is landed. The other integrator management scheme bases integrator limiting on takeoff and landing. Whenever the aircraft is landed the integrator is set to zero. When the aicraft is airborne, the integrator is only limited by IMAX. - // @Bitmask: 0:Use Leaky I - // @User: Standard - AP_GROUPINFO("OPTIONS", 28, AP_MotorsHeli, _heli_options, (uint8_t)HeliOption::USE_LEAKY_I), + // index 28 was OPTIONS and was moved up to copter/heli_params. Do not use this index in the future. // @Param: COL_ANG_MIN // @DisplayName: Collective Blade Pitch Angle Minimum @@ -341,7 +336,7 @@ void AP_MotorsHeli::output_logic() // Servos set to their trim values or in a test condition. // set limits flags - if (!using_leaky_integrator()) { + if (!_heliflags._using_leaky_integrator) { set_limit_flag_pitch_roll_yaw(true); } else { set_limit_flag_pitch_roll_yaw(false); @@ -358,7 +353,7 @@ void AP_MotorsHeli::output_logic() case SpoolState::GROUND_IDLE: { // Motors should be stationary or at ground idle. // set limits flags - if (_heliflags.land_complete && !using_leaky_integrator()) { + if (_heliflags.land_complete && !_heliflags._using_leaky_integrator) { set_limit_flag_pitch_roll_yaw(true); } else { set_limit_flag_pitch_roll_yaw(false); @@ -380,7 +375,7 @@ void AP_MotorsHeli::output_logic() // Servos should exhibit normal flight behavior. // set limits flags - if (_heliflags.land_complete && !using_leaky_integrator()) { + if (_heliflags.land_complete && !_heliflags._using_leaky_integrator) { set_limit_flag_pitch_roll_yaw(true); } else { set_limit_flag_pitch_roll_yaw(false); @@ -402,7 +397,7 @@ void AP_MotorsHeli::output_logic() // Servos should exhibit normal flight behavior. // set limits flags - if (_heliflags.land_complete && !using_leaky_integrator()) { + if (_heliflags.land_complete && !_heliflags._using_leaky_integrator) { set_limit_flag_pitch_roll_yaw(true); } else { set_limit_flag_pitch_roll_yaw(false); @@ -422,7 +417,7 @@ void AP_MotorsHeli::output_logic() // Servos should exhibit normal flight behavior. // set limits flags - if (_heliflags.land_complete && !using_leaky_integrator()) { + if (_heliflags.land_complete && !_heliflags._using_leaky_integrator) { set_limit_flag_pitch_roll_yaw(true); } else { set_limit_flag_pitch_roll_yaw(false); @@ -497,12 +492,6 @@ void AP_MotorsHeli::update_takeoff_collective_flag(float coll_out) } } -// Determines if _heli_options bit is set -bool AP_MotorsHeli::heli_option(HeliOption opt) const -{ - return (_heli_options & (uint8_t)opt); -} - // updates the turbine start flag void AP_MotorsHeli::update_turbine_start() { diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index f2a8ce6100400b..68d03c91df8281 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -145,14 +145,6 @@ class AP_MotorsHeli : public AP_Motors { //return zero lift collective position float get_coll_mid() const { return _collective_zero_thrust_pct; } - // enum for heli optional features - enum class HeliOption { - USE_LEAKY_I = (1<<0), // 1 - }; - - // use leaking integrator management scheme - bool using_leaky_integrator() const { return heli_option(HeliOption::USE_LEAKY_I); } - // Run arming checks bool arming_checks(size_t buflen, char *buffer) const override; @@ -165,6 +157,9 @@ class AP_MotorsHeli : public AP_Motors { // Helper function for param conversions to be done in motors class virtual void heli_motors_param_conversions(void) { return; } + // Helper function to set the _using_leaky_integrator flag + void set_leaky_integrator(bool use) { _heliflags._using_leaky_integrator = use; } + // var_info for holding Parameter information static const struct AP_Param::GroupInfo var_info[]; @@ -226,9 +221,6 @@ class AP_MotorsHeli : public AP_Motors { // save parameters as part of disarming void save_params_on_disarm() override; - // Determines if _heli_options bit is set - bool heli_option(HeliOption opt) const; - // updates the takeoff collective flag indicating that current collective is greater than collective required to indicate takeoff. void update_takeoff_collective_flag(float coll_out); @@ -257,8 +249,9 @@ class AP_MotorsHeli : public AP_Motors { uint8_t land_complete : 1; // true if aircraft is landed uint8_t takeoff_collective : 1; // true if collective is above 30% between H_COL_MID and H_COL_MAX uint8_t below_land_min_coll : 1; // true if collective is below H_COL_LAND_MIN - uint8_t rotor_spooldown_complete : 1; // true if the rotors have spooled down completely + uint8_t rotor_spooldown_complete : 1; // true if the rotors have spooled down completely uint8_t start_engine : 1; // true if turbine start RC option is initiated + bool _using_leaky_integrator : 1; // true if h_options is set to use leaky I term } _heliflags; // parameters @@ -269,7 +262,6 @@ class AP_MotorsHeli : public AP_Motors { AP_Int8 _servo_test; // sets number of cycles to test servo movement on bootup AP_Float _collective_hover; // estimated collective required to hover throttle in the range 0 ~ 1 AP_Int8 _collective_hover_learn; // enable/disabled hover collective learning - AP_Int8 _heli_options; // bitmask for optional features AP_Float _collective_zero_thrust_deg;// Zero thrust blade collective pitch in degrees AP_Float _collective_land_min_deg; // Minimum Landed collective blade pitch in degrees for non-manual collective modes (i.e. modes that use altitude hold) AP_Float _collective_max_deg; // Maximum collective blade pitch angle in deg that corresponds to the PWM set for maximum collective pitch (H_COL_MAX)