Skip to main content
Version: 9

Navigate to a Goal with Replanning

The Navigate to Clicked Point with Replanning Objective demonstrates how MoveIt Pro can use Nav2's built-in replanning capability to dynamically update the robot's path when new obstacles appear in the local costmap.

Unlike Navigate to Clicked Point, which computes a single path and follows it without adaptation, this Objective continuously replans as the environment changes — making it better suited for dynamic environments.

Launch MoveIt Pro

We assume you have already installed MoveIt Pro to the default install location. Launch the application using:

moveit_pro run -c hangar_sim

1. Run the Objective

  1. In the Objectives panel, select the Navigate to Clicked Point with Replanning Objective.

  1. Click Run, then when prompted, click a point in the Visualization view to set the navigation goal.
  2. The robot begins navigating and replans its path automatically as new obstacles appear in the local costmap.

To stop navigation before the robot reaches the goal, click Stop Objective.

2. How It Works

Comparison with Navigate to Clicked Point

The original Navigate to Clicked Point Objective follows a plan-then-execute workflow:

  1. ComputePathToPoseAction computes a single global path to the goal.
  2. WaitForUserPathApproval displays the computed path and waits for user confirmation.
  3. FollowPathAction follows the approved path. If a new obstacle appears mid-execution, navigation fails.

The Navigate to Clicked Point with Replanning Objective replaces these three Behaviors with a single NavigateToPoseAction. This Behavior sends the goal directly to Nav2's /navigate_to_pose action server, delegating all planning, path following, and recovery to Nav2.

The Nav2 Replanning Behavior Tree

The NavigateToPoseAction passes Nav2's navigate_to_pose_w_replanning_and_recovery.xml Behavior Tree to the action server. See the Nav2 Behavior Tree documentation for full details.

ColorNode type
BlueControl nodes (Sequence, Fallback, RecoveryNode, etc.)
GreenAction nodes (ComputePathToPose, FollowPath, Spin, etc.)
YellowCondition nodes (IsGoalNearby, GlobalUpdatedGoal, etc.)

This tree provides:

  • Continuous replanning — the global path is recomputed roughly every second while the robot moves, incorporating the latest obstacle data from the local costmap.
  • Layered recovery — if planning fails, the global costmap is cleared; if path following fails, the local costmap is cleared. The tree retries up to 6 times before declaring failure.
  • Fallback Behaviors — after repeated failures, Nav2 attempts recovery Behaviors: spinning in place, waiting, and backing up.

The video below shows the Objective running with the local costmap updating in real time as the robot navigates and replans around obstacles.

note

The MoveIt Pro UI subscribes to the /plan topic and displays the replanned path in the Visualization view as Nav2 updates it. The Nav2 planner must publish to /plan for this visualization to work. Note that the NavFn planner used in hangar_sim does this by default. You can also view the live local and global costmaps by enabling their overlays in the View menu.