preflight check: modify actuator_sp if running

this adds a new flag to ActuatorEffectivenessTiltrotorVTOL:
_preflight_check_running. We set it from ControlAllocator, and if true
we always add collective tilt to the actuator setpoint.
This commit is contained in:
Balduin
2025-02-18 13:03:45 +01:00
parent 122643af25
commit 96fc4a0673
3 changed files with 10 additions and 1 deletions
@@ -447,6 +447,13 @@ ControlAllocator::Run()
for (int i = 0; i < _num_control_allocation; ++i) {
ActuatorEffectivenessTiltrotorVTOL *casted = dynamic_cast<ActuatorEffectivenessTiltrotorVTOL *>
(_actuator_effectiveness);
if (casted != nullptr) {
casted->_preflight_check_running = _preflight_check_running;
}
_control_allocation[i]->setControlSetpoint(c[i]);
// Do allocation
@@ -166,7 +166,7 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
if (_tilts.config(i).tilt_direction == ActuatorEffectivenessTilts::TiltDirection::TowardsFront) {
// as long as throttle spoolup is not completed, leave the tilts in the disarmed position (in hover)
if (throttleSpoolupFinished() || _flight_phase != FlightPhase::HOVER_FLIGHT) {
if (throttleSpoolupFinished() || _flight_phase != FlightPhase::HOVER_FLIGHT || _preflight_check_running) {
actuator_sp(i + _first_tilt_idx) += control_collective_tilt;
} else {
@@ -88,6 +88,8 @@ public:
void getUnallocatedControl(int matrix_index, control_allocator_status_s &status) override;
bool _preflight_check_running{false};
protected:
bool _collective_tilt_updated{true};
ActuatorEffectivenessRotors _mc_rotors;