# Is there a Java or mathematical algorithm for Pure Path Pursuit?

I was building a robot which I wanted to have smooth consistent motions and pathways. I am somewhat familiar with Pure Path Pursuit and wanted to know if someone could point me towards a mathematical or Java algorithm which I could implement or take a look at in order to better understand this concept. Any help is appreciated. Thanks!

• Can you be a little more specific about what it is that you're after? When I search Google for Pure Pursuit Java algorithm I get 835k hits, at least some of which seem to both describe the algorithm and provide Java code. – sempaiscuba Apr 1 '19 at 3:14

In words, rather than code. Assume you have the path defined as a dense list of points.

1. Find the point on the path closest to robot
2. Draw a circle of radius R about that point, then find the point on the path where the circle cuts (usually the circle will cut between two points). The circle may cut the path multiple times, take the closest (along the path) point.
3. Moving at constant velocity, steer toward that point using some kind of proportional controller
4. Repeat
• Isn't the circle supposed to be drawn having the centre in the robot rather than in the closest point in the path? – Guille Sanchez Oct 9 '19 at 14:15
• Not sure it makes much difference since the robot should be following the path. I don’t think there is a single definitive definition of pure pursuit. – Peter Corke Oct 10 '19 at 0:52

Here's an example implementation in Java for FRC:

https://github.com/Team488/SeriouslyCommonLib/blob/master/src/main/java/xbot/common/subsystems/drive/PurePursuitCommand.java

Let us know if we can answer any more questions about it or the general framework.

• Welcome to Robotics:SE. It's generally better if you include at least the key points from that link in case the link should change at some point. – sempaiscuba Oct 1 '19 at 2:38