Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
};
Loading