Isaac Sim Version
4.5.0
Operating System
Windows 10
GPU Information
- Model: RTX2070 super
Topic Description
Hello,
I have developed some simulation logic and robot control functionality using Python in NVIDIA Isaac Sim. Now, I would like to know if it’s possible to reuse or integrate those Python scripts inside USD Composer (formerly known as Omniverse Create).
Specifically, I am wondering:
- Can I run
Isaac Sim
-specific Python scripts (e.g., involvingWorld
,Articulation
,Task
, etc.) in USD Composer? - If not directly, is there a way to adapt Isaac Sim logic into USD Composer (e.g., via OmniGraph, Kit extensions, or scripting interfaces)?
- Are there limitations in the USD Composer Python environment that prevent using
isaacsim
modules? - What is the recommended way to develop once in Isaac Sim and visualize or control in Composer?
Any guidance or best practices would be appreciated.
Thank you!
from omni.kit.scripting import BehaviorScript
import carb
import numpy as np
import os
from isaacsim.core.prims import SingleArticulation as Articulation
from isaacsim.core.prims import SingleXFormPrim as XFormPrim
from isaacsim.core.utils.numpy.rotations import euler_angles_to_quats
from isaacsim.core.utils.stage import add_reference_to_stage
from isaacsim.robot_motion.motion_generation import (
ArticulationKinematicsSolver,
LulaKinematicsSolver,
)
from isaacsim.core.prims import GeometryPrim
from isaacsim.core.utils.nucleus import get_assets_root_path
from isaacsim.robot_motion.motion_generation import interface_config_loader
class HH7(BehaviorScript):
def on_init(self):
self._kinematics_solver = None
self._articulation_kinematics_solver = None
self._articulation = None
self._target = None
# Add the Franka and target to the stage
robot_prim_path = "/World/RobotArm/hh200l_robot_suction_color_01/hh200l"
path_to_robot_usd = "C:/isaacsim/exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/hh200l_robot_suction/hh200l_robot_suction.usd"
# 스테이지에 로봇 추가
# add_reference_to_stage(path_to_robot_usd, robot_prim_path)
self._articulation = Articulation(robot_prim_path)
a = self._articulation.get_joint_positions()
# 목표물 추가 (Frame Prim)
target_prim_path = "/World/target"
add_reference_to_stage(
get_assets_root_path() + "/Isaac/Props/UIElements/frame_prim.usd",
target_prim_path
)
self._target = XFormPrim(target_prim_path, scale=[0.05, 0.05, 0.05])
self._target.set_default_state(
np.array([-36, 30, 1]), # 목표 위치 (X, Y, Z)
euler_angles_to_quats([0, np.pi / 2, 0]) # 목표 회전 (Yaw 90도)
)
# HH200l의 URDF 및 Lula 설정 파일 경로
robot_description_path = "C:/isaacsim\exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/rmpflow_suction/hh200l_robot_description.yaml"
urdf_path = "C:/isaacsim\exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/hh200l_robot_suction.urdf"
self._kinematics_solver = LulaKinematicsSolver(
robot_description_path = robot_description_path,
urdf_path = urdf_path
)
print("Valid frame names at which to compute kinematics:", self._kinematics_solver.get_all_frame_names())
end_effector_name = "link6"
self._articulation_kinematics_solver = ArticulationKinematicsSolver(self._articulation,self._kinematics_solver, end_effector_name)
def load_example_assets(self):
# Add the Franka and target to the stage
robot_prim_path = "/World/hh7"
path_to_robot_usd = "C:/isaacsim/exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/hh200l_robot_suction/hh200l_robot_suction.usd"
# 스테이지에 로봇 추가
# add_reference_to_stage(path_to_robot_usd, robot_prim_path)
self._articulation = Articulation(robot_prim_path)
a = self._articulation.get_joint_positions()
# 목표물 추가 (Frame Prim)
target_prim_path = "/World/target"
add_reference_to_stage(
get_assets_root_path() + "/Isaac/Props/UIElements/frame_prim.usd",
target_prim_path
)
self._target = XFormPrim(target_prim_path, scale=[0.05, 0.05, 0.05])
self._target.set_default_state(
np.array([1, 1, 1]), # 목표 위치 (X, Y, Z)
euler_angles_to_quats([0, np.pi / 2, 0]) # 목표 회전 (Yaw 90도)
)
# Return assets that were added to the stage so that they can be registered with the core.World
return self._articulation, self._target
def setup(self):
# HH07의 URDF 및 Lula 설정 파일 경로
robot_description_path = "C:/isaacsim\exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/rmpflow_suction/hh200l_robot_description.yaml"
urdf_path = "C:/isaacsim\exts/isaacsim.robot_motion.motion_generation/motion_policy_configs/hh200l/hh200l_robot_suction.urdf"
self._kinematics_solver = LulaKinematicsSolver(
robot_description_path = robot_description_path,
urdf_path = urdf_path
)
print("Valid frame names at which to compute kinematics:", self._kinematics_solver.get_all_frame_names())
end_effector_name = "link6"
self._articulation_kinematics_solver = ArticulationKinematicsSolver(self._articulation,self._kinematics_solver, end_effector_name)
def on_play(self):
# """목표 위치를 따라 IK 실행"""
# self.load_example_assets()
# self.setup()
target_position, target_orientation = self._target.get_world_pose()
target_position = np.array([0.5, 0.0, 0.6]) # (예시값) 타겟 위치
self._articulation.initialize()
def on_stop(self):
self.Sim_Time = 0
def on_update(self, current_time: float, delta_time: float):
pose_list = [
(np.array([1.0, 0.0, 0.0, 0.0]), np.array([-37.29882, 28.30572, 0.3762])),
(np.array([1.0, 0.0, 0.0, 0.0]), np.array([-37.56989, 28.03886, 0.97684])),
(np.array([0.8362914, 0.27204004, 0.35653222, -0.31542945]), np.array([-36.86908, 28.290235, 1.5166066]))
]
# 몇 초마다 pose 전환할지 설정
switch_interval = 2.0
# 몇 번째 pose를 쓸지 계산
index = int(current_time // switch_interval) % len(pose_list)
target_orientation, target_position = pose_list[index]
robot_base_translation,robot_base_orientation = self._articulation.get_world_pose()
self._kinematics_solver.set_robot_base_pose(robot_base_translation,robot_base_orientation)
action, success = self._articulation_kinematics_solver.compute_inverse_kinematics(target_position, target_orientation)
a = self._articulation_kinematics_solver.compute_end_effector_pose()
if success:
self._articulation.apply_action(action)
else:
carb.log_warn("IK did not converge to a solution. No action is being taken")
This code is designed to move a robot arm to a target position using inverse kinematics in Isaac Sim. I would like to place the robot arm in USD Composer and have it respond to this code so that it moves accordingly.
Could you please help make this setup work in USD Composer?