Wheel encoders and slip

I’ve built a two-wheeled robot using a chassis with the 42x19mm wheels, wheel encoders, micro-metal gear motors, an arduino and a motor shield. I’ve written a PID algorithm for speed control which is generally working, but needs some improvement. The main problem I’m facing now is wheel slip. After traveling 1m, one wheel will be 1cm or so different from the other wheel. This is enough to turn the robot so its no longer moving in a straight line.

When connected to the computer through USB and tested under no load (holding the wheels off the table), the shaft encoders never differ by more than one or two ticks, which should be only a few mm difference.

Has anyone built a robot using these wheels and encoders and gotten it to drive straight? If so, I would appreciate some feedback on how to reduce the wheel slip.

Thanks,

Matt

Hello, Matt.

Slip will definitely throw off your ability to navigate using encoders alone. I don’t think you’ll ever be able to completely eliminate it, but you might be able to reduce it by changing how you control the motors, the surface you’re driving on, or the characteristics of your robot. My main suggestion is to avoid rapid acceleration of the wheels. Have you tried running on different surfaces to see if that makes a big difference?

I have seen a few robots in person that were able navigate very precise courses via these encoders alone, and I have seen videos of others.

- Ben

Well, at least that tells me its possible. I’ll keep working and hope to hear from someone who has actually done it to get some more specific tips.

Hello,

I have built a robot that was able to navigate reasonably well using those encoders, and I think you should follow Ben’s suggestions. Also, if it’s not obvious, this is easier if you keep the speed relatively slow.

It sounds like you have not tried getting any detailed debugging information back from the robot while it is actually driving. You could do that, for example by having the robot stop after 1m so that you can plug it in.

By the way you said it was about 1cm off, which is really only about 3 ticks, so I think you are doing pretty well. How much this affects the angle of your robot is determined by the distance between the wheels - can you make that any wider?

If you are up for taking this to the next level, you can use the encoder feedback to determine your robot’s specific position and orientation in two dimensions, and redesign your PID code to keep the robot moving back toward a mathematically defined line. That will not keep your robot pointing any straighter than just keeping the counts equal, but it’s path will be closer to a straight line.

-Paul