Planners in Nav2: NavFn, SmacPlanner and ThetaStar
Atlasbot · 17/8/2026 · 11 min read
The article Path Planning is what? explains Dijkstra and A* at the algorithm level. planner_server is the ROS2 node realizing those algorithms — architecture plugin, which allows switching path-finding algorithms without switching any other nodes in the system.
Key concepts
planner_server does not contain the — algorithm itself it loads a specific plugin at runtime:
planner_server:
ros__parameters:
planner_plugins: ["GridBased"]
GridBased:
plugin: "nav2_navfn_planner::NavfnPlanner"
Four common plugins: NavFn (classical A*), SmacPlanner2D (optimal A*), SmacPlannerHybrid (respecting kinematics constraint), and ThetaStar (smoothness of the line).
How it works
The correct plugin architecture as seen in Composition (although this is plugin-loading over pluginlib, a different composition mechanism but the same philosophy: separating the interface from the specific implementation).
NavFn implementing pure A*/Dijkstra on a costmap (article Costmap)— is fast, reliable, and verified over many years of use in ROS1/ROS2. Disadvantage: the generating path may have unnatural kink angle (characteristic of search on grid squares), needs smoother_server postprocessing before being delivered to the controller following.
SmacPlanner has 2 variants: SmacPlanner2D—A* on lattice, similar to NavFn but more optimal; SmacPlannerHybrid— searches in the state space (x, y, θ), respecting the minimum rotational radius of the robot. The important Hybrid variant with robot with tight kinematics constraints (such as Ackermann's article Choose drive system ) — cannot rotate in situ, the resulting path must be physically feasible from the planning step, not only nice on graph theory.
ThetaStar is the A* variant that allows the junction between cells not necessarily to follow 8 fixed directions (angstromed/vertical/diagonal as the net A*) — resulting in a straighter path, fewer points of kink, closer to the true geometrically optimal path than NavFn/SmacPlanner2D, in return for slightly higher computational costs.
Finally: NavFn and SmacPlanner2D are suitable for in situ rotatable robots (differential, mecanum, omni—multiple indoor AMR); SmacPlannerHybrid is required when Ackermann-type constrained robots fail to rotate in situ. Wrong plugin selection (e. g. NavFn for Ackermann robot) produces path the physical robot cannot follow.
Technical details
Formulas
The state space each search plugin differs in dimensionality, which directly affects computational cost:
NavFn/SmacPlanner2D: search over (x, y) — 2 dimensions
State count ≈ Grid_cell_count
SmacPlannerHybrid: search over (x, y, θ) — 3 dimensions
State count ≈ Grid_cell_count × Discrete_heading_count
Example: grid of 800x600 cells, heading discretized into 16 directions
NavFn: ~480,000 states
SmacPlannerHybrid: ~480,000 × 16 ≈ 7,680,000 states
Parameters
| Plugin | Kinematics constraint | Road Quality | Calculation costs |
|---|---|---|---|
| NavfnPlanner | No | Folds, needs smoothness | Low |
| SmacPlanner2D | No | Better than NavFn | Medium |
| SmacPlannerHybrid | Yes (rotating radius) | Ackermann's physics | High |
| ThetaStar | No | Smooth, less folded | Medium-high |
Practical applications
With most AMR in stock (differential drive or Mecanum, learned in the AMR Drive System column), NavFn or SmacPlanner2D are reasonable default — robots that can rotate in situ so that no higher computational cost of SmacPlannerHybrid is paid. SmacPlannerHybrid is only really needed when robots using the Ackermann configuration (more common in outdoor rovers, less common in warehouse AMR) — correctly choose the plugin under the robot's real-world kinematics constraint avoiding unnecessary computational resource wasting.
Practical example
# Change plugin planner without editing any other nodes
ros2 param set /planner_server GridBased.plugin nav2_smac_planner::SmacPlanner2D
# Comparison of computing time between plugins
ros2 action send_goal /compute_path_to_pose nav2_msgs/action/ComputePathToPose \
"{goal: {pose: {position: {x: 5.0, y: 3.0}}}}" --feedback
Typical results on the same 40x30m map at 0.05m resolution:
NavFn: ~50-100ms, path with a few slight bends
SmacPlanner2D: ~80-150ms, smoother path than NavFn
ThetaStar: ~100-200ms, smoothest path among the 3 planners without kinematic constraints
SmacPlannerHybrid: ~300-600ms (considerably slower due to the larger state space),
but provides a feasible path for robots that cannot rotate in place
Common mistakes
- Using SmacPlannerHybrid for in situ spinable— robots as calculated in the Formula section, pays several times the computational cost without obtaining a commensurate benefit, as the robot does not need a spin radius constraint.
- Using NavFn for the Ackermann— robot as stated in the Abstract gives rise to physical robot paths that cannot be followed (requires in situ rotation that the robot cannot).
- No postprocessing of paths from NavFn/SmacPlanner2D by smooth— to the same fold angle from search on the grid causes the controller to stick to the unnatural path, affecting real-world motion quality.
- Changing plugins without re-checking
max_vel_theta/related binding — each has different assumptions on robot capabilities, it is necessary to re-checking the entire related parameter after changing, not just changing each lineplugin:.
Conclusion
The plugin architecture of planner_server allows to change the path-finding algorithm without changing any other node — choosing the correct plugin under the robot's real-world kinematics constraint (can in situ rotate or not) is a more important decision than choosing the "strongest algorithm" in a generic way. The next item in the section goes to the controller — step which follows the path the planner has just calculated.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.