6. ROS Navigation¶
6.1. Learning Objectives¶
In this ROS example, We will
Demonstrate Omniverse Isaac Sim integrated with the ROS Navigation stack.
Use the Occupancy Map Generator.
6.2. Getting Started¶
Prerequisite
The ROS Navigation stack is required to run this sample. Install the ROS Navigation stack:
sudo apt-get install ros-$ROS_DISTRO-navigation
This tutorial requires
carter_2dnav
package andcarter_description
package provided as part of your Omniverse Isaac Sim download. Both packages are located under the directoryros_workspace/src/navigation/
. They contain the required launch file, navigation parameters, and robot model. Complete ROS & ROS2 Installation, make sure ROS environment is setup correctly and those packages are inside your ROS_PACKAGE_PATH.Roscore is running before running Omniverse Isaac Sim.
6.3. The ROS Navigation Setup¶
This block diagram shows the ROS messages required for the ROS Navigation stack.
As described above, the following topics and message types being published to the ROS Navigation stack in this scenario are:
ROS Topic
ROS Message Type
/tf
tf2_msgs/TFMessage
/odom
nav_msgs/Odometry
/map
nav_msgs/OccupancyGrid
/scan
sensor_msgs/LaserScan
6.3.1. Omniverse Isaac Sim TF broadcasting in more detail:¶
ROS_DifferentialBase
subscribes to the /cmd_vel topic and is responsible for controlling the movement of the robot. It also publishes the transform between the odom frame and base_link frame.
ROS_Carter_Broadcaster
is responsible for publishing the static
transform between the base_link frame and chassis_link frame. Keep in mind that since the target prim is set as Carter_ROS
, the entire transform tree of the Carter robot (with chassis_link as root) will be published alongside the base_link frame.
ROS_Carter_Lidar_Broadcaster
is responsible for publishing the static transform between the chassis_link frame and carter_lidar frame.
Finally, to ensure all ROS nodes reference simulation time, a ROS_Clock
prim has been added which publishes the simulation time to the /clock ROS topic.
6.3.2. Generate Occupancy Map¶
In this scenario we will use an occupancy map. To generate a map there are 2 options:
Using the Occupancy Map Generator extension within Omniverse Isaac Sim (Recommended)
Using the
slam_gmapping
ROS package
6.3.2.1. Using the Occupancy Map Generator extension (Recommended):¶
To learn more about the Occupancy Map Generator extension click here.
Go to Isaac Examples -> ROS -> Navigation to load the warehouse scenario.
Press
Play
to begin simulation.At the upper left corner of the viewport, click on carter_camera_stereo_left. Select Top from the dropdown menu.
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.
6. Select the warehouse_with_forklifts 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 warehouse_with_forklifts 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):
Ensure the Carter_ROS prim is removed from the stage.
Once the setup 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
. The ROS camera and Isaac Sim camera have different coordinates.Occupancy map parameters formatted to YAML will appear in the field below. Copy the full text.
11. Create a YAML file for the occupancy map parameters called carter_warehouse_navigation.yaml
and place it in the map directory which is located in the sample carter_2dnav
ROS package
(carter_2dnav/map/carter_warehouse_navigation.yaml
).
Insert the previously copied text in the
carter_warehouse_navigation.yaml
file.Back in the visualization tab in Omniverse Isaac Sim, click
Save Image
. Name the image ascarter_warehouse_navigation.png
and choose to save in the same directory as the map parameters file.
The final saved image 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 ROS Navigation!
6.3.2.2. Using the slam_gmapping ROS package:¶
Install the slam_gmapping ROS package, run the command below:
sudo apt-get install ros-$ROS_DISTRO-slam-gmapping
Install the
teleop_twist_keyboard
ROS package:
sudo apt-get install ros-$ROS_DISTRO-teleop-twist-keyboard
Go to Isaac Examples -> ROS -> Navigation to load the warehouse scenario. Press
Play
to begin simulation.Follow the tutorial: http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData
Note
Since a rosbag is not available, substitute the rosbag command in the tutorial with the following command: rosrun teleop_twist_keyboard teleop_twist_keyboard.py
. This will start the teleop_twist_keyboard ROS node and enable you to use your keyboard to manually drive the robot around the warehouse to simultaneously generate a map.
Press
Stop
to terminate the simulation.
6.4. Running ROS Navigation¶
Go to Isaac Examples -> ROS -> Navigation to load the warehouse scenario.
Click on
Play
to begin simulation.In a new terminal, run the ROS launch file to begin ROS Navigation.
roslaunch carter_2dnav carter_navigation.launch
Rviz will open and begin loading the urdf model of the robot, the global occupancy map, as well as the local costmap which will be overlaid on top.
To verify that all of the transforms are broadcasting, run the following command in a new terminal to visualize the ROS TF frame tree:
rosrun rqt_tf_tree rqt_tf_tree
The generated graph should look similar to the one shown below.
Since the position of the robot is defined in carter_navigation.launch
, the robot should already be properly localized.
5. Click on the 2D Nav Goal
button and then click and drag at the desired location point in the map.
The ROS Navigation stack will now generate a trajectory and the robot will start moving towards its destination!
6.5. Troubleshooting¶
If you are noticing performance related issues with the ROS Navigation stack or errors such as:
Could not transform the global plan to the frame of the control
Consider increasing the transform_tolerance parameter for the local and global occupancy maps found in local_costmap_params.yaml and global_costmap_params.yaml.
6.6. Summary¶
In this tutorial, we covered
Occupancy map
Running Isaac Sim with ROS navigation stack.
6.6.1. Next Steps¶
Go to the next tutorial Multiple Robot ROS Navigation to move multiple navigating robots.
6.6.2. Further Learning¶
To learn more about ROS Navigation.
More about Occupancy Map Generator.