2. Multiple Robot ROS2 Navigation¶
2.1. Learning Objectives¶
In this ROS2 sample, we are demonstrating Omniverse Isaac Sim integrated with the ROS2 Nav2 stack to perform simultaneous multiple robot navigation.
2.2. Getting Started¶
Prerequisite
Completed ROS2 Navigation for ROS2 Nav2 with a single robot. So that
ROS2 Foxy and Nav2 are installed.
ros2_workspace
is sourced so thatcarter_navigation
andcarter_description
are inside your ROS_PACKAGE_PATH.
2.3. Multiple Robot ROS2 Navigation Setup¶
For details on the ROS2 Navigation setup refer to the ROS2 Navigation Sample. For operating multiple robots in the same environment, namespaces are utilized. This modifies the rostopic and rosnode names for different ROS2 packages, allowing for multiple instances of the same ROS2 node to run simultaneously.
To publish and receive ROS2 messages under namespaces in Omniverse Isaac Sim, the rosNodePrefix parameter found under each ROS component prim has been set to the corresponding robot names.
The multiple_robot_carter_navigation_hospital.launch.py
and multiple_robot_carter_navigation_office.launch.py
launch files found in the sample carter_navigation
ROS2 package are also configured with the same robot namespaces.
2.3.1. Hospital Environment Setup:¶
We generate the map of both the Hospital and Office environments using the Occupancy Map Generator extension within Omniverse Isaac Sim.
Go to Create -> Isaac -> Environments -> Hospital.
2. At the upper left corner of the viewport, click on Perspective. Select Top from the dropdown menu. Adjust the camera view as needed.
Next, go to Isaac Utils -> Occupancy Map.
In the Occupancy Map extension, ensure the Origin is set to
X: 0.0, Y: 0.0, Z: 0.0
. For the lower bound, setZ: 10.0
. For the Upper Bound, setZ: 62.0
. Keep in mind, the upper bound Z distance has been set to 62.0 cm to match the vertical distance of the lidar onboard Carter with respect to the ground.
5. Select the Hospital prim in the stage. In the Occupancy Map extension, click on BOUND SELECTION
.
The bounds of the occupancy map should be updated to incorporate the selected Hospital prim.
The map parameters should now look similar to the following image:
A perimeter will be generated and it should resemble this image (Top View):
2.3.2. Office Environment Setup:¶
Go to Create -> Isaac -> Environments -> Office.
2. At the upper left corner of the viewport, click on Perspective. Select Top from the dropdown menu. Adjust the camera view as needed.
Next, go to Isaac Utils -> Occupancy Map. In the Occupancy Map extension, set the map parameters to be similar to the following image:
Keep in mind, the upper bound Z distance has been set to 62.0 cm to match the vertical distance of the lidar onboard Carter with respect to the ground.
A perimeter will be generated and it should resemble this image (Top View):
Once the setup for either environments is complete, click on
CALCULATE
followed byVISUALIZE IMAGE
. A Visualization popup will appear.For rotation, select 180 degrees and for Coordinate Type select
ROS Occupancy Map Parameters File (YAML)
. ClickRE-GENERATE IMAGE
. Occupancy map parameters formatted to YAML will appear in the field below. Change the image name to your preference. Copy the full text.
6. Create a YAML file for the occupancy map parameters called carter_hospital_navigation.yaml
and place it in the maps directory which
is located in the sample carter_navigation
ROS2 package(carter_navigation/maps/carter_hospital_navigation.yaml
).
Insert the previously copied text in the
carter_hospital_navigation.yaml
file.
Note
For the office environment, follow the previous steps however create a YAML file called carter_office_navigation.yaml
instead.
Back in the visualization tab in Omniverse Isaac Sim, click
Save Image
. Set the same image name as in the map parameters and choose to save in the same directory as the map parameters file.
The final saved image of the Hospital environment will look like the following:
The final saved image of the Office environment will look like the following:
If not done so already, click
Stop
to terminate the simulation.
An occupancy map is now ready to be used with Multiple Robot ROS2 Navigation!
2.4. Running Multiple Robot ROS2 Navigation¶
Load scenario:
For hospital environment, go to Isaac Examples -> ROS -> Multi Robot Navigation -> Hospital.
For the Office scenario, go to Isaac Examples -> ROS -> Multi Robot Navigation -> Office.
Click on
Play
to begin simulation.In a new terminal, run the specific ROS2 launch file to begin Multiple Robot Navigation with the desired environment.
ros2 launch carter_navigation multiple_robot_carter_navigation_hospital.launch.py
OR
ros2 launch carter_navigation multiple_robot_carter_navigation_office.launch.py
Three Rviz2 windows will be launched. This process may take a few moments to startup.
Pick any Rviz2 window and click on Map located in the Displays panel to see the Topic name and take note of the robot namespace corresponding to the Rviz2 window.
Click on
Startup
to initialize the Nav2 stack. The global occupancy map should appear.Next click on the
2D Pose Estimate
button near the top of the RViz2 window and set the initial estimated pose by clicking and dragging at a point on the map where you think the robot is located. The global costmap map, as well as the local costmap of the specific robot will now be initialized.Repeat the previous 2 steps for the other two robots. The initial setup for each robot is shown below:
Carter1:
Carter2:
Carter3:
8. In the /carter1
namespaced Rviz2 window, click on the 2D Nav Goal
button and then click and drag at the desired location point in the map.
The ROS2 Navigation stack will now generate a trajectory and the /carter1
robot will start moving towards its destination!
Repeat this process for the
/carter2
and/carter3
robots.