In this ROS sample, we are demonstrating Omniverse Isaac Sim integrated with the ROS Navigation stack.
To learn more about ROS Navigation refer to the ROS website: http://wiki.ros.org/navigation
For this sample, we use the
carter_2dnav package which contains the required launch file and navigation parameters.
carter_description package is also used for displaying the NVIDIA Carter robot model in RViz.
Both packages are located under the directory
If not already done, include both packages into your ROS workspace. Build and source your workspace before proceeding.
Ensure Roscore is running before running Omniverse Isaac Sim.
First go to Isaac Examples -> Communicating -> ROS -> Navigation to load the warehouse scenario.
Play to begin simulation.
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 Message Type
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.
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
Using the Occupancy Map Generator extension (Recommended):¶
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.
Set the map parameters as such:
Keep in mind, that the start location Z height has been set to 68.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):
Generate Occupancy Map.
For rotation, select 180 degrees from the dropdown menu and click on
A Visualization popup will appear.
From the dropdown menu, select
ROS Occupancy Map Parameters File (YAML). Occupancy map parameters formatted to YAML will appear in the field below. Copy this text.
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
Insert the previously copied text in the
Back in the visualization tab in Omniverse Isaac Sim, click
Save Image. Name the image as
carter_warehouse_navigation.png and choose to save in the same directory as the map parameters file.
If not done so already, click
Stop to terminate the simulation.
An occupancy map is now ready to be used with ROS Navigation!
Using the slam_gmapping ROS package:¶
Follow the tutorial: http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData
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.
Stop to terminate the simulation.
Running ROS Navigation¶
Play to begin simulation.
In a new terminal, run the ROS launch file to begin ROS Navigation.
roslaunch carter_2dnav move_base.launch
Rviz will open and begin loading the urdf model of the robot, the global costmap (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.
It is mostly likely after launching
move_base.launch, that the local costmap will not match the global costmap.
This means the robot is not correctly localized. To mitigate this, click on the
2D Pose Estimate button near
the top of the Rviz window and set the initial estimated pose by clicking and dragging at a point on the map
where you think the robot is located.
To get a better idea of where the robot is located, you may wish to change camera views by clicking at the top left of the viewport in the Omniverse Isaac Sim window.
In Rviz, the robot model will immediately jump to the indicated pose. The local costmap should now be similarly aligned to the global costmap.
The local and global maps don’t have to perfectly align yet. However if their alignment is quite different, you may repeat the previous step until you get a closer alignment.
To make both the local and global maps properly align, manually drive around the robot (rotating in place works the fastest in most cases). For manually controlling the robot, run the teleop_twist_keyboard ROS node using the following command in a new terminal.
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Use the keyboard to move the robot until the local costmap has properly aligned with the global costmap.
Now the robot has been properly localized! You may now stop the teleop_twist_keyboard node as it is not required anymore.
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!