diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index 458d639aa89d0b..9934350bf21897 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -623,3 +623,10 @@ float AP_MotorsHeli::get_cyclic_angle_scaler(void) const { return ((float)(_collective_max-_collective_min))*1e-3 * (_collective_max_deg.get() - _collective_min_deg.get()) * 2.0; } #endif + +// function to calculate the normalised collective position given a desired blade pitch angle (deg) +float AP_MotorsHeli::calc_coll_from_ang(float col_ang_deg) const +{ + float col_norm = col_ang_deg / MAX((_collective_max_deg.get() - _collective_min_deg.get()), 1.0); + return constrain_float(col_norm, 0.0, 1.0); +} diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index 8dc690611b95d4..03d9832f5e6b46 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -118,8 +118,8 @@ class AP_MotorsHeli : public AP_Motors { // support passing init_targets_on_arming flag to greater code bool init_targets_on_arming() const override { return _heliflags.init_targets_on_arming; } - // arot_man_enabled - gets contents of manual_autorotation_enabled parameter - bool arot_man_enabled() const { return _main_rotor.autorotation_enabled(); } + // rsc_arot_enabled - gets contents of manual_autorotation_enabled parameter + bool rsc_arot_enabled() const { return _main_rotor.autorotation_enabled(); } // helper for vehicle code to request autorotation states in the RSC. void set_autorotation_active(bool tf) { _main_rotor.set_autorotation_active(tf); } @@ -135,8 +135,11 @@ class AP_MotorsHeli : public AP_Motors { // set land complete flag void set_land_complete(bool landed) { _heliflags.land_complete = landed; } - - //return zero lift collective position + + // function to calculate the normalised collective position given a desired blade pitch angle (deg) + float calc_coll_from_ang(float col_ang_deg) const; + + //return zero lift collective position float get_coll_mid() const { return _collective_zero_thrust_pct; } // enum for heli optional features