Skip to content

docs(tutorials): add Navigate Through Poses tutorial and improve its BT behavior-tree explanation#880

Open
FelixZF-Happy wants to merge 5 commits intoros-navigation:masterfrom
FelixZF-Happy:nav_through_poses_tutorials
Open

docs(tutorials): add Navigate Through Poses tutorial and improve its BT behavior-tree explanation#880
FelixZF-Happy wants to merge 5 commits intoros-navigation:masterfrom
FelixZF-Happy:nav_through_poses_tutorials

Conversation

@FelixZF-Happy
Copy link
Copy Markdown

…BT behavior-tree explanation


Basic Info

Info Please fill out this column
Ticket(s) this addresses (#172 )
Does this PR contain AI-generated software? (Yes, all python and C++ codes)

Description of contribution in a few bullet points

  • The BT behavior-tree explanation was refreshed to match the current
    navigate_through_poses_w_replanning_and_recovery.xml flow.
  • This tutorial now includes TB4 minimal simulation examples in three forms:
    CLI, C++, and Python.

@FelixZF-Happy FelixZF-Happy force-pushed the nav_through_poses_tutorials branch from 8194d61 to a91638f Compare February 23, 2026 01:59
@FelixZF-Happy FelixZF-Happy marked this pull request as ready for review February 23, 2026 02:05
@FelixZF-Happy FelixZF-Happy changed the title docs(tutorials): add Navigate Through Poses tutorial and improve its … docs(tutorials): add Navigate Through Poses tutorial and improve its BT behavior-tree explanation Feb 23, 2026
Comment thread behavior_trees/trees/nav_through_poses_recovery.rst
Comment thread tutorials/docs/navigate_through_poses.rst Outdated
Comment thread tutorials/index.rst Outdated
docs/navigation2_with_gps.rst
docs/using_isaac_perceptor.rst
docs/navigation2_with_semantic_segmentation.rst
docs/navigate_through_poses.rst
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this above the issac perceptor, its a more 'core' intro thing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is in the index anymore?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title has been updated to "Navigating with Pose Constraints (Navigate Through Poses)" as you suggested earlier. I’ve also moved it above Isaac Perceptor. After clearing the webpage cache, it now appears in the correct order. I’ll review a few other tutorials to align with the style.

Comment thread tutorials/docs/navigate_through_poses.rst
Comment thread tutorials/docs/navigate_through_poses.rst Outdated
- Ubuntu 24.04, ROS 2 Jazzy, Kilted or later, and Nav2 is installed.
- The ``nav2_minimal_turtlebot_simulation`` `repository <https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation>`_
is included in the ROS 2 system install, no need to build or source it separately.
- Understand the ``navigate_through_poses_w_replanning_and_recovery.xml`` `behavior tree <https://docs.nav2.org/behavior_trees/trees/nav_through_poses_recovery.html>`_.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to go over that? 🙃

- The ``nav2_minimal_turtlebot_simulation`` `repository <https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation>`_
is included in the ROS 2 system install, no need to build or source it separately.
- Understand the ``navigate_through_poses_w_replanning_and_recovery.xml`` `behavior tree <https://docs.nav2.org/behavior_trees/trees/nav_through_poses_recovery.html>`_.
- Familiar with ROS 2 actions and `NavigateThroughPoses.action <https://github.com/ros-navigation/navigation2/blob/main/nav2_msgs/action/NavigateThroughPoses.action>`_ definition.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

- Understand the ``navigate_through_poses_w_replanning_and_recovery.xml`` `behavior tree <https://docs.nav2.org/behavior_trees/trees/nav_through_poses_recovery.html>`_.
- Familiar with ROS 2 actions and `NavigateThroughPoses.action <https://github.com/ros-navigation/navigation2/blob/main/nav2_msgs/action/NavigateThroughPoses.action>`_ definition.

Start TB4 simulation
Copy link
Copy Markdown
Member

@SteveMacenski SteveMacenski Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before jumping in, you should talk about what even is navigating through poses, why you might want to do it, a little on the action definition, and the example behavior tree using it. Motivate the subject :-)

Comment on lines +28 to +39
ros2 launch nav2_minimal_tb4_sim simulation.launch.py

This uses ``nav2_minimal_tb4_sim/launch/simulation.launch.py`` and spawns TB4 in Gazebo.

Start Nav2 stack
================

Terminal 2:

.. code-block:: bash

ros2 launch nav2_bringup bringup_launch.py use_sim_time:=True slam:=True autostart:=True
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the Nav2 bringup for TB3/4. You don't need to separate these.

Comment on lines +42 to +58

- This repository provides simulation + robot model + BT navigator source.
- Full navigation servers (planner, controller, recoveries, lifecycle) come from Nav2.
- ``slam:=True`` is used so ``slam_launch.py`` starts and provides map creation + localization in a
fresh simulation. With ``slam:=False``, Nav2 runs ``localization_launch.py`` and expects
``map:=...`` to be provided.

If you already have a map, prefer:

.. code-block:: bash

ros2 launch nav2_bringup bringup_launch.py use_sim_time:=True slam:=False map:=/path/to/map.yaml autostart:=True

