Skip to content

Instantly share code, notes, and snippets.

@DanielVartanov
Created July 18, 2015 18:36
Show Gist options
  • Save DanielVartanov/c63ca0846d2a61f3cef5 to your computer and use it in GitHub Desktop.
Save DanielVartanov/c63ca0846d2a61f3cef5 to your computer and use it in GitHub Desktop.
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