# Velocity and End-behavior for a Pure Pursuit Controller

We have a pure pursuit controller running on a smooth path. Our drive train is capable of taking a command like (curvature, velocity) and driving along that arc. It follows paths nicely enough.

Currently, I have the controller set up to emit velocity = min(V_CRUISE, K * distanceToFinalPoint).

The obvious answer to controlling velocity is to introduce a motion profile, but
most motion profile tracking is based off timed kinematic equations. Irregularities in tracking behavior seems like it might render this ineffective, as encoder distances wonâ€™t match the forecasted values the way we would want.

Another issue is minimizing cross track error as the robot approaches the final point. The robot also needs to decide when to stop completely. Currently, it just checks if its close enough to the last path point, but this results the robot sometimes doing an extra 180 at the end of the path. (That can probably be resolved by tuning look-ahead distance, though)

Is there a better way to handle these issues?

Good questions!

Pure pursuit is basically just a steering controller for path tracking. It isnâ€™t really well equipped to deal with speed regulation, nor for achieving a precise final posture.

A common way to deal with speed is to compute a motion profile for the path you are tracking, and then use the speed of the closest point as your setpoint. Or you can compute the speed at the goal point, and compute a new motion profile on the fly to go from your current speed to the goal speed over the arc you generate (this is what 254 did in 2017). But the method you describe is a decent (and possibly good enough) approximation of these.

For achieving the final pose, the issue you seem to be running into is that pure pursuit â€śruns out of trackâ€ť, and so the effective lookahead shrinks very low near the goal. This can result in very dramatic unintended turns. Instead, you can linearly extrapolate a new goal point out past the end of the path in the same direction. Once you pass the â€śfinish lineâ€ť (meaning the closest point on the path is close enough to the goal), you are done. Again, this is what 254 did in 2017.

You could also consider switching from pure pursuit to some other sort of point-stable controller once you are near the goal point, but thatâ€™s a fair bit more complicated.

1 Like