Skip to content

Commit

Permalink
Control allocation: make heli rpm control an optional build flag disa…
Browse files Browse the repository at this point in the history
…bled by default

to save flash.
The rpm capture dirver is also disabled on default releases
  • Loading branch information
MaEtUgR authored and bresch committed Jan 15, 2025
1 parent 8ecb76a commit e01fef7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/modules/control_allocator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,7 @@ class ActuatorEffectivenessHelicopter : public ModuleParams, public ActuatorEffe

const ActuatorType _tail_actuator_type;

RpmControl _rpm_control{this};
#if CONTROL_ALLOCATOR_RPM_CONTROL
RpmControl _rpm_control {this};
#endif // CONTROL_ALLOCATOR_RPM_CONTROL
};

0 comments on commit e01fef7

Please sign in to comment.