Skip to content
Snippets Groups Projects
Commit 279d560f authored by nanthony21's avatar nanthony21
Browse files

Revert "Removed code that cut off the last 25% of joystick motion in either...

Revert "Removed code that cut off the last 25% of joystick motion in either direction. I'm not sure what the original purpose of this code was."

This reverts commit 4c34fb38.
parent a106d226
No related branches found
No related tags found
No related merge requests found
......@@ -438,6 +438,18 @@ 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment