mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 05:53:33 +08:00
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:
@@ -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
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
+2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user