zm0612/Hybrid_A_Star

Hybrid A Star algorithm C++ implementation

What it solves

Hybrid A* is a path-planning algorithm that proved successful in the DARPA Urban Challenge, but the original authors did not open-source their implementation. This project provides a clean, reproducible C++/ROS version that plans smooth, collision-free paths for non-holonomic vehicles (like cars) in parking lots and other driving scenarios without explicit traffic rules. It also adds a post-processing stage to remove ugly back-and-forth "shuffling" motions and further smooth the path using numerical optimization.

How it works

The planner runs as a ROS node. You set the start and goal in RViz (using the 2D Pose Estimate and 2D Nav Goal tools), and the system uses a grid map to search for a drivable path. The front-end search is a classic Hybrid A*: it discretizes the state space into grid cells, but also tracks continuous headings, and uses a heuristic to guide the expansion. The result is a raw path (shown in green in RViz).

Then a post-processing stage cleans that path:

  • It detects and removes tiny redundant forward/backward reversals (called "cusps") that are not real maneuvers, while keeping legitimate three-point turns.
  • It then runs a Ceres Solver optimization on the cleaned path. The optimizer minimizes a cost that balances smoothness (second differences), staying close to the original path, avoiding obstacles (using a signed distance field and a reciprocal barrier that diverges near collisions), respecting a curvature limit (for minimum turning radius), and reducing total length. The start, goal, and gear-shift points are kept fixed, and the smoothing is tapered near reversals to preserve natural turning geometry. The optimization is repeated in multiple passes with resampling to gradually remove low-frequency sway.

You can tune all weights, clearances, and thresholds via parameters in the launch file. A Docker image is also provided to run the whole system (ROS Noetic + RViz) without manual dependency installation.

Who it’s for

Developers and researchers working on autonomous parking, path planning for non-holonomic robots, or anyone who wants a working, open-source Hybrid A* baseline in ROS. It requires basic familiarity with ROS, C++ build tools (catkin), and an environment with a display for RViz.

Highlights

  • Faithful reproduction of the original Hybrid A* algorithm, validated against the paper’s performance.
  • Adds trajectory post-processing: removes useless reverse wiggles and then runs a Ceres-based back-end optimizer for a smoother, shorter, and collision-free path.
  • The optimizer uses a signed ESDF and a reciprocal barrier to guarantee obstacle clearance even with large smoothness weights.
  • The vehicle footprint is modeled as covering circles that track the live heading, so obstacle avoidance adapts to the path’s curvature.
  • All optimizer weights, limits, and reversal-removal thresholds are exposed as ROS parameters (planner/opt_*) for easy tuning.
  • RViz provides side-by-side comparison of the raw searched path (green) and the optimized path (red).
  • Docker support (with ROS Noetic and Ceres) lets you run the whole system with one script, including displaying RViz on the host X server.

Related

  • Project
  • Project
  • Project
  • Project