curobo.util.usd_helper module

set_prim_translate(prim, translation)
set_prim_transform(
prim,
pose: List[float],
scale: List[float] = [1, 1, 1],
use_float: bool = False,
)
get_prim_world_pose(
cache: XformCache,
prim: Prim,
inverse: bool = False,
)
get_transform(pose)
get_position_quat(
pose,
use_float: bool = True,
)
set_geom_mesh_attrs(
mesh_geom: Mesh,
obs: Mesh,
timestep=None,
)
set_geom_cube_attrs(
cube_geom: Cube,
dims: List[float],
pose: List[float],
timestep=None,
)
set_geom_cylinder_attrs(
cube_geom: Cylinder,
radius,
height,
pose: List[float],
timestep=None,
)
set_geom_sphere_attrs(
sphere_geom: Sphere,
radius: float,
pose: List[float],
timestep=None,
)
set_cylinder_attrs(
prim: Cylinder,
radius: float,
height: float,
pose,
color=[],
)
get_cylinder_attrs(
prim,
cache=None,
transform=None,
) Cylinder
get_capsule_attrs(
prim,
cache=None,
transform=None,
) Cylinder
get_cube_attrs(
prim,
cache=None,
transform=None,
) Cuboid
get_sphere_attrs(
prim,
cache=None,
transform=None,
) Sphere
get_mesh_attrs(
prim,
cache=None,
transform=None,
) Mesh
create_stage(
name: str = 'curobo_stage.usd',
base_frame: str = '/world',
)
class UsdHelper(use_float=True)

Bases: object

create_stage(
name: str = 'curobo_stage.usd',
base_frame: str = '/world',
timesteps: int | None = None,
dt=0.02,
interpolation_steps: float = 1,
)
add_subroot(
root='/world',
sub_root='/obstacles',
pose: Pose | None = None,
)
load_stage_from_file(
file_path: str,
)
load_stage(
stage: Stage,
)
get_pose(
prim_path: str,
timecode: float = 0.0,
inverse: bool = False,
) matrix
get_obstacles_from_stage(
only_paths: List[str] | None = None,
ignore_paths: List[str] | None = None,
only_substring: List[str] | None = None,
ignore_substring: List[str] | None = None,
reference_prim_path: str | None = None,
timecode: float = 0,
) WorldConfig
add_world_to_stage(
obstacles: WorldConfig,
base_frame: str = '/world',
obstacles_frame: str = 'obstacles',
base_t_obstacle_pose: Pose | None = None,
timestep: float | None = None,
)
get_prim_from_obstacle(
obstacle: Obstacle,
base_frame: str = '/world/obstacles',
timestep=None,
)
add_cuboid_to_stage(
obstacle: Cuboid,
base_frame: str = '/world/obstacles',
timestep=None,
enable_physics: bool = False,
)
add_cylinder_to_stage(
obstacle: Cylinder,
base_frame: str = '/world/obstacles',
timestep=None,
enable_physics: bool = False,
)
add_sphere_to_stage(
obstacle: Sphere,
base_frame: str = '/world/obstacles',
timestep=None,
enable_physics: bool = False,
)
add_mesh_to_stage(
obstacle: Mesh,
base_frame: str = '/world/obstacles',
timestep=None,
enable_physics: bool = False,
)
get_obstacle_from_prim(
prim_path: str,
) Obstacle
write_stage_to_file(
file_path: str,
flatten: bool = False,
)
create_animation(
robot_world_cfg: WorldConfig,
pose: Pose,
base_frame='/world',
robot_frame='/robot',
dt: float = 0.02,
)

Create animation, given meshes and pose

Parameters:
  • prim_names – _description_

  • pose – [ timesteps, n_meshes, pose]

  • dt – _description_. Defaults to 0.02.

create_obstacle_animation(
obstacles: List[List[Obstacle]],
base_frame: str = '/world',
obstacles_frame: str = 'robot_base',
)
create_linkpose_robot_animation(
robot_usd_path: str,
link_names: List[str],
joint_names: List[str],
pose: Pose,
robot_base_frame='/world/robot',
local_asset_path='assets/',
write_robot_usd_path='assets/',
robot_asset_prim_path='/panda',
)

Create animation, given meshes and pose

Parameters:
  • prim_names – _description_

  • pose – [ timesteps, n_meshes, pose]

  • dt – _description_. Defaults to 0.02.

add_material(
material_name: str,
object_path: str,
color: List[float],
obj_prim: Prim,
material: Material = Material(metallic=0.0, roughness=0.4),
)
save()
static write_trajectory_animation(
robot_model_file: str,
world_model: WorldConfig,
q_start: JointState,
q_traj: JointState,
dt: float = 0.02,
save_path: str = 'out.usd',
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
interpolation_steps: float = 1.0,
robot_base_frame='robot',
base_frame='/world',
kin_model: CudaRobotModel | None = None,
visualize_robot_spheres: bool = True,
robot_color: List[float] | None = None,
flatten_usd: bool = False,
goal_pose: Pose | None = None,
goal_color: List[float] | None = None,
)
static load_robot(
robot_model_file: str,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
) CudaRobotModel
static write_trajectory_animation_with_robot_usd(
robot_model_file: str,
world_model: WorldConfig | None,
q_start: JointState,
q_traj: JointState,
dt: float = 0.02,
save_path: str = 'out.usd',
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
interpolation_steps: float = 1.0,
write_robot_usd_path: str = 'assets/',
robot_base_frame: str = 'robot',
robot_usd_local_reference: str = 'assets/',
base_frame='/world',
kin_model: CudaRobotModel | None = None,
visualize_robot_spheres: bool = True,
robot_asset_prim_path=None,
robot_color: List[float] | None = None,
flatten_usd: bool = False,
goal_pose: Pose | None = None,
goal_color: List[float] | None = None,
)
static create_grid_usd(
usds_path: str | List[str],
save_path: str,
base_frame: str,
max_envs: int,
max_timecode: float,
x_space: float,
y_space: float,
x_per_row: int,
local_asset_path: str,
dt: float = 0.02,
interpolation_steps: int = 1,
prefix_string: str | None = None,
flatten_usd: bool = False,
)
load_robot_usd(
robot_usd_path: str,
link_names: List[str],
joint_names: List[str],
robot_base_frame='/world/robot',
write_asset_path='assets/',
local_asset_path='assets/',
robot_asset_prim_path='/panda',
)
get_robot_prims(
link_names: List[str],
joint_names: List[str],
robot_base_path: str = '/world/robot',
)
update_robot_joint_state(
joint_prims: List[Prim],
js: JointState,
timestep: int,
)
static write_motion_gen_log(
result: MotionGenResult,
robot_file: str | RobotConfig,
world_config: None | WorldConfig,
start_state: JointState,
goal_pose: Pose,
save_prefix: str = 'log',
write_ik: bool = False,
write_trajopt: bool = False,
write_graph: bool = False,
goal_object: Obstacle | None = None,
overlay_ik: bool = False,
overlay_trajopt: bool = False,
visualize_robot_spheres: bool = True,
link_spheres: Tensor | None = None,
grid_space: float = 1.0,
write_robot_usd_path='assets/',
robot_asset_prim_path='/panda',
fps: int = 24,
link_poses: Dict[str, Pose] | None = None,
flatten_usd: bool = False,
)