- ``autostart:=True`` brings Nav2 lifecycle nodes up automatically so the
``navigate_through_poses`` action server is available. See also
`example_nav_through_poses.py <https://github.com/ros-navigation/navigation2/blob/main/nav2_simple_commander/nav2_simple_commander/example_nav_through_poses.py>`_.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is after the navigation + slam tutorials, so you don't need to explain this again, I don't think. Stay focused on the details of this tutorial and these concepts

Copy link
Copy Markdown
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A video at the end showing this at work would be nice (using Smac Planner so its continuous).

A good first go, but I'd recommend reading the other tutorials at the start / getting started and try to mirror those styling more. I really appreciate your time and effort though!

Send a goal
===========

Method 1: Using terminal command line
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the CLI/C++ and only have the python version, lets keep this concise

Comment on lines +279 to +291
Version note (as of February 22, 2026):

- Upstream ``navigation2`` branch heads differ in
``nav2_simple_commander/nav2_simple_commander/robot_navigator.py``:
``jazzy`` and ``kilted`` still show
``self.info(f'Navigating with {len(goal_msg.poses)} goals....')``,
while Rolling development (``main``) shows
``self.info(f'Navigating with {len(poses.goals)} goals....')``.
- If your installed package still has ``len(goal_msg.poses)``, you can
temporarily comment out that log line or change it to ``len(poses.goals)``.
- Some binary installs or local edits may already include this fix. Verify your
local ``robot_navigator.py`` before editing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment on lines +373 to +381
Run:

.. code-block:: bash

chmod +x ~/tb4_sim_ws/go_through_poses.py
source /opt/ros/kilted/setup.bash
source ~/tb4_sim_ws/install/setup.bash
python3 ~/tb4_sim_ws/go_through_poses.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment on lines +382 to +383
Source code quick walkthrough
=============================
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont' think this needs to be another section

Verify your installed file first, for example:
``rg -n "Navigating with .*goals" /opt/ros/$ROS_DISTRO/lib/python*/site-packages/nav2_simple_commander/robot_navigator.py``.
If your installed file still has ``len(goal_msg.poses)``, temporarily comment
out that log line or change it to ``len(poses.goals)``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove -- lets keep this concise

from nav2_simple_commander.robot_navigator import BasicNavigator, TaskResult


def make_pose(navigator: BasicNavigator, x: float, y: float, w: float = 1.0) -> PoseStamped:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just pass in the timestamp to use instead :-)

@SteveMacenski
Copy link
Copy Markdown
Member

@FelixZF-Happy any update?

@FelixZF-Happy
Copy link
Copy Markdown
Author

Hi Steve,
I’ll push a commit tonight incorporating all of your recommended deletions. I’ll revisit the remaining things based on your two suggestions after April 14th, and will complete them the following week. I am not busy then from the mid April. Just a few days to sort out some things urgent. But if someone want to continue to finish it this week. I am perfectly ok with that.

@SteveMacenski
Copy link
Copy Markdown
Member

Let me know when you're ready! ❤️

@FelixZF-Happy
Copy link
Copy Markdown
Author

I’ll set the deadline for this second modification to Sunday for sure. I’ll try to have it ready by Saturday.

…BT behavior-tree explanation

Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
…ndex.

Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
… with waypoint Follower.

Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
…ac Planner, Demo Video. Sample script is fixed.

Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
@FelixZF-Happy FelixZF-Happy force-pushed the nav_through_poses_tutorials branch from ce4bf0c to b209f52 Compare April 20, 2026 06:41
@FelixZF-Happy
Copy link
Copy Markdown
Author

FelixZF-Happy commented Apr 20, 2026

Hi Steve,

I added a new tutorial update for NavigateThroughPoses.

A few notes on what changed:

  • Added a brief overview of what “navigate through poses” means and when to use it.

  • Added a comparison with Waypoint Follower / GPS waypoint following. The main distinction is that Waypoint Follower treats each waypoint as a destination where the robot may stop or run waypoint tasks, while NavigateThroughPoses treats the poses as constraints along one continuous navigation task.

  • Added a very short explanation of the NavigateThroughPoses action definition, including its goal, result, and feedback messages, with links to the API docs.

  • Added a behavior tree overview and linked to the full NavigateThroughPoses recovery BT documentation.

  • Added a Smac Planner section showing how to copy the default nav2_params.yaml, and remap the default GridBased planner from NavFn to nav2_smac_planner::SmacPlanner2D.

  • Cleaned up the TB4 simulation launch instructions to use tb4_simulation_launch.py with a static map and AMCL instead of SLAM, including notes about setting the initial pose in RViz and enabling the Gazebo GUI with headless:=False.

  • In Python example, feedback logging for estimated time remaining is included.

  • Added a demo video section. I noticed most tutorial videos are linked through YouTube, so I attach this recorded demo video below, if you prefer to host it that way.

One thing I noticed while recording: if I set a goal very close to the robot’s initial pose, NavigateThroughPoses can appear to stop prematurely. I avoided that in the demo script by choosing goal poses farther from the initial robot pose. I believe a related premature-stop issue may have been fixed earlier this year, around January, but I did not dig into that history deeply for this tutorial. I can talk about it if needed. I know so far Jazzy/Kilted haven't been fixed yet.

Thank you very much!
Best,
Felix

@FelixZF-Happy
Copy link
Copy Markdown
Author

NavigateThroughPoses.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants