While testing our new program, we noticed that both of our robot’s quadrature shaft encoders started outputting really strange values. When connected to the wheel, the value would bounce around from what seems like random values, back and forth, and into the negatives, until the shaft encoder finally went past its tick goal. When disconnected from the wheel and turned manually, the value didn’t even change, bouncing in values between -1 and 1. We tried changing the shaft encoder, but the same thing would happen.
We had a similar issue where I thought a bunch of encoders had gone bad. It turns out that it was a programming problem. The program was resetting the encoder to zero
The problem might just be the low QC on encoders. Just try the encoder on the side not connected to your chassis and see if it really is code or the encoders. The gyroscopes I remeber has big degree gaps in sensing.
@FrozenInTime Make sure your robot is running off of a 7.2V battery (one is plugged into the Cortex and the Cortex switch is set to ‘On’). Many sensors don’t work correctly when powered through USB.
To expand on what @Gear Geeks said:
Create a new, very basic program that is nothing more than the
#pragma
statements necessary for the shaft encoder and the typical infinite
I’ve had luck cleaning quadrature encoders. Once I had one that didn’t work and I took the whole thing apart, wiped everything with a wet paper towel, and put it back together again. I even cleaned the IR LED and receiver. It might be worth a try. That encoder had had its cap off for a while, though. I think that’s why it had dust in it.