docs(tutorials): add Navigate Through Poses tutorial and improve its BT behavior-tree explanation#880
Conversation
…BT behavior-tree explanation Signed-off-by: FelixZF-Happy <felix.zifan.fei@gmail.com>
8194d61 to
a91638f
Compare
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 |
There was a problem hiding this comment.
Move this above the issac perceptor, its a more 'core' intro thing
There was a problem hiding this comment.
I don't think this is in the index anymore?
There was a problem hiding this comment.
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.
| - 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>`_. |
There was a problem hiding this comment.
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. |
| - 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 |
There was a problem hiding this comment.
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 :-)
| 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 |
There was a problem hiding this comment.
Use the Nav2 bringup for TB3/4. You don't need to separate these.
|
|
||
| - 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>`_. | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Remove the CLI/C++ and only have the python version, lets keep this concise
| 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. | ||
|
|
| 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 | ||
|
|
| Source code quick walkthrough | ||
| ============================= |
There was a problem hiding this comment.
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)``. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
You could just pass in the timestamp to use instead :-)
|
@FelixZF-Happy any update? |
|
Hi Steve, |
…BT behavior-tree explanation
Basic Info
Description of contribution in a few bullet points
navigate_through_poses_w_replanning_and_recovery.xmlflow.CLI, C++, and Python.