Control allocation: make heli rpm control an optional build flag disabled by default

to save flash.
The rpm capture dirver is also disabled on default releases
This commit is contained in:
Matthias Grob 2025-01-15 14:07:47 +01:00 committed by Mathieu Bresciani
parent 8ecb76aba2
commit e01fef755a
3 changed files with 16 additions and 3 deletions

View File

@ -10,3 +10,10 @@ menuconfig USER_CONTROL_ALLOCATOR
depends on BOARD_PROTECTED && MODULES_CONTROL_ALLOCATOR
---help---
Put control_allocator in userspace memory
menuconfig CONTROL_ALLOCATOR_RPM_CONTROL
bool "Include RPM control for Helicopter rotor"
default n
depends on MODULES_CONTROL_ALLOCATOR
---help---
Add support for controlling the helicopter main rotor rpm

View File

@ -135,11 +135,15 @@ void ActuatorEffectivenessHelicopter::updateSetpoint(const matrix::Vector<float,
_saturation_flags = {};
const float spoolup_progress = throttleSpoolupProgress();
float rpm_control_output = 0;
#if CONTROL_ALLOCATOR_RPM_CONTROL
_rpm_control.setSpoolupProgress(spoolup_progress);
rpm_control_output = _rpm_control.getActuatorCorrection();
#endif // CONTROL_ALLOCATOR_RPM_CONTROL
// throttle/collective pitch curve
const float throttle = (math::interpolateN(-control_sp(ControlAxis::THRUST_Z),
_geometry.throttle_curve) + _rpm_control.getActuatorCorrection()) * spoolup_progress;
const float throttle = (math::interpolateN(-control_sp(ControlAxis::THRUST_Z), _geometry.throttle_curve)
+ rpm_control_output) * spoolup_progress;
const float collective_pitch = math::interpolateN(-control_sp(ControlAxis::THRUST_Z), _geometry.pitch_curve);
// actuator mapping

View File

@ -134,5 +134,7 @@ private:
const ActuatorType _tail_actuator_type;
RpmControl _rpm_control{this};
#if CONTROL_ALLOCATOR_RPM_CONTROL
RpmControl _rpm_control {this};
#endif // CONTROL_ALLOCATOR_RPM_CONTROL
};