# 2. Import and Drive TurtleBot3¶

Omniverse Isaac Sim have several tools to facilitate integration with ROS systems. We have both ROS and ROS2 bridges, an URDF importer, as well as connection to Gazebo/Ignition. This tutorial series gives examples of how to use these tools.

## 2.1. Learning Objectives¶

In this example, we will setup up a Turtlebot3 in Isaac Sim and enable it to drive around. We will

• Import the Turtlebot3 robot using the URDF importer

• Introduce the ROS bridge and ROS OmniGraph (OG) nodes

• Setup the robot to be driven by a ROS Twist message

## 2.2. Getting Started¶

Prerequisite

• Completed ROS & ROS 2 Installation so that ROS is available, ROS extension is enabled, and necessary environment variables are set.

• Basic understanding ROS workspace.

• roscore is running.

ROS Bridge

The ROS bridge comes with a few popular rostopics that are packaged for ease of use. More details are in the ROS & ROS2 Bridge. Here we will focus on the procedures in using them.

To establish a ROS bridge for a specific topic, the steps can be generalized to the following:

• open an action graph

• add the OG nodes relevant to the desired rostopics

• modify any properties as needed

• connect the data pipeline

These steps can be done entirely in the UI, scripting inside the extension workflow, or scripting inside the standalone Python workflow. Refer to Isaac Sim Workflows for details of different workflows. For majority of the tutorials we will be demonstrating the UI method. Scripting inside the extension workflow is introduced in Joint Control: Extension Python Scripting. Scripting using the standalone Python workflow is introduced in Custom Message, and scripting OmniGraph nodes is introduced in OmniGraph: Python Scripting.

## 2.3. Importing TurtleBot3 URDF¶

• If you haven’t already downloaded the Turtlebot3 package, do so inside the ROS workspace, and then build it.

git clone -b <distro>-devel https://github.com/ROBOTIS-GIT/turtlebot3.git turtlebot3

• Locate the Xacro file for Turtlebot3 Burger in turtlebot3/turtlebot3_description/urdf/turtlebot3_burger.urdf.xacro. Convert the .xacro file to .urdf file by calling

rosrun xacro xacro -o <output_name>.urdf <input_file>.urdf.xacro

1. For the purpose of this tutorial series, we will use an Isaac environment, but you can import the robot into any environment of your choosing. Open the environment by going to the Content tab below the viewport, and find Isaac/Environments/Simple_Room/simple_room.usd. If you do not want to use the provided environment, just make sure there is a GroundPlane and a PhysicsScene to your environment. Both can be found in Create -> Physics. You may also need some lighting, play with the various types of lighting in Create -> Light to get the desired effect.

2. On a new stage, drag the simple_room.usd onto the stage, and place it at the origin by zero out all the Translate components in the Transform Property. You many need to zoom in a bit to see the table inside the room.

3. Open the URDF importer Isaac Utils > Workflows > URDF Importer.

4. In the prompt window, inside Import Option section, uncheck clean stage to preserve the existing environment, uncheck Fix Base Link since this is a mobile robot, change Joint Drive Type to Velocity so that wheels can be properly driven later.

5. Inside Import section, first locate the URDF file you wish to import in the Input File. The Import button will only enable after you’ve selected the file.

6. Once the asset is imported into Omniverse Kit, a copy of the .usd version of the asset will be automatically saved. Specify the folder you wish to save the asset in Output Directory if it’s different than the folder that the .urdf file is located in. A folder name matching the .urdf file will be created in the specified directory, and the .usd file will be inside the newly created folder.

7. Make sure to unselect everything on the stage by click on an empty space inside the Stage tab, or select /World on the tree. Otherwise you might be importing the Turtlebot as a child of a random object on the tree.

8. Click Import.

9. When the Turtlebot is first imported, it will be on the table. Place it just above the floor of the room using the gizmo.

10. Press Play and you should see the Turtlebot fall onto the floor.

### 2.3.1. Tune the Robot¶

The URDF importer automatically imports material, physical, and joint properties whenever it is available and have matching categories in Omniverse Isaac Sim. However, in cases there are no available or matching categories, or if the units are different between the two systems, what gets automatically filled in may not be accurate and changes the robot’s behavior. Here are some properties that can be tuned to correct the robot’s behavior.

Frictional Properties

If your robot’s wheels are slipping, try changing the friction coefficients of the wheels and potentially the ground as well following steps 3.4.2 in Add Simple Objects

Physical Properties

If no explicit mass or inertial properties are given, the physics engine will estimate them from the geometry mesh. To update the mass and inertial properties, find the prim that contains the rigid body for the given link (You can verify this by finding “Physics > Rigid Body” under its property tab). If it already has a “Mass” category under its Physics property tab, modify them accordingly. If there isn’t already a “Mass” category, you can add it by clicking on the +Add button on top of the Propery tab, and select “Physics > Mass”.

Joint Properties

