From a07b514ee8e1e31618d766e5c778e8c72f30f9f4 Mon Sep 17 00:00:00 2001 From: bnsgeyer Date: Tue, 5 Mar 2024 23:18:38 -0500 Subject: [PATCH] Copter: allow tradheli inverted feature for stabilize, althold, loiter and auto modes --- ArduCopter/heli.cpp | 5 +++-- ArduCopter/mode.h | 11 ++++++++++- ArduCopter/mode_stabilize_heli.cpp | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ArduCopter/heli.cpp b/ArduCopter/heli.cpp index 91d9e79a65..5d4f562a71 100644 --- a/ArduCopter/heli.cpp +++ b/ArduCopter/heli.cpp @@ -106,8 +106,9 @@ void Copter::update_heli_control_dynamics(void) bool Copter::should_use_landing_swash() const { if (flightmode->has_manual_throttle() || - flightmode->mode_number() == Mode::Number::DRIFT) { - // manual modes always uses full swash range + flightmode->mode_number() == Mode::Number::DRIFT || + attitude_control->get_inverted_flight()) { + // manual modes or modes using inverted flight uses full swash range return false; } if (flightmode->is_landing()) { diff --git a/ArduCopter/mode.h b/ArduCopter/mode.h index e50f045b67..af3519628e 100644 --- a/ArduCopter/mode.h +++ b/ArduCopter/mode.h @@ -471,7 +471,9 @@ public: } bool allows_autotune() const override { return true; } bool allows_flip() const override { return true; } - +#if FRAME_CONFIG == HELI_FRAME + bool allows_inverted() const override { return true; }; +#endif protected: const char *name() const override { return "ALT_HOLD"; } @@ -499,6 +501,9 @@ public: bool allows_arming(AP_Arming::Method method) const override; bool is_autopilot() const override { return true; } bool in_guided_mode() const override { return _mode == SubMode::NAVGUIDED || _mode == SubMode::NAV_SCRIPT_TIME; } +#if FRAME_CONFIG == HELI_FRAME + bool allows_inverted() const override { return true; }; +#endif // Auto modes enum class SubMode : uint8_t { @@ -1250,6 +1255,10 @@ public: bool has_user_takeoff(bool must_navigate) const override { return true; } bool allows_autotune() const override { return true; } +#if FRAME_CONFIG == HELI_FRAME + bool allows_inverted() const override { return true; }; +#endif + #if AC_PRECLAND_ENABLED void set_precision_loiter_enabled(bool value) { _precision_loiter_enabled = value; } #endif diff --git a/ArduCopter/mode_stabilize_heli.cpp b/ArduCopter/mode_stabilize_heli.cpp index e9caa4212b..2dbf9bbdb4 100644 --- a/ArduCopter/mode_stabilize_heli.cpp +++ b/ArduCopter/mode_stabilize_heli.cpp @@ -78,7 +78,7 @@ void ModeStabilize_Heli::run() attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(target_roll, target_pitch, target_yaw_rate); // output pilot's throttle - note that TradHeli does not used angle-boost - attitude_control->set_throttle_out(pilot_throttle_scaled, false, g.throttle_filt); + attitude_control->set_throttle_out(pilot_throttle_scaled, true, g.throttle_filt); } #endif //HELI_FRAME