Combining PID and Pure Pursuit

I recently implemented pure pursuit on my robot but without PID controller. I have a separate class to compute pid, but I don’t know how to combine these two. The PID controller should output the velocity of the robot, which then I can multiply by a coefficient to get the resultant speed. However, I don’t know what I should use as the PID’s input. if I use distance, a badly tuned pure pursuit could heavily affect it. if I use a heading, a small degree change will make the robot very slow.
PS the path of the robot will only be chains of quadratic bezier curves or straight lines

1 Like

Can you explain the reason for wanting to put a PID on a pure pursuit controller? The pure pursuit controller uses a circular arc to drive to the target point calculated by the intersection of the ld and the path. When you have a circular arc, you can use the track width of your robot to calculate how fast each side of the drivable needs to go. The only thing I can see a PID controller being used for (providing you are not doing something slightly different from the pure pursuit I know) is putting a PID to make the wheels are going the correct speed but this is mostly unnecessary.


when the robot is approaching its destination, it might overshoot if it doesn’t slow down. In addition, when the robot is making sharp turns, moving at a slower speed might help with accuracy. I am relatively new to this topic so please feel free to correct me.

Here are some ways you could do that:

  1. Use a PID to control the base speed of the robot. You would use the distance to the last waypoint as the input and the output would be the base speed.
  2. Use a PID to control the base speed of the robot but instead calculate the distance along the path. This could be done by approximating the length of the path or looking at how far the closest waypoint is along the path (assuming your path is relativity evenly spaced)

You could also try to make it so custom set speeds can be set for different parts on the path.

For your curves issues, you can calculate the curvature of the path by taking the determinant of the first and second derivative divided by the first derivative cubed. Here’s a video explanation: curvature of bezier curves.I have a non pure pursuit path follower and this is what I use to slow down during curves.

1 Like

Thank you for these ideas, ill try them out