Nav2 Knowledge Patch
Use this skill when configuring, migrating, extending, or troubleshooting Nav2. Start with the breaking interface and parameter changes below, then open the topic reference that matches the subsystem being changed. Treat the running distribution's packages, interfaces, and tests as authoritative when a mixed or backported installation differs from these defaults.
Reference index
| Reference | Topics | | --- | --- | | Migration and integration | Distribution status, messages, namespaces, ROS wrappers, simulation, RViz, lifecycle, and test builds | | Behavior Trees | Error propagation, node and port renames, selectors, subtrees, cancellation, validation, and replanning | | Planning and control | Planner/controller selection, server behavior, MPPI, RPP, SMAC, Rotation Shim, goal checking, and smoothing | | Costmaps, localization, and mapping | Costmap APIs, layers, transports, clearing, inflation, AMCL, footprints, and vector objects | | Routing, docking, and behaviors | Route Server, docking, Following Server, Behavior Server, loopback simulation, and motion behaviors | | Collision Monitor | Command pipeline, fail-safe timing, zones, sources, runtime controls, debounce, and costmap input |
Migration triage
Check these first when moving launch files, parameter files, plugins, or trees:
cmd_velusesgeometry_msgs/TwistStampedby default. Setenable_stamped_cmd_vel: falseon every affected node only for a deliberately retainedTwistpipeline.- Replace BT Navigator's removed
error_code_nameswitherror_code_name_prefixes, and wire botherror_code_idanderror_msgon relevant action nodes. - Multi-pose actions now carry
nav_msgs/Goals; useposes.goalsorgoals.goals. Preserve the parallelWaypointStatuslist through pruning nodes. - Remove
use_namespacefromnav2_bringup.namespaceis always applied, defaults to/, and relative topics resolve inside it. - Move
Costmap2DROS.map_topicto theStaticLayer; use the consolidatedCostmap2DROS(name, parent_namespace, use_sim_time)constructor. - Treat
control_frequencyas startup-only configuration. - In Rotation Shim, nest the primary controller's
pluginand parameters beneathprimary_controller. - In MPPI, configure a named motion-model plugin group rather than legacy
DiffDrive,Omni, orAckermannstring values. - Replace
ValidatePath.check_full_pathwith the oppositely wordedstop_at_first_collision; oldfalsemaps to newtrue. - Move controller-specific plan transformation and pruning parameters to Controller Server's path-handler plugin.
- Retune Constrained Smoother weights because its corrected objective is
weight * residual². - Move navigator blackboard-ID parameters beneath each navigator plugin, and
rename
TruncatePathLocal.robot_frametorobot_base_frame.
See Migration and integration and Behavior Trees for the complete migration set.
Action error propagation
Configure contextual action errors with prefixes:
error_code_name_prefixes: [compute_path, follow_path, spin, route]
Expose matching tree ports:
<FollowPath path="{path}" error_code_id="{follow_path_error_code}"
error_msg="{follow_path_error_msg}"/>
The removed error_code_names parameter causes a startup exception rather
than silently falling back.
Namespaces and message interfaces
- Prefer relative topics such as
scanfor namespaced robots. Keep/scanonly when the source is intentionally global. - Costmap layers that must resolve relative to their parent costmap can use
joinWithParentNamespace()instead of their private layer namespace. - With stamped velocity enabled, preserve timestamps through smoothing and safety nodes so stale commands can be rejected.
- For dynamic footprints, enable
subscribe_to_stamped_footprintonly when publishingPolygonStamped; the subscription type changes fromPolygon.
Planning and control quick reference
- Use NavFn, Smac 2D, or Theta Star primarily for circular differential or omnidirectional robots. Use Smac Hybrid-A* for footprint-aware, curvature-constrained platforms and Smac Lattice for explicit kinematic control sets.
- DWB normally serves differential and omnidirectional bases. RPP and Vector Pursuit do not support omnidirectional motion; MPPI and TEB span differential, omnidirectional, Ackermann, and legged platforms.
- Controller Server's costmap freshness timeout defaults to
0.3seconds; Planner Server's defaults to1.0second. - Controller exception tolerance defaults to disabled (
failure_tolerance: 0.0);-1.0tolerates failures indefinitely. use_realtime_priority: truerequests thread priority90and requires an adequate process-userrtpriolimit.PositionGoalCheckerignores orientation. Axis, symmetric-yaw, and adaptive goal checkers cover more specialized completion semantics.- Partial multi-pose planning is opt-in with
allow_partial_planning; inspectlast_reached_indexbefore accepting a returned prefix. - Keep Velocity Smoother limits at least as permissive as Dynamic Window Pure Pursuit's controller limits.
Open Planning and control before changing planner, controller, goal-checker, smoother, or path-handler plugins.
Behavior Tree quick reference
NonblockingSequenceticks later children while an earlier child is stillRUNNING.PauseResumeControllercombines pause/resume services withPersistentSequence, whose bidirectional child-index port resumes progress.RoundRobinnow defaults towrap_around="false"and fails after the last child unless wrapping is explicitly enabled.- The default navigation tree can select progress checker, goal checker, path handler, controller, and planner IDs through selector topics.
- The default near-goal fallback retains a valid remaining plan when the goal is unchanged and nearby; it replans when any guard fails.
- Reusable subtree files come from
bt_search_directories; select trees by a unique ID rather than a sharedMainTree.
Open Behavior Trees when modifying XML or BT Navigator parameters; it includes all action/condition renames and port changes.
Costmap and localization quick reference
- Keep costmap filters in
filters, separate from ordinaryplugins; filters run after the layered costmap has been combined. - A selective clear request is atomic: an invalid or non-clearable named plugin makes the request fail without clearing anything.
transport_typemay select compressed point-cloud transports;rawremains the default.custom_inscribed_radius: 0.0bypasses the inscribed region and is unsafe for ordinary planners or controllers that expect standard cost semantics.- AMCL
random_seed: -1remains nondeterministic; a nonnegative seed makes particle-filter runs repeatable. always_reset_initial_pose: truerequires a new initial pose after reset;first_map_only: trueignores replacement maps.
Open Costmaps, localization, and mapping for conversion values, startup transform timing, visualization, mapping, and layer details.
Routing, docking, and behavior quick reference
- Route Server plans over a predefined graph, emits node/edge events, and can smooth corners with tangent arcs when geometry permits.
- Docking collision checking is enabled by default. Configure direction per
plugin with
dock_direction; usereverse_to_dockonly for the staged forward-detection/backward-entry workflow. - Custom charging and non-charging dock plugins must implement detection start and stop hooks.
- Behavior Server loads Spin, BackUp, DriveOnHeading, and Wait by default; AssistedTeleop must be added explicitly.
disable_collision_checksdefaults tofalsefor Spin, BackUp, and DriveOnHeading. Do not disable it casually.- The loopback simulator is for ideal odometry tests, not physics or localization error modeling.
Open Routing, docking, and behaviors for server parameters, action-owned inputs, route operations, and following.
Collision Monitor safety checklist
- Put Collision Monitor after smoothing in the command pipeline and publish its safety-adjusted output on the robot command topic.
- Keep
source_timeoutenabled unless another fail-safe owns stale-source handling. A stale observation source stops the robot. base_shift_correctionshould remain enabled for fast robots or modest sensor rates.- Overlapping zones resolve to the most restrictive action. For velocity polygons, order overlaps deliberately and finish with a catch-all range.
- Migrating Humble thresholds requires
min_points = max_points + 1. - Costmap source cost
255followstreat_unknown_as_obstacle, separately fromcost_threshold. - Runtime
Toggledisables polygons but leaves sensor checking active.
Open Collision Monitor before changing zone geometry, temporal debounce, observation filters, source types, or fail-safe timers.
Verification workflow
After a migration or configuration change:
- Confirm each renamed or moved parameter is absent from its old scope.
- Inspect actual action, service, topic, and BT port types instead of assuming an older interface.
- Verify relative topic resolution under the intended robot namespace.
- Exercise failure paths: stale sensors, controller exceptions, partial plans, invalid clear-plugin names, and BT cancellation.
- Check visualization and introspection only after functional behavior; both are optional and may be disabled by default.
- Run isolated middleware tests with
--cmake-args -DUSE_ISOLATED_TESTS=ONwhen a separate Zenoh router is not part of the test environment.