Teleport Service
Learning Objectives
In this example, we will learn to use the Teleport Service ROS bridge.
Getting Started
Prerequisite
Completed ROS and ROS 2 Installation so that ROS is available, ROS extension is enabled, and necessary environment variables are set.
Completed tutorial for OmniGraph
roscore
is running.Basic understanding of ROS Services.
Teleport Example
The Teleport Service example can be found in Isaac Examples > ROS > Teleport. A cube and a cone will automatically load on the stage.
Open the Action Graph window if it’s not open already: Window > Visual Scripting > Action Graph.
Open the existing Action Graph by clicking on the icon Edit Action Graph. Select the only graph in the popup list.
The graph at work will appear in the Action Graph window. It should have only two nodes: On Playback Tick and ROS1 Teleport Service.
To call the service, in a separate terminal, source the Isaac Sim’s ROS1 workspaces:
source <noetic_ws>/devel/setup.bash
.Then run the example client side of the service by
rosrun isaac_tutorials ros_service_client.py
. You should see that both the cube and the cone will jump to a random new position when the service gets called by the script.
Node Explained
To add a teleport service to the stage, simply add the ROS1 Teleport Service node connected up to a On Playback Tick. The node receives a call that contains both the prim path of the object that needs to be teleported, as well as the location that it needs to be teleported to. The name of the service can be modified in the serviceName field in its Property tab.
The Pose Teleport Service uses a custom IsaacPose
Rosservice message. The custom service definition can be found in <noetic_ws>/src/isaac_ros_messages/srv/IsaacPose.srv
.
std_msgs/Header header
string[] names
geometry_msgs/Pose[] poses
geometry_msgs/Twist[] velocities
geometry_msgs/Vector3[] scales
---
In the message,
names
defines the prim paths to the object that needs to be teleported in an array. It must match where the object is on stage.poses
is an array that corresponding to the desired location for each object.
Below is an example of how to setup this custom message. This is the client script that you ran in the example. It is located at <noetic_ws>/src/isaac_tutorials/scripts/ros_service_client.py
import rospy
import numpy as np
from isaac_ros_messages.srv import IsaacPose
from isaac_ros_messages.srv import IsaacPoseRequest
from geometry_msgs.msg import Pose
def teleport_client(msg):
rospy.wait_for_service("teleport")
try:
teleport = rospy.ServiceProxy("teleport", IsaacPose)
teleport(msg)
return
except rospy.ServiceException as e:
print("Service call failed: %s" % e)
# compose teleport messages
cube_pose = Pose()
cube_pose.position.x = np.random.uniform(-2, 2)
cube_pose.position.y = 0
cube_pose.position.z = 0
cube_pose.orientation.w = 1
cube_pose.orientation.x = 0
cube_pose.orientation.y = 0
cube_pose.orientation.z = 0
cone_pose = Pose()
cone_pose.position.x = 0
cone_pose.position.y = np.random.uniform(-2, 2)
cone_pose.position.z = 0
cone_pose.orientation.w = 1
cone_pose.orientation.x = 0
cone_pose.orientation.y = 0
cone_pose.orientation.z = 0
teleport_msg = IsaacPoseRequest()
teleport_msg.names = ["/World/Cube", "/World/Cone"]
teleport_msg.poses = [cone_pose, cube_pose]
teleport_client(teleport_msg)
Summary
This tutorial covered
Setting up ROS1 Teleport Service in Omniverse Isaac Sim
Creating a ROS service client script using a custom messsage type
Next Steps
Continue on to the next tutorial in our ROS Tutorials series, ROS Navigation to learn to use the ROS Navigation stack with Omniverse Isaac Sim.