View Single Post
  #4   Spotlight this post!  
Unread 17-01-2017, 13:07
david.e.boles david.e.boles is offline
Bringer of Whales and Petunias
AKA: david476
FRC #5940 (BREAD)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2011
Location: San Francisco, CA
Posts: 30
david.e.boles is on a distinguished road
Re: Swerve Programming joystick issues

It's difficult without your code to give an exact solution, but something like this should work for determining the best direction to rotate (as discussed above):

(W)heel pos: 350
(J)oystick pos: 10

(W-J)%360 = 340 -> bigger than 180, don't turn negative
(J-W)%360 = 20 -> smaller than or = to 180, turn positive!
Reply With Quote