Skip to content

Commit

Permalink
AP_MotorsHeli: Support for Autorotation mode restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKear committed Sep 10, 2024
1 parent c031578 commit a255f0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions libraries/AP_Motors/AP_MotorsHeli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
11 changes: 7 additions & 4 deletions libraries/AP_Motors/AP_MotorsHeli.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand All @@ -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
Expand Down

0 comments on commit a255f0d

Please sign in to comment.