CA: Tiltrotor: set tilts to exactly -1 or 1 if close to these end points

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2022-02-01 10:14:59 +01:00 committed by Beat Küng
parent 25f5152583
commit 97a280d41d

View File

@ -111,6 +111,10 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
if (_actuator_controls_1_sub.copy(&actuator_controls_1)) {
float control_tilt = actuator_controls_1.control[4] * 2.f - 1.f;
// set control_tilt to exactly -1 or 1 if close to these end points
control_tilt = control_tilt < -0.99f ? -1.f : control_tilt;
control_tilt = control_tilt > 0.99f ? 1.f : control_tilt;
// initialize _last_tilt_control
if (!PX4_ISFINITE(_last_tilt_control)) {
_last_tilt_control = control_tilt;