Created
July 18, 2015 18:36
-
-
Save DanielVartanov/c63ca0846d2a61f3cef5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case angle_diff.abs | |
when 0.degrees..45.degrees | |
ratio = 1 - angle_diff / 45.degrees | |
motor! [-sign, ratio].max * power, [ratio, sign].max * power | |
when 45.degrees..135.degrees | |
motor! [-sign, 0].max * power, [0, sign].max * power | |
when 180.degrees | |
motor! -1, 1 | |
else | |
motor! -sign, sign | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment