mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 06:01:35 +08:00
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:
+4
@@ -111,6 +111,10 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
|
|||||||
if (_actuator_controls_1_sub.copy(&actuator_controls_1)) {
|
if (_actuator_controls_1_sub.copy(&actuator_controls_1)) {
|
||||||
float control_tilt = actuator_controls_1.control[4] * 2.f - 1.f;
|
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
|
// initialize _last_tilt_control
|
||||||
if (!PX4_ISFINITE(_last_tilt_control)) {
|
if (!PX4_ISFINITE(_last_tilt_control)) {
|
||||||
_last_tilt_control = control_tilt;
|
_last_tilt_control = control_tilt;
|
||||||
|
|||||||
Reference in New Issue
Block a user