Speed Correction

From my observations today, it seems like one side of the robot is slightly faster than the other. How can I get the faster side to move at the same speed as the slower side?
We have an encoder on each side so I figure I can do something with that? I was thinking something like a pid system, but I don’t know how to do it. If anyone could hook me up with some code examples on how I can correct this speed error, it would be greatly appreciated.


You could use some kind of PID system where the faster side is slowed down to follow the slower speed. For that you’d use PID to match the fast side to the slow side encoder rate. May be overkill though.

Generally, if they’re off by enough to notice, the mechanical team needs to find out why one side has much more friction than the other. You should not fix this in software if you can avoid it. Build it right.

An easy and effective method is to just multiply the fast side’s control value by some factor, say 0.89, and feed that to the speed controllers. Play with the number until it works well at top speed.

But again, remind the mechanical team that you are slowing down the better-performing side to compensate for their inadequate assembly technique. That means the whole robot gets slower. Build it tight instead.