Using Beluga with Nav2#
Overview#
Nav2 is a ROS 2 framework that includes several components for robot navigation. One of these components is the localization system, typically nav2_amcl
.
This tutorial will demonstrate how to use beluga_amcl
in place for nav2_amcl
.
To keep it simple, we have built this tutorial on top of the Nav2 Getting Started Guide. We will use the same simulated TurtleBot 3 robot and environment.
Requirements#
Important
This tutorial targets ROS 2 Humble.
Install ROS 2 Humble, Beluga, and Nav2.
Create the workspace#
Since we are using ROS 2, we need to create a workspace. Open a terminal and run the following command:
mkdir -p ~/beluga_demo_ws/src
beluga_demo_nav2 package#
Clone beluga_demo#
The beluga_demo is a public repository where you can find the beluga_demo_nav2
package, among others.
Clone the Ekumen-OS/beluga-demos
repository in your workspace:
cd ~/beluga_demo_ws/src
git clone https://github.com/Ekumen-OS/beluga-demos.git
For this tutorial, we will only use the beluga_demo_nav2
package in that repository. This package contains all the necessary files to launch the simulation.
Explanation#
Since beluga_amcl
is feature-wise compatible with nav2_amcl
(as thoroughly discussed in the beluga_amcl
ROS 2 reference page), we can just swap beluga_amcl
for nav2_amcl
:
That is what the beluga_demo_nav2
package does. Even the same parameter file can be used unchanged, though beluga_demo_nav2
does apply a few minimal changes to better configure beluga_amcl
, as explained in its reference page.
Run the example#
Build the workspace:
source /opt/ros/humble/setup.bash
cd ~/beluga_demo_ws
colcon build --symlink-install --packages-up-to beluga_demo_nav2
Launch the system:
source install/local_setup.bash
ros2 launch beluga_demo_nav2 bringup_launch.py
You should see rviz2
open with a map loaded and the robot initialized in an incorrect position. You should also see Gazebo open with both TurtleBot 3 world and robot spawned.
Attention
If the robot is not spawned in gazebo, check the GAZEBO_MODEL_PATH
environment variable set in the beluga_demo_nav2_launch.py
file.
You can use rviz2
tools to set the correct initial pose of the robot and to navigate the robot around the map.
Conclusion#
This tutorial integrates Beluga and Nav2 for a simulated TurtleBot 3 on ROS 2 Humble. You may also try using Beluga on other supported ROS 2 versions, with different types of robots.