Hello together,
I used the USD files from the OmniIsaacGymEnvs-UR10Reacher repository to train the robot for the pick-and-place task, and I needed to control the gripper after the robot reached the object. I tried to connect the gripper to the ee_link in two ways (as a short_suction_gripper from Props and as it was connected in the USD). I added the omni.isaac.surface_gripper and omni.isaac.universal_robots to the file omni.isaac.sim.python.gym.headless.kit:
Isaac Sim Extensions
###############################
[dependencies]
“omni.isaac.core” = {}
“omni.isaac.core_archive” = {}
“omni.pip.compute” = {}
“omni.pip.cloud” = {}
“omni.isaac.cloner” = {}
“omni.isaac.gym” = {}
“omni.isaac.kit” = {}
“omni.isaac.ml_archive” = {}
“omni.kit.loop-isaac” = {}
“omni.isaac.surface_gripper” = {}
“omni.isaac.universal_robots” = {}
“omni.isaac.manipulators.grippers.surface_gripper” = {}
Now my UR10 and UR10View looks like:
UR10.py:
from typing import Optional
import torch
from omni.isaac.core.robots.robot import Robot
#from omni.isaac.universal_robots import UR10
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.stage import add_reference_to_stage
import carb
class UR10RobotArm(Robot):
“”"
Represents a UR10 robotic arm in a simulation environment. This class is used to instantiate a UR10 robot
with specific configurations and add it to the simulation stage.
Attributes:
_usd_path (str): The path to the USD file that defines the visual and physical properties of the robot.
_name (str): The name of the robot instance in the simulation.
_position (torch.tensor): The initial position of the robot in the simulation environment.
_orientation (torch.tensor): The initial orientation of the robot in the simulation environment.
Args:
prim_path (str): The path in the simulation scene graph where the robot will be added.
name (Optional[str]): The name assigned to the robot instance. Defaults to "UR10".
usd_path (Optional[str]): The path to a USD file for the robot. If None, a default path is set.
translation (Optional[torch.tensor]): The initial position of the robot. If None, defaults to [0.0, 0.0, 0.0].
orientation (Optional[torch.tensor]): The initial orientation of the robot. If None, defaults to [1.0, 0.0, 0.0, 0.0].
"""
def __init__(
self,
prim_path: str,
name: Optional[str] = "UR10",
usd_path: Optional[str] = None,
translation: Optional[torch.tensor] = None,
orientation: Optional[torch.tensor] = None,
attach_gripper: Optional[bool] = True,
#gripper_usd_path: Optional[str] = None,
) -> None:
"""
Initializes a new instance of the UR10 robot with the specified parameters and adds it to the simulation stage.
The robot is positioned and oriented according to the provided translation and orientation tensors.
If no USD path is provided, the default asset path is set. This is based on the assumption that there is a
pre-configured USD path set up in the simulation environment.
Raises:
RuntimeError: If the assets root path cannot be determined when no specific USD path is provided.
"""
self._usd_path = usd_path
self.assets_root_path = get_assets_root_path()
self._name = name
if self._usd_path is None:
assets_root_path = get_assets_root_path()
if assets_root_path is None:
carb.log_error("Could not find Isaac Sim assets folder")
self._usd_path = 'omniverse://localhost/Projects/J3soon/Isaac/2023.1.1/Isaac/Robots/UR10/ur10_short_suction_gripper.usd'
# Depends on your real robot setup
self._position = torch.tensor([0.0, 0.0, 0.0]) if translation is None else translation
self._orientation = torch.tensor([1.0, 0.0, 0.0, 0.0]) if orientation is None else orientation
add_reference_to_stage(self._usd_path, prim_path)
if attach_gripper:
self.attach_gripper()
super().__init__(
prim_path=prim_path,
name=name,
position =self._position,
orientation=self._orientation,
#articulation_controller=None,
attach_gripper=attach_gripper,
#gripper_usd_path = "omniverse://localhost/Projects/J3soon/Isaac/2023.1.1/Isaac/Robots/UR10/Props/short_gripper.usd"
)
def attach_gripper(self):
gripper_usd_path = "omniverse://localhost/Projects/J3soon/Isaac/2023.1.1/Isaac/Robots/UR10/Props/short_gripper.usd"
gripper_prim_path = f"{self.prim_path}/short_gripper"
add_reference_to_stage(gripper_usd_path, gripper_prim_path)
#self.attach_link(gripper_prim_path, "ee_link")
and UR10View.py:
from typing import Optional
from omni.isaac.core.articulations import ArticulationView
from omni.isaac.core.prims import RigidPrimView
from omni.isaac.manipulators.grippers.surface_gripper import SurfaceGripper
import torch
class UR10View(ArticulationView):
def init(
self,
prim_paths_expr: str,
name: Optional[str] = “UR10View”,
) → None:
super().__init__(
prim_paths_expr=prim_paths_expr,
name=name,
reset_xform_properties=False
)
# Use RigidPrimView instead of XFormPrimView, since the XForm is not updated when running
self._end_effectors = RigidPrimView(prim_paths_expr="/World/envs/.*/ur10/ee_link", name="end_effector_view", reset_xform_properties=False)
self._gripper = SurfaceGripper(end_effector_prim_path= self.default_zero_env_path + "/ur10/ee_link", translate=0.1611, direction="x")
def initialize(self, physics_sim_view):
super().initialize(physics_sim_view)
#self._gripper.initialize()
After this changes I get the error massage: ModuleNotFoundError: No module named ‘omni.kit.usd’
I would be glad if you could help me with this problems.
Kind regards,
Olga