Pure Pursuit¶
Geometric path tracking with reactive collision avoidance.
Pure Pursuit is a fundamental path-tracking algorithm. It calculates the curvature required to move the robot from its current position to a specific “lookahead” point on the path, simulating how a human driver looks forward to steer a vehicle.
Kompass enhances the standard implementation (based on Purdue SIGBOTS) by adding an integrated Simple Search Collision Avoidance layer. This allows the robot to deviate locally from the path to avoid unexpected obstacles without needing a full replan.
How it Works¶
The controller executes a four-step cycle:
1. Find Target - Locate Lookahead.
Find the point on the path that is distance \(L\) away from the robot. \(L\) scales with speed (\(L = k \cdot v\)).2. Steering - Compute Curvature.
Calculate the arc required to reach that target point based on the robot’s kinematic constraints.3. Safety - Collision Check.
Project the robot’s motion forward using theprediction_horizonto check for immediate collisions.4. Avoidance - Local Search.
If the nominal arc is blocked, the controller searches throughmax_search_candidatesto find a safe velocity offset that clears the obstacle while maintaining progress.
Supported Sensory Inputs¶
To enable the collision avoidance layer, spatial data is required.
LaserScan
PointCloud
OccupancyGrid
(Note: The controller can run in “blind” tracking mode without these inputs, but collision avoidance will be disabled.)
Configuration Parameters¶
Name |
Type |
Default |
Description |
|---|---|---|---|
lookahead_gain_forward |
|
|
Factor to scale lookahead distance by current velocity (\(L = k \cdot v\)). |
prediction_horizon |
|
|
Number of future steps used to check for potential collisions along the path. |
path_search_step |
|
|
Offset step used to search for alternative velocity commands when the nominal path is blocked. |
max_search_candidates |
|
|
Maximum number of search iterations to find a collision-free command. |
Usage Example:¶
Pure Pursuit controller can be used in the Controller component by setting ‘algorithm’ property or component config parameter. The Controller will configure Pure Pursuit algorithm using the default values of all the previous configuration parameters. The specific algorithms parameters can be configured using a config file or the algorithm’s configuration class.
from kompass.components import Controller, ControllerConfig
from kompass.robot import (
AngularCtrlLimits,
LinearCtrlLimits,
RobotCtrlLimits,
RobotGeometry,
RobotType,
RobotConfig
)
from kompass.control import ControllersID, PurePursuitConfig
# Setup your robot configuration
my_robot = RobotConfig(
model_type=RobotType.OMNI,
geometry_type=RobotGeometry.Type.BOX,
geometry_params=np.array([0.3, 0.3, 0.3]),
ctrl_vx_limits=LinearCtrlLimits(max_vel=0.2, max_acc=1.5, max_decel=2.5),
ctrl_omega_limits=AngularCtrlLimits(
max_vel=0.4, max_acc=2.0, max_decel=2.0, max_steer=np.pi / 3)
)
# Initialize the controller
controller = Controller(component_name="my_controller")
# Set the all algorithms desired configuration
pure_pursuit_config = PurePursuitConfig(
lookahead_gain_forward=0.5, prediction_horizon=8, max_search_candidates=20
)
controller.algorithms_config = pure_pursuit_config
# NOTE: We can configure more than one algorithm to switch during runtime
# other_algorithm_config = ....
# controller.algorithms_config = [pure_pursuit_config, other_algorithm_config]
# Set the algorithm to Pure Pursuit
controller.algorithm = ControllersID.PURE_PURSUIT
Performance & Results¶
The following tests demonstrate the controller’s ability to track reference paths (thin dark blue) and avoid obstacles (red x).
1. Nominal Tracking¶
Performance on standard geometric paths (U-Turns and Circles) without interference.
2. Collision Avoidance¶
Scenarios where static obstacles are placed directly on the global path. The controller successfully identifies the blockage and deviates to finding a safe path around it.
Observations
Convergence: Smooth convergence to the reference path across all kinematic models.
Clearance: The simple search algorithm successfully clears obstacle boundaries before returning to the path.
Stability: No significant oscillation observed during avoidance maneuvers.