View Single Post
  #6   Spotlight this post!  
Unread 11-02-2012, 00:09
ianonavy ianonavy is offline
Programming Mentor/Alumnus
AKA: Ian Adam Naval
FRC #3120 (RoboKnights)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2008
Location: Sherman Oaks
Posts: 32
ianonavy is an unknown quantity at this point
Re: Robot Motors Drifting?

If you can't figure out how to calibrate either the joystick or the speed controller, you can actually fix this through programming.

I'm not sure what language you're using, so here's some pseudo-Java
Code:
// Teleop
final double THRESHOLD = 0.04;

double x = joystick.getX();
double y = joystick.getY();

if (Math.abs(x) > THRESHOLD || Math.abs(y) > THRESHOLD) {
    drive(y, x);
} else {
    stopDriveMotors();
}
Basically, your motors won't drive unless the magnitude of your joystick values is greater than a certain threshold. That way, if your joysticks are reading "0.03" when they're at rest and should be "0.0", your motors will still be off. This of course means you'll be unable to drive the robot at 3-4% speed, but does the robot even move at that speed anyway?

Hope this helps!