Enable PID for motor control


#1

My GoPiGo is drifting and wont drive in a straight line, and I’ve noticed that this is due to the motors running at different speeds. To fix this I was going to write a feedback controller program in the firmware such that the motors take their “actual speed” (speed calculated from the encoders) into account when they’re being powered and that way they always maintain the same speed. But I seem to have found that this is already implemented.

I’m currently trying to determine how to always enable PID for the motors. Any suggestions/advice? Thanks for your help.


#2

Hi @cjirvene,

PID is not enabled on the GoPiGo yet and there is an option to use trim to reduce the speed of one of the motors. You can try adding trim to the motors following the tutorial here.

Please let us know if this helps,
-Shoban


#3

Adding trim to the motors doesn’t sufficiently fix my problem.


#4

Hi @cjirvene,

We had the PID in the firmware earlier but it is disabled now.

We have plans to get it working in the future, though no Estimated Time on that.

You can use the encoder readings that the GoPiGo returns to build a PID also on the Pi itself
and we’ll be happy to help you out.

-Shoban