Ice shedding: initial, very simple draft

- overwrite the motor outputs of the disabled motors in
   ControlAllocator::publish_actuator_controls()
 - not yet configurable by any params
 - gives same output to all motors
     - risky if this produces torques already, which is the case:
	 - for tiltrotors, where only the back motor(s) spin(s) to de-ice
	 - for standard VTOL if the MC rotors are not exactly centered
	   around the CG
	 - for standard VTOL if any motor has failed
This commit is contained in:
Balduin
2026-01-23 16:02:05 +01:00
parent 5d5e1db97f
commit 4ee4ba0d5e
@@ -670,6 +670,17 @@ ControlAllocator::publish_actuator_controls()
| _handled_motor_failure_bitmask
| _motor_stop_mask;
// Feature config
const bool spin_to_shed_enabled = true; // TODO replace by param
const int period_sec = 10;
const int on_sec = 5;
const float shed_ice_thrust = 0.1f;
// Conditions to run motors
const bool time_to_spin = (actuator_motors.timestamp / 1_s) % period_sec < on_sec;
const bool in_forward_flight = _actuator_effectiveness->getFlightPhase() == ActuatorEffectiveness::FlightPhase::FORWARD_FLIGHT;
const bool spin_upwards_motors_to_shed_ice = spin_to_shed_enabled && time_to_spin && in_forward_flight;
// motors
int motors_idx;
@@ -680,6 +691,10 @@ ControlAllocator::publish_actuator_controls()
if (stopped_motors & (1u << motors_idx)) {
actuator_motors.control[motors_idx] = NAN;
if (spin_upwards_motors_to_shed_ice) {
actuator_motors.control[motors_idx] = shed_ice_thrust;
}
}
++actuator_idx_matrix[selected_matrix];