Encoders on Drive Train Programming

For programming a drive train to move forward a certain number of degrees with an encoder mounted both for the right side and left side, should I say that it should move until both of the encoders reach the distance, either of the encoders reaches the distance, or just choose one encoder and move until it reaches the right distance? Or, should I average the two readings?


Any of those options would work. We use the average of the two values.

Ok, thanks.

This would be a great opportunity to look into learning about PID loops. Aiming for target sensor values is basically what control loops are made for. I’d recommend using a PID loop on each side of the drive.

I usually only exit out of moving if average meets distance and if the difference in the encoders is less than a few degrees. This makes sure it is always facing straight.

For moving straight, my team sometimes uses the current position (with whatever offset from turns & such) as the setpoint for the second drive side. This makes sure that the robot moves straight, rather than simply straightening at the end, which puts the robot in a place that you don’t want. It’s a little more tricky to tune, but if we have enough time, it works well for us.