If your robot is oscillating at the joint or moving too slow, take a look at the stiffness and damping parameters for the joints. High stiffness makes the joints snap faster and harder to the desire target, and higher damping smoothes but also slows down the joint’s movement to target. For pure position drives, set relatively high stiffness and low damping. For velocity drives, stiffness must be set to zero with a non-zero damping.

## 2.4. Drive the Robot¶

### 2.4.1. Build the Graph¶

All of the ROS bridges are in forms of OmniGraph nodes. Here we will demonstrate how to subscribe to a ROS twist message, and pipe the data to the controllers that can drive the robot around.

1. Open Visual Scripting: Window > Visual Scripting > Action Graph. An Action Graph window will appear on the bottom, you can dock it wherever that’s convenient.

2. Click on the New Action Graph Icon in middle of the Action Graph Window.

3. Inside the Action Graph window, there is a panel on the left hand side with all the OmniGraph Nodes (or OG nodes). All ROS related OG nodes are listed under Isaac Ros. You can also search for nodes by name. To place node into the graph, simply drag it from the node list into the graph window.

4. Build a graph that matches the one below.

### 2.4.2. Graph Explained¶

• On Playback Tick Node: Producing a tick when simulation is “Playing”. Nodes that receives ticks from this node will execute their compute functions every simulation step.

• ROS Subscribe Twist Node: Subscribing to a Twist message. Specify the Rostopic’s name /cmd_vel in the topicName field in its Property Tab.

• Note the subscriber nodes often have a Exec Out field. This act similar to a tick and will send a signal when a message is received by the subscriber. In this case, we want to only calculate the differential commands when a new twist message arrives. Therefore the Differential Node’s Exec In is ticked by the output of the subscriber node and not by On Playback Tick.

• Scale To/From Stage Unit Node: Convert assets or inputs to stage unit.

• Break 3-Vector Node: The output of the Twist subscriber node is linear and angular velocities, both 3-dimensional vectors. But the input of the differential controller node only takes a forward velocity and rotation velocity in z-axis, therefore we need to decompose the array and extract the corresponding elements before feeding them into the differential controller node.

• Differential Controller Node: This node receives desired vehicle speed and calculates the wheel speed of the robot. It needs the wheel radius and distance between the wheels to make that calculation. It can also receive optional speed limit parameters to cap off wheel speed. Type in the property tab the wheel radius, the distance between the wheels, and the maximum linear speed for the vehicle as seen in table below to match the Turtlebot.

Field

Value

Max Linear Speed

0.22

Wheel Distance

0.16

0.025

• Articulation Controller Node: This node is assigned to a target robot, then takes in the names or the indices of the joints that needs to be moved, and move them by the commands given in either Position Commands, Velocity Commands, or Effort Commands.

• Note the Articulation Controller node is ticked by On Playback Tick. So that if no new Twist message arrives, it will continue to execute whatever command it had received before.

• To assign the Articulation Controller node’s target to be the Turtlebot. In the property tab, unselect Use Path, and click on Target for the Prim, and find Turtlebot prim in the popup box. Make sure the robot prim you select is also where the Articulation Root API is applied. For some robots, the Articulation Root API is applied to a specific link of the robot and not the parent robot prim. More about Articulation API can be found in Add Articulation.

• To put the names of the wheel joints in an array format, type in the names of the wheel joints inside each of the Constant Token nodes, and feed the array of the names into the Make Array Node. The names of the joints for the Turtlebot are wheel_left_joint and wheel_right_joint.

• If you are wondering why not put the names in Constant String node, it’s because OmniGraph does not have string-array data type, therefore if strings needed to be put in an array format to be used by a node, it needs to be token type instead.

### 2.4.3. Verify ROS connections¶

1. Press Play to start ticking the graph and the physics simulation.

2. In a separate ROS-sourced terminal, check that the associated rostopics exist with rostopic list. /cmd_vel should be listed in addition to /rosout and /rosout_agg.

3. Now that a twist subscriber is setup, a twist message can be published to /cmd_vel topic to control the robot. In a separate ROS-sourced terminal, send drive forward command:

rostopic pub /cmd_vel geometry_msgs/Twist '{linear:  {x: 0.2, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

• To make it easier for us to move the Turtlebot around, download the ROS keyboard interface teleop-twist-keyboard and enable using the keyboard to publish twist messages.

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

• Alternatively, you can also setup keyboard device interface inside OmniGraph. More of that can be found in OmniGraph: Input Devices

### 2.4.4. Troubleshooting¶

Make sure your robot is on the ground. The table has a different property therefore making it hard for the robot to move on it. To change properties of either the ground or the wheels, go to Assemble a Simple Robot.

## 2.5. Summary¶

This tutorial covered the following topics:

1. URDF import

2. Subscribing to a ROS Twist message

3. Drive the robot using the Differential Controller and the Articulation Controller

### 2.5.1. Next Steps¶

Continue on to the next tutorial in our ROS Tutorials series, Cameras, to learn how to add cameras and publish ground truth synthetic perception data through rostopics.