We are looking for help in diagnosing encoder inconsistency.
We currently have an AMT103 capacitive encoder mounted on the shaft coming out of the mini-toughbox on each side of the bot. We are able to get consistent readings from both encoders when we turn the wheels manually. However when we run auto, the robot occasionally will travel too far as if the the encoders are not registering each revolution.
We believed the sleeve placed on the output shaft might have been slipping. We placed a dab of superglue on the sleeve to ensure we we were not slipping at that point. That seemed to fix the problem for a while, but after about 20-25 practice runs we began having the same problem.
We have double and triple checked the wiring for loose connections and have not found anything. We added the second encoder and rewrote the code to cause the bot to stop forward motion if either encoder had accumulated enough revolutions. We have also swapped out the encoder for a replacement and wound up with same result.
Any ideas on where to look next?
I would start by marking your wheels so you can manually count the number of turns. This will let you independently verify what the encoders should be seeing, which will let you rule out wheel slippage or odometry issues.
Next, I would set up some auto tests at different speeds. Drive forward for 5 feet (or whatever distance) at 25%, 50%, 75% and full speed. If the problem is intermittent, do 10 runs of each. Do you notice the problem only at higher speeds, or is it present at all speeds?
Try running your test with the robot off the floor, counting revolutions manually to compare. With no load on the drive train, you may see different results.
Adding a second encoder so you have two measurements to compare is a great start to limiting the impact of the issue. I would also add in a time-based limitation to the auto, in case both encoders go on the fritz. You might end up a little farther than intended in that case, but having it stop after X second would hopefully help you ensure you stay on the correct side of the field!
So we had an issue similar to this with our arm this year (but with an SRX mag Encoder).
The issue that was causing sensor jumps was cross talk from from the encoder signal cable running too close to the arm motor power cables. We ended up moving the cables and wrapping the encoder cables in 1/2" Tinned Copper Metal Braided Sleeving
so you might want to check where that cable goes relative to the motor cables, and possibly think about shielding or rerouting (or both)
Could signal interference be coming from the motors themselves? The sensor is located directly between 2 mini-cims and then the cable runs below one motor, up the side of the motor, and then across the top of both motors to get to the roborio. We kept the sensor cables away from the power cables, but they are right up next to the motors.
yeah if your running a cable along a motor it most certainly can cause some issues. its something to look at.