|
Encoder+PID = How make robot going straight
Hi,
My team and I tried to make robot going straight by using pid en the rate of our encoder on our motor (1 each side). Unfortunately it finish by not working at all. Here is our code that we tried but the robot was just spinning without any control you just needed to make the robot enable and it was spinning alone. We took the rate of our encoder divide it by 3700 wich is a theoretical value that represent the maximum rate that our motor were able to go. This should now gave us a value between 0 and 1. We took this value and make it the process variable in our PID. We too also the variable fromm our joystick wich range between -1 and 1 and make it our setpoint in the PID. We took the output of the pid and set it to the motor. Brief it doesn't works maybe we are not doing it right. Our goal is just to make our robot going straight how to do it ? Do you have any advice on how make you robot going straght with encoder or how improve our code ?
Thanks in advance,
Alex Rousseau
Student programmer
VObotik team 5444
|