RRT* Implementation Template for ROS 2 Humble (C++/Python)
RRT* (Rapidly-exploring Random Tree Star) is an asymptotically optimal sampling-based motion planning algorithm that incrementally builds a tree of feasible robot configurations toward a goal while iteratively rewiring paths to improve path cost. This template provides production-ready, ROS 2 Humble–compatible implementations in both C++ and Python, integrating with ROS 2’s lifecycle nodes, TF2, navigation stack interfaces (e.g., nav2_msgs), and standard message types (e.g., geometry_msgs::msg::PoseStamped, sensor_msgs::msg::LaserScan). It abstracts low-level RRT* logic into modular, configurable components compliant with ROS 2 best practices—including parameterization via YAML, real-time collision checking using costmaps or custom geometric validators, and publish/subscribe patterns for visualization (e.g., rviz2 via nav_msgs::msg::Path).
📖 Overview
📑 Key Components
🎯 Applications
- ✓ Autonomous mobile robot navigation in dynamic indoor environments
- ✓ Multi-robot coordinated path planning with decentralized RRT* variants
- ✓ Simulation-to-real transfer for warehouse AMRs using hardware-in-the-loop validation
📐 Key Formulas
Rewiring Radius r(n)
r(n) = \gamma \left( \frac{\log n}{n} \right)^{1/d}
Dynamic radius defining the neighborhood for rewiring; n is number of vertices, d is configuration space dimension, γ is problem-dependent constant ensuring asymptotic optimality
Cost-to-come g(x)
g(x) = g(x_{\text{parent}}) + c(x_{\text{parent}}, x)
Cumulative path cost from root to vertex x, where c(·,·) is edge cost metric (e.g., Euclidean distance or Dubins arc length)
Optimality Condition
g^*(x) = \inf \{ g(x') + c(x', x) \mid x' \in \mathcal{B}_r(x) \cap \mathcal{V} \}
Optimal cost-to-come for vertex x computed over all valid neighbors x' within ball B_r(x) of radius r centered at x
🔗 Related Concepts
📚 References
📐 Prerequisites
Understand these before this topic
➡️ Next Step
Continue your engineering workflow
🔗 Engineering Applications
See how this applies across industries