7.1.7. Teleport Service

7.1.7.1. Learning Objectives

In this example, we will learn to use the Teleport Service ROS bridge.

7.1.7.2. Getting Started

Prerequisite

7.1.7.3. Teleport Example

  1. The Teleport Service example can be found in Isaac Examples > ROS > Teleport. A cube and a cone will automatically load on the stage.

  2. Open the Action Graph window if it’s not open already: Window > Visual Scripting > Action Graph.

  3. Open the existing Action Graph by clicking on the icon Edit Action Graph. Select the only graph in the popup list.

  4. The graph at work will appear in the Action Graph window. It should have only two nodes: On Playback Tick and ROS1 Teleport Service.

  5. To call the service, in a separate terminal, source the Isaac Sim’s ROS1 workspaces: source <noetic_ws>/devel/setup.bash.

  6. 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.

7.1.7.3.1. 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)

7.1.7.4. Summary

This tutorial covered

  • Setting up ROS1 Teleport Service in Omniverse Isaac Sim

  • Creating a ROS service client script using a custom messsage type

7.1.7.4.1. 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.