$ show karlkurzer/path_planner
A ROS-based C++ implementation of the Hybrid A* path planning algorithm for nonholonomic autonomous vehicles, originally developed as part of a master's thesis at KTH. The system takes a binary occupancy grid (from LIDAR) and start/goal poses, then plans a smooth, drivable path using a combination of continuous-space A* with state discretization in heading, constrained (Dubins/Reeds-Shepp) and unconstrained (2D A*) heuristics, and a final gradient-descent smoother that accounts for obstacle clearance, curvature, and smoothness. It also optionally uses a Voronoi diagram to guide the path away from obstacles. The architecture is modular: a central Planner class manages ROS callbacks and orchestrates the search (Algorithm), collision detection (precomputed lookup tables for vehicle footprint), path tracing, and visualization via RViz. The code is well-documented and has been widely cited in autonomous driving research. While it is tightly coupled to ROS 1 (Noetic) and relies on OMPL for Reeds-Shepp heuristics, the core algorithmic components (lookup-based collision checking, Dubins path, gradient smoother) are self-contained and could be extracted for other projects.
The LLM identified 3 files worth highlighting for reuse:
Generates a lookup table that precomputes which grid cells are occupied by the vehicle for every combination of sub-cell position and heading. This enables O(1) collision checking at runtime by mapping a configuration to a list of occupied cells. The table is built once at startup by rotating a rectangle (vehicle shape) and using a grid traversal algorithm (similar to Bresenham) to fill the footprint. The technique is reusable for any rectangular vehicle with known dimensions and angular resolution.
Implements a gradient-descent path smoother that iteratively adjusts waypoints to minimize a weighted sum of obstacle, curvature, and smoothness costs. The curvature term enforces a maximum turning radius (nonholonomic constraint) by analytically computing derivatives of the curvature with respect to waypoint positions. The obstacle term uses the Voronoi distance field to push points away from obstacles. The smoothness term uses a finite-difference approximation of the second derivative. This component can be extracted as a standalone path smoother for any series of 2D waypoints.
A clean, self-contained implementation of Dubins curves (shortest path for a car-like robot with bounded turning radius). It provides functions to initialize, sample, and compute the length of a Dubins path between two configurations. The code is well-documented and uses only standard math libraries. This is a fundamental building block for motion planning and can be reused in any robotics or autonomous driving project needing optimal paths between poses.