AP_Motors: tradheli - add support to determine below mid collective

This commit is contained in:
bnsgeyer 2020-12-20 16:42:06 -05:00 committed by Andrew Tridgell
parent 613af0aeec
commit 9a9c88829e
4 changed files with 26 additions and 0 deletions

View File

@ -130,6 +130,9 @@ public:
// accessor to get the takeoff collective flag signifying that current collective is greater than collective required to indicate takeoff // accessor to get the takeoff collective flag signifying that current collective is greater than collective required to indicate takeoff
bool get_takeoff_collective() const { return _heliflags.takeoff_collective; } bool get_takeoff_collective() const { return _heliflags.takeoff_collective; }
// accessor to get the takeoff collective flag signifying that current collective is greater than collective required to indicate takeoff
bool get_below_mid_collective() const { return _heliflags.below_mid_collective; }
// support passing init_targets_on_arming flag to greater code // support passing init_targets_on_arming flag to greater code
bool init_targets_on_arming() const override { return _heliflags.init_targets_on_arming; } bool init_targets_on_arming() const override { return _heliflags.init_targets_on_arming; }
@ -241,6 +244,7 @@ protected:
uint8_t servo_test_running : 1; // true if servo_test is running uint8_t servo_test_running : 1; // true if servo_test is running
uint8_t land_complete : 1; // true if aircraft is landed 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 takeoff_collective : 1; // true if collective is above 30% between H_COL_MID and H_COL_MAX
uint8_t below_mid_collective : 1; // true if collective is below H_COL_MID
} _heliflags; } _heliflags;
// parameters // parameters

View File

@ -552,6 +552,13 @@ void AP_MotorsHeli_Dual::move_actuators(float roll_out, float pitch_out, float c
limit.throttle_lower = true; limit.throttle_lower = true;
} }
// updates below mid collective flag
if (collective_out <= _collective_mid_pct) {
_heliflags.below_mid_collective = true;
} else {
_heliflags.below_mid_collective = false;
}
// updates takeoff collective flag based on 50% hover collective // updates takeoff collective flag based on 50% hover collective
update_takeoff_collective_flag(collective_out); update_takeoff_collective_flag(collective_out);

View File

@ -230,6 +230,13 @@ void AP_MotorsHeli_Quad::move_actuators(float roll_out, float pitch_out, float c
limit.throttle_lower = true; limit.throttle_lower = true;
} }
// updates below mid collective flag
if (collective_out <= _collective_mid_pct) {
_heliflags.below_mid_collective = true;
} else {
_heliflags.below_mid_collective = false;
}
// updates takeoff collective flag based on 50% hover collective // updates takeoff collective flag based on 50% hover collective
update_takeoff_collective_flag(collective_out); update_takeoff_collective_flag(collective_out);

View File

@ -417,6 +417,14 @@ void AP_MotorsHeli_Single::move_actuators(float roll_out, float pitch_out, float
if (_heliflags.landing_collective && collective_out < _collective_mid_pct && !_heliflags.in_autorotation) { if (_heliflags.landing_collective && collective_out < _collective_mid_pct && !_heliflags.in_autorotation) {
collective_out = _collective_mid_pct; collective_out = _collective_mid_pct;
limit.throttle_lower = true; limit.throttle_lower = true;
}
// updates below mid collective flag
if (collective_out <= _collective_mid_pct) {
_heliflags.below_mid_collective = true;
} else {
_heliflags.below_mid_collective = false;
} }
// updates takeoff collective flag based on 50% hover collective // updates takeoff collective flag based on 50% hover collective