View Single Post
  #17   Spotlight this post!  
Unread 08-10-2003, 21:06
golf_cart_john golf_cart_john is offline
Registered User
AKA: John W
FRC #0095 (Grasshoppers)
Team Role: Coach
 
Join Date: Sep 2003
Rookie Year: 2004
Location: Lebanon, NH
Posts: 35
golf_cart_john will become famous soon enoughgolf_cart_john will become famous soon enough
My team likes 1 stick drive, better, but all this debate seems to say that having a switch between the two methods is a good idea. Each driver can drive how (s)he likes.
Anyway, it shouldn't be too hard to switch between the two. Each method can be expressed as two formulas that give left tread and right tread ans a function of input. So, you can have code like WakeZero's code:

Code:
if(switch == 1)
{
//one joystick formula
pwm1 = p1_y + p1_x - 128;
pwm2 = p1_y - p1_x - 128;
}
else if(switch == 0)
{
//two joystick formula
pwm1 = p1_y;
pwm2 = p2_y;
}
Those aren't the exact formulas, but it shouldn't be too hard to do if you just use your existing formulas for each type of drive.