This is the code of the UR10 class that I have, but it is missing some functions. Please can anyone share their code.
Yiou can find the function description in this link.
UR 10 class documentation
Thanks in advance.
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from typing import Optional
import numpy as np
from omni.isaac.core.robots.robot import Robot
from omni.isaac.core.prims.rigid_prim import RigidPrim
from omni.isaac.manipulators.grippers.surface_gripper import SurfaceGripper
from omni.isaac.core.utils.prims import get_prim_at_path
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.core.utils.nucleus import get_assets_root_path
import carb
class UR10(Robot):
"""[summary]
Args:
prim_path (str): [description]
name (str, optional): [description]. Defaults to "ur10_robot".
usd_path (Optional[str], optional): [description]. Defaults to None.
position (Optional[np.ndarray], optional): [description]. Defaults to None.
orientation (Optional[np.ndarray], optional): [description]. Defaults to None.
end_effector_prim_name (Optional[str], optional): [description]. Defaults to None.
attach_gripper (bool, optional): [description]. Defaults to False.observations[target_name]["orientation"]
gripper_usd (Optional[str], optional): [description]. Defaults to "default".
Raises:
NotImplementedError: [description]
"""
def __init__(
self,
prim_path: str,
name: str = "ur10_robot",
usd_path: Optional[str] = None,
position: Optional[np.ndarray] = None,
orientation: Optional[np.ndarray] = None,
end_effector_prim_name: Optional[str] = None,
attach_gripper: bool = False,
gripper_usd: Optional[str] = "default",
) -> None:
prim = get_prim_at_path(prim_path)
self._end_effector = None
self._gripper = None
self._end_effector_prim_name = end_effector_prim_name
if not prim.IsValid():
if usd_path:
add_reference_to_stage(usd_path=usd_path, prim_path=prim_path)
else:
assets_root_path = get_assets_root_path()
if assets_root_path is None:
carb.log_error("Could not find Isaac Sim assets folder")
return
usd_path = assets_root_path + "/Isaac/Robots/UR10/ur10.usd"
add_reference_to_stage(usd_path=usd_path, prim_path=prim_path)
if self._end_effector_prim_name is None:
self._end_effector_prim_path = prim_path + "/ee_link"
else:
self._end_effector_prim_path = prim_path + "/" + end_effector_prim_name
else:
# TODO: change this
if self._end_effector_prim_name is None:
self._end_effector_prim_path = prim_path + "/ee_link"
else:
self._end_effector_prim_path = prim_path + "/" + end_effector_prim_name
super().__init__(
prim_path=prim_path, name=name, position=position, orientation=orientation, articulation_controller=None
)
self._gripper_usd = gripper_usd
if attach_gripper:
if gripper_usd == "default":
assets_root_path = get_assets_root_path()
if assets_root_path is None:
carb.log_error("Could not find Isaac Sim assets folder")
return
gripper_usd = assets_root_path + "/Isaac/Robots/UR10/Props/short_gripper.usd"
add_reference_to_stage(usd_path=gripper_usd, prim_path=self._end_effector_prim_path)
self._gripper = SurfaceGripper(
end_effector_prim_path=self._end_effector_prim_path, translate=0.1611, direction="x"
)
elif gripper_usd is None:
carb.log_warn("Not adding a gripper usd, the gripper already exists in the ur10 asset")
self._gripper = SurfaceGripper(
end_effector_prim_path=self._end_effector_prim_path, translate=0.1611, direction="x"
)
else:
raise NotImplementedError
self._attach_gripper = attach_gripper
return
@property
def attach_gripper(self) -> bool:
"""[summary]
Returns:
bool: [description]
"""
return self._attach_gripper
@property
def end_effector(self) -> RigidPrim:
"""[summary]
Returns:
RigidPrim: [description]
"""
return self._end_effector
@property
def gripper(self) -> SurfaceGripper:
"""[summary]
Returns:
SurfaceGripper: [description]
"""
return self._gripper
def initialize(self, physics_sim_view=None) -> None:
"""[summary]
"""
super().initialize(physics_sim_view)
if self._attach_gripper:
self._gripper.initialize(physics_sim_view=physics_sim_view, articulation_num_dofs=self.num_dof)
self._end_effector = RigidPrim(prim_path=self._end_effector_prim_path, name=self.name + "_end_effector")
self.disable_gravity()
self._end_effector.initialize(physics_sim_view)
return
def post_reset(self) -> None:
"""[summary]
"""
Robot.post_reset(self)
self._end_effector.post_reset()
self._gripper.post_reset()
return