I am working on a robot that follows a path defined by a function. This path can be anything, a straight line, a spiral, a wave form. The function not only defines the path to follow, but also the speed of the robot. The function takes the generalized form of (x,y)= f(t), where t is the time. The robot should be as close to x and y as possible at any given moment.
Before I go on with my problem there are a few things you should know about my robot.
- It is a holonomic robot, so I do not have to deal with constraints in movement.
- I have a control system that accepts robot speed ( x, y, and theta (=rotational speed)) as input.
- the path functions can be non linear.
- the internals of the function are unknown to the robot.
- there is not a single function, but there are more. So I cannot optimize for a single function.
Back to path following. I am developing an algorithm that makes the robot follow the path defined by this function. At first I followed this approach. I took the robot position a time t and subtracted this from the position for t+1 as returned by the function. The outcome was devided by the time difference to get the speed needed for the robot to reach the desired position just in time. This approach works not very well. Due to various reasons the robot oscillates around the desired position, sometimes lagging behind, sometimes overshooting.
Well, the next logical step would be to use a PID controller to define the robot speed. I know this helps in situations were there is a constant setpoint. In this case the setpoint however is not constant, it is the result of a (non)linear function. I do not know if a PID controller is a good solution for this kind of problems.
Also, a PID controller takes only the current error into account. In this case I have more information, I know the position of the robot at t, I know the outcome of the function at t. But I also know the outcome of the function at t+1, t+2, etc. this means I could anticipate on this. The PID controller does not anticipate.
This is where I am right now. Should I implement a PID or start looking for something else? Are there any thoughts or suggestion from you?