PurePursuit

open class PurePursuit : Runnable

A parametric displacement-based implementation of a Pure Pursuit controller designed for holonomic drivetrains.

This system uses a series of suppliers and consumers to define odometry and drive power setting via RoadRunner geometry utilities such as Pose2d along a Path. The actual lookahead, despite being usually rooted in a line-circle intersection, is performed by pose projection based on looking ahead on the path by displacement. By using displacement, the lookahead point naturally reduces for complex bends, and centers the process of calculating the lookahead as a simple vector projection.

A RoadRunner drive instance is not required to use this class, but since it provides odometry it is designed to support consuming a RoadRunnerDrive instance if wanted.

Author

Lucas Bubner, 2024

Since

5.1.0

Constructors

Link copied to clipboard
constructor(setDrivePower: Consumer<Pose2d>, poseEstimateSupplier: Supplier<Pose2d>)
Construct a new component to run Pure Pursuit pathing with using your own odometry implementation and drive powers.
constructor(drive: Moveable)
Construct a new component to run Pure Pursuit pathing with.

Types

Link copied to clipboard
open inner class PathMaker
Utility construction class for Path instances that can be executed by PurePursuit.

Properties

Link copied to clipboard
open val currentPath: Path
Link copied to clipboard
Inches of how close the robot should be to the end of the path to stop the Pure Pursuit controller and to simple move to PID To Point.
Link copied to clipboard
Inches of how far apart guesses are made along the path for projecting the current robot pose on the path.
Link copied to clipboard
Milliseconds of the interval the projections are updated.

Functions

Link copied to clipboard
open fun clearPath()
Clear and terminate the currently running path.
Link copied to clipboard
open fun followPath(@NonNull path: Path)
Set a path that will be followed during the execution of this Pure Pursuit controller.
Link copied to clipboard
open fun isBusy(): Boolean
Link copied to clipboard
Start constructing a new Pure Pursuit path that will start from the current drive pose which is captured when the path is built (may be delegated if not using a task build method).
open fun makePath(staticStartPose: Pose2d): PurePursuit.PathMaker
Start constructing a new Pure Pursuit path that starts from this static pose.
open fun makePath(startPose: Supplier<Pose2d>): PurePursuit.PathMaker
Start constructing a new Pure Pursuit path that will start from the pose supplied by this pose supplier when the path is built (may be delegated if not using a task build method).
Link copied to clipboard
open fun run()
Commands an iteration of the Pure Pursuit controller for the current path.
Link copied to clipboard
Set the PIDF controller for the robot heading of the Pure Pursuit controller.
Link copied to clipboard
Set the heading tolerance that this Pure Pursuit controller will use to determine when to stop following a path.
Link copied to clipboard
open fun withLookaheadRadius(lookaheadRadius: Measure<Distance>): PurePursuit
Set a new lookahead radius that will be used for current and future paths.
Link copied to clipboard
open fun withTolerances(vectorDistance: Measure<Distance>, headingDiff: Measure<Angle>): PurePursuit
Set the tolerances that this Pure Pursuit controller will use to determine when to stop following a path.
Link copied to clipboard
open fun withVectorTolerance(vectorDistance: Measure<Distance>): PurePursuit
Set the distance tolerance that this Pure Pursuit controller will use to determine when to stop following a path.
Link copied to clipboard
open fun withXPIDF(pidf: PIDF): PurePursuit
Set the PIDF controller for the robot X axis of the Pure Pursuit controller.
Link copied to clipboard
open fun withYPIDF(pidf: PIDF): PurePursuit
Set the PIDF controller for the robot Y axis of the Pure Pursuit controller.