We are attempting to use closed-loop encoder control with our Jaguars this year. When we hook our CAN network up to a computer, we can use BDC-COMM to set output values in RPM and the motors run correctly.
When we try to control the Jaguars from Java, we can’t get it to work. We can control the Jaguars in the percent voltage mode just fine (that’s the -1 to 1 output mode). When we switch to voltage, speed, or current mode, they don’t work. The motors don’t move, the light on the Jaguar stays solid yellow, and the voltage output according to the code is 0.
Our code is in teleopPeriodic() and looks like this:
try{
leftMotor.changeControlMode(CANJaguar.ControlMode.kVoltage);
leftMotor.setX(6);
// a bunch of printlns for debugging
}catch(CANTimeoutException ex){
ex.printStackTrace();
}
No exceptions, nothing but yellow lights on the Jaguar. Nothing.
Any ideas?