View Single Post
  #2   Spotlight this post!  
Unread 06-02-2007, 20:00
Kelly Kelly is offline
Registered User
FRC #1418
 
Join Date: Jan 2007
Location: VA
Posts: 78
Kelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud of
Re: Bizarre Driving Issue

p2_x and p2_y are unsigned integers. When your subtract from them to end up with a negative value, the computer will start to have problems. Store them in signed integers before you try to subtract 122.

basically change this:
Code:
if(p2_x<122) 	//more than 5 below 127
{
 deadx = ((p2_x - 122) * 127)/122 + 127;
  }
to
Code:
if(p2_x<122) 	//more than 5 below 127
{
    int drive_x=p2_x;
    deadx = ((drive_x - 122) * 127)/122 + 127;
}
Also, my team has found that the outputs from the victors is way asymetrical, and that they have their own, fairly large dead zone that doesn't happen to be centered about 127.