Hi all,
If PID can be used to make a robot go straight, then it should also be able to make the robot curve in a given radius too, am I right?
I am working on a robot modified from an electric wheelchair. The uC controls two servos that are linked to the original wheelchair joystick controller. So one servo will be for the drive and the other for the steering. Sort of Ackermann steering. Both left and right wheels are fitted with encoders.
I have implemented PID to move the robot in a straight line. Now I want the robot to move in a curve with a constant radius. So I did this;
error = leftWheel - (ratio*rightWheel)
where 'ratio' is the ratio of the distance I want the left wheel to travel over the distance the right wheel should travel. This is found from some calculations once I know what the radius should be. So to turn left, ratio<1. To turn right, ratio>1. To go straight, ratio=1.
Now this worked, to a certain extent. When I tell it to curve, it does curve, but the radius is not constant. Sometimes its getting smaller and smaller as the robot moves, and sometimes it gets bigger.
I tried to play around with the PID constants, and that seemed to do the trick. I suspect its the KI term that controls all this, but I'm not sure. I'm still trying to find out.
Can someone explain a bit more on the roles of each of the constants KP, KI, KD? I have done control theory and can imagine the step input curves with the rise time, oscillations, steady-state etc, but I can't relate to how the robot would move.
Any help is appreciated