We have three US Digital quad encoders on our robot this year. We’ve implemented the fake encoder workaround for GetRate(), and the two encoders that we need to get rate out of are working fine, but the third, which we only need distance out of, never registers any change. The following code contains the contructors for all of our encoders:
fakeEncoderA = new Encoder(6,1,6,2,false, fakeEncoderA->k4X);
leftEncoder = new Encoder(4, LEFTMOTORA, 4, LEFTMOTORB, false, leftEncoder->k4X);
//fakeEncoderB = new Encoder(6,3,6,4,false, fakeEncoderB->k4X);
liftEncoder = new Encoder(4, LIFTMOTORA, 4, LIFTMOTORB, false, liftEncoder->k4X);
rightEncoder = new Encoder(4, RIGHTMOTORA, 4, RIGHTMOTORB, false, rightEncoder->k4X);
//fakeEncoderC = new Encoder(6,5,6,6,false, fakeEncoderC->k4X);
//liftEncoder = new Encoder(4, LIFTMOTORA, 4, LIFTMOTORB, false, liftEncoder->k4X);
The lift encoder is the one that doesn’t register change. We have verified that the encoder works by plugging it into the left encoder’s ports and reading it as the left encoder. We have also verified that the pins that the encoder is plugged into are working by successfully reading the left encoder off of them. The lift encoder still doesn’t read if we comment out all of the other encoders, change the order of the constructors and declarations, or change the encoding type to 2X. Also, if none of the encoder constructors are commented out, the console constantly throws an “Assertion Failed” error from line 217 of Encoder.cpp in WPILib. I assumed that was because the FPGA can’t handle 6 4X encoders, but changing them to 2X or 1X didn’t help. Does anyone know how to solve this problem, or what’s causing it?