mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 00:31:36 +08:00
Flight mode manager: Protect for full throttle scaling
PX4 supports -1 to 1 as input and this module was not protected against the input range.
This commit is contained in:
@@ -53,7 +53,8 @@ bool Sticks::checkAndSetStickInputs()
|
||||
// Linear scale
|
||||
_positions(0) = manual_control_setpoint.x; // NED x, pitch [-1,1]
|
||||
_positions(1) = manual_control_setpoint.y; // NED y, roll [-1,1]
|
||||
_positions(2) = -(manual_control_setpoint.z - 0.5f) * 2.f; // NED z, thrust resacaled from [0,1] to [-1,1]
|
||||
_positions(2) = -(math::constrain(manual_control_setpoint.z, 0.0f,
|
||||
1.0f) - 0.5f) * 2.f; // NED z, thrust resacaled from [0,1] to [-1,1]
|
||||
_positions(3) = manual_control_setpoint.r; // yaw [-1,1]
|
||||
|
||||
// Exponential scale
|
||||
|
||||
Reference in New Issue
Block a user