Robot Motors Drifting?

Hey guys quick question, my team has a robot with 8in mecanum wheels. We have one Cim motor per wheel. The front right and back left wheels are slowly moving when it should be still. The question I have is: Is there a way to “calibrate” the joystick to the motors? We are using a brand new Xbox 360 controller. The is no drift in the stick itself because the drift is present while using the Attack 3 joystick as well. Please help me!! Thankyou! :slight_smile:

Sounds like you need to calibrate your motor controllers. I am somewhat familiar with Jags. I bet the procedure is similar on Victors and can be found in the documentation. On Jags you have to use a paperclip to hold down a reset button and move your joystick through its entire range of motion. I can’t remember off hand what the exact sequence is but you can find it in the documentation.

From the TI Jaguar FAQ:

Q38 Do I need to calibrate the Servo (PWM) interface?
A
It depends. The motor controller has a calibration mode, and the need to calibrate depends on the Servo
(PWM) signal range generated by the robot controller.
For FRC users, the answer is probably not if you are using the cRIO system and a new motor controller.
The default parameters of the motor controller are tuned for use with the cRIO. The calibration mode is
provided if you want to use the motor controller with another source of Servo (PWM) signal that does not
have the same range of pulse widths (for example, an older robot controller). Or, if you have calibrated
your Jaguar (MDL-BDC) from a different source and move it back to a cRIO system, you must recalibrate.

From what I’ve heard the XBox Controller’s do not self-center very well, due to their design. Joysticks may not perfectly self-center either for various reasons. We normally code a “deadband” of about 5%, to not only deal with self-centering but to also deal with the Driver not necessarily centering the Joystick when their hands are on the controller.

The way a deadband works is if a signal is within a range (say +/-5%) it outputs a zero. Otherwise it outputs the input signal. Pretty easy and then you don’t have this to worry about again.

This probably isn’t an issue for you, but just in case: make sure your code isn’t trying to control a Victor while you actually have a Jaguar installed, and vice versa. The “neutral” signals for each are slightly offset from each other.

To test the PWM signal to the motor controller: Hard code a zero speed command and let the robot sit enabled. If the motors do not run, your PWM is good. It seems we had to add a dead band so if the controller were close to zero it sent a zero command to the PWM.

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


// 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? :stuck_out_tongue:

Hope this helps!