|
|
|
@ -431,18 +431,6 @@ void Joystick::run(void)
@@ -431,18 +431,6 @@ void Joystick::run(void)
|
|
|
|
|
throttle_accu = std::max(static_cast<float>(-1.f), std::min(throttle_accu, static_cast<float>(1.f))); |
|
|
|
|
throttle = throttle_accu; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float roll_limited = std::max(static_cast<float>(-M_PI_4), std::min(roll, static_cast<float>(M_PI_4))); |
|
|
|
|
float pitch_limited = std::max(static_cast<float>(-M_PI_4), std::min(pitch, static_cast<float>(M_PI_4))); |
|
|
|
|
float yaw_limited = std::max(static_cast<float>(-M_PI_4), std::min(yaw, static_cast<float>(M_PI_4))); |
|
|
|
|
float throttle_limited = std::max(static_cast<float>(-M_PI_4), std::min(throttle, static_cast<float>(M_PI_4))); |
|
|
|
|
|
|
|
|
|
// Map from unit circle to linear range and limit
|
|
|
|
|
roll = std::max(-1.0f, std::min(tanf(asinf(roll_limited)), 1.0f)); |
|
|
|
|
pitch = std::max(-1.0f, std::min(tanf(asinf(pitch_limited)), 1.0f)); |
|
|
|
|
yaw = std::max(-1.0f, std::min(tanf(asinf(yaw_limited)), 1.0f)); |
|
|
|
|
throttle = std::max(-1.0f, std::min(tanf(asinf(throttle_limited)), 1.0f)); |
|
|
|
|
|
|
|
|
|
if ( _exponential ) { |
|
|
|
|
// Exponential (0% to -50% range like most RC radios)
|
|
|
|
|
// 0 for no exponential
|
|
|
|
|