|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Encoder Feedback From Jaguar
Our team has decided to plug an encoder into one of our Jaguars to regulate the speed of our shooter for more accurate results.
However, we are not getting any output from the encoder. There is potentially a hardware or software issue. Our Code: Initialization PHP Code:
PHP Code:
Any ideas? |
|
#2
|
||||
|
||||
|
Re: Encoder Feedback From Jaguar
driverStation.updateLCD() needs to be called when you want the text to show up. (Every single time println is called)
|
|
#3
|
|
|
Re: Encoder Feedback From Jaguar
Quote:
It's most likely a software issue. You have to tell the Jaguar the reference for the encoder. I haven't tried it, but you should be able to set it without going into speed control. (I have only tried it in position control mode, but after the reference is set, it works until the Jag is power cycled. That includes changing modes.) What you should try is code that is something like this: Code:
try {
rightMotor1 = new CANJaguar(11, CANJaguar.ControlMode.kSpeed); // on the one that has the encoder plugged into it.
rightMotor1.configEncoderCodesPerRev(360); // change to however many counts per rev on your shooter
rightMotor1.enableControl(); // Not sure if this line is needed
rightMotor1.changeControlMode(CANJaguar.ControlMode.kPercentVbus); //Change back to voltage mode now that the encoder is configured
rightMotor1.enableControl(); // From this point on, you should see a speed on your debugging statements
rightMotor2 = new CANJaguar(12, CANJaguar.ControlMode.kPercentVbus);
leftMotor1 = new CANJaguar(13, CANJaguar.ControlMode.kPercentVbus);
leftMotor2 = new CANJaguar(15, CANJaguar.ControlMode.kPercentVbus);
} catch (CANTimeoutException ex) {
ex.printStackTrace();
}
|
|
#4
|
|||||
|
|||||
|
Re: Encoder Feedback From Jaguar
Agreed, you are missing the encoder configuration.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|