Isaac Cloner [omni.isaac.cloner]

Base Cloner

class Cloner(stage: Optional[pxr.Usd.Stage] = None)

This class provides a set of simple APIs to make duplication of objects simple. Objects can be cloned using this class to create copies of the same object, placed at user-specified locations in the scene.

Note that the cloning process is performed in a for-loop, so performance should be expected to follow linear scaling with an increase of clones.

clone(source_prim_path: str, prim_paths: List[str], positions: Optional[Union[numpy.ndarray, torch.Tensor]] = None, orientations: Optional[Union[numpy.ndarray, torch.Tensor]] = None, replicate_physics: bool = False, base_env_path: Optional[str] = None, root_path: Optional[str] = None, copy_from_source: bool = False)
Clones a source prim at user-specified destination paths.

Clones will be placed at user-specified positions and orientations.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • positions (Union[np.ndarray, torch.Tensor]) – An array containing target positions of clones. Dimension must equal length of prim_paths. Defaults to None. Clones will be placed at (0, 0, 0) if not specified.

  • orientations (Union[np.ndarray, torch.Tensor]) – An array containing target orientations of clones. Dimension must equal length of prim_paths. Defaults to None. Clones will have identity orientation (1, 0, 0, 0) if not specified.

  • replicate_physics (bool) – Uses omni.physics replication. This will replicate physics properties directly for paths beginning with root_path and skip physics parsing for anything under the base_env_path.

  • base_env_path (str) – Path to namespace for all environments. Required if replicate_physics=True and define_base_env() not called.

  • root_path (str) – Prefix path for each environment. Required if replicate_physics=True and generate_paths() not called.

  • copy_from_source – (bool): Setting this to False will inherit all clones from the source prim; any changes made to the source prim will be reflected in the clones. Setting this to True will make copies of the source prim when creating new clones; changes to the source prim will not be reflected in clones. Defaults to False. Note that setting this to True will take longer to execute.

Raises

Exception – Raises exception if source prim path is not valid.

define_base_env(base_env_path: str)

Creates a USD Scope at base_env_path. This is designed to be the parent that holds all clones.

Parameters

base_env_path (str) – Path to create the USD Scope at.

filter_collisions(physicsscene_path: str, collision_root_path: str, prim_paths: List[str], global_paths: List[str] = [])

Filters collisions between clones. Clones will not collide with each other, but can collide with objects specified in global_paths.

Parameters
  • physicsscene_path (str) – Path to PhysicsScene object in stage.

  • collision_root_path (str) – Path to place collision groups under.

  • prim_paths (List[str]) – Paths of objects to filter out collision.

  • global_paths (List[str]) – Paths of objects to generate collision (e.g. ground plane).

generate_paths(root_path: str, num_paths: int)

Generates a list of paths under the root path specified.

Parameters
  • root_path (str) – Base path where new paths will be created under.

  • num_paths (int) – Number of paths to generate.

Returns

A list of paths

Return type

paths (List[str])

replicate_physics(source_prim_path: str, prim_paths: list, base_env_path: str, root_path: str)

Replicates physics properties directly in omni.physics to avoid performance bottlenecks when parsing physics.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • base_env_path (str) – Path to namespace for all environments.

  • root_path (str) – Prefix path for each environment.

Raises

Exception – Raises exception if base_env_path is None or root_path is None.

get_physx_replicator_interface() omni.physx.bindings._physx.IPhysxReplicator
get_physx_simulation_interface() omni.physx.bindings._physx.IPhysxSimulation

Grid Cloner

class Cloner(stage: Optional[pxr.Usd.Stage] = None)

This class provides a set of simple APIs to make duplication of objects simple. Objects can be cloned using this class to create copies of the same object, placed at user-specified locations in the scene.

Note that the cloning process is performed in a for-loop, so performance should be expected to follow linear scaling with an increase of clones.

clone(source_prim_path: str, prim_paths: List[str], positions: Optional[Union[numpy.ndarray, torch.Tensor]] = None, orientations: Optional[Union[numpy.ndarray, torch.Tensor]] = None, replicate_physics: bool = False, base_env_path: Optional[str] = None, root_path: Optional[str] = None, copy_from_source: bool = False)
Clones a source prim at user-specified destination paths.

Clones will be placed at user-specified positions and orientations.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • positions (Union[np.ndarray, torch.Tensor]) – An array containing target positions of clones. Dimension must equal length of prim_paths. Defaults to None. Clones will be placed at (0, 0, 0) if not specified.

  • orientations (Union[np.ndarray, torch.Tensor]) – An array containing target orientations of clones. Dimension must equal length of prim_paths. Defaults to None. Clones will have identity orientation (1, 0, 0, 0) if not specified.

  • replicate_physics (bool) – Uses omni.physics replication. This will replicate physics properties directly for paths beginning with root_path and skip physics parsing for anything under the base_env_path.

  • base_env_path (str) – Path to namespace for all environments. Required if replicate_physics=True and define_base_env() not called.

  • root_path (str) – Prefix path for each environment. Required if replicate_physics=True and generate_paths() not called.

  • copy_from_source – (bool): Setting this to False will inherit all clones from the source prim; any changes made to the source prim will be reflected in the clones. Setting this to True will make copies of the source prim when creating new clones; changes to the source prim will not be reflected in clones. Defaults to False. Note that setting this to True will take longer to execute.

Raises

Exception – Raises exception if source prim path is not valid.

define_base_env(base_env_path: str)

Creates a USD Scope at base_env_path. This is designed to be the parent that holds all clones.

Parameters

base_env_path (str) – Path to create the USD Scope at.

filter_collisions(physicsscene_path: str, collision_root_path: str, prim_paths: List[str], global_paths: List[str] = [])

Filters collisions between clones. Clones will not collide with each other, but can collide with objects specified in global_paths.

Parameters
  • physicsscene_path (str) – Path to PhysicsScene object in stage.

  • collision_root_path (str) – Path to place collision groups under.

  • prim_paths (List[str]) – Paths of objects to filter out collision.

  • global_paths (List[str]) – Paths of objects to generate collision (e.g. ground plane).

generate_paths(root_path: str, num_paths: int)

Generates a list of paths under the root path specified.

Parameters
  • root_path (str) – Base path where new paths will be created under.

  • num_paths (int) – Number of paths to generate.

Returns

A list of paths

Return type

paths (List[str])

replicate_physics(source_prim_path: str, prim_paths: list, base_env_path: str, root_path: str)

Replicates physics properties directly in omni.physics to avoid performance bottlenecks when parsing physics.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • base_env_path (str) – Path to namespace for all environments.

  • root_path (str) – Prefix path for each environment.

Raises

Exception – Raises exception if base_env_path is None or root_path is None.

class GridCloner(spacing: float, num_per_row: int = - 1, stage: Optional[pxr.Usd.Stage] = None)

This is a specialized Cloner class that will automatically generate clones in a grid fashion.

clone(source_prim_path: str, prim_paths: List[str], position_offsets: Optional[numpy.ndarray] = None, orientation_offsets: Optional[numpy.ndarray] = None, replicate_physics: bool = False, base_env_path: Optional[str] = None, root_path: Optional[str] = None, copy_from_source: bool = False)

Creates clones in a grid fashion. Positions of clones are computed automatically.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • position_offsets (np.ndarray) – Positions to be applied as local translations on top of computed clone position. Defaults to None, no offset will be applied.

  • orientation_offsets (np.ndarray) – Orientations to be applied as local rotations for each clone. Defaults to None, no offset will be applied.

  • replicate_physics (bool) – Uses omni.physics replication. This will replicate physics properties directly for paths beginning with root_path and skip physics parsing for anything under the base_env_path.

  • base_env_path (str) – Path to namespace for all environments. Required if replicate_physics=True and define_base_env() not called.

  • root_path (str) – Prefix path for each environment. Required if replicate_physics=True and generate_paths() not called.

  • copy_from_source – (bool): Setting this to False will inherit all clones from the source prim; any changes made to the source prim will be reflected in the clones. Setting this to True will make copies of the source prim when creating new clones; changes to the source prim will not be reflected in clones. Defaults to False. Note that setting this to True will take longer to execute.

Returns

Computed positions of all clones.

Return type

positions (List)

define_base_env(base_env_path: str)

Creates a USD Scope at base_env_path. This is designed to be the parent that holds all clones.

Parameters

base_env_path (str) – Path to create the USD Scope at.

filter_collisions(physicsscene_path: str, collision_root_path: str, prim_paths: List[str], global_paths: List[str] = [])

Filters collisions between clones. Clones will not collide with each other, but can collide with objects specified in global_paths.

Parameters
  • physicsscene_path (str) – Path to PhysicsScene object in stage.

  • collision_root_path (str) – Path to place collision groups under.

  • prim_paths (List[str]) – Paths of objects to filter out collision.

  • global_paths (List[str]) – Paths of objects to generate collision (e.g. ground plane).

generate_paths(root_path: str, num_paths: int)

Generates a list of paths under the root path specified.

Parameters
  • root_path (str) – Base path where new paths will be created under.

  • num_paths (int) – Number of paths to generate.

Returns

A list of paths

Return type

paths (List[str])

get_clone_transforms(num_clones: int, position_offsets: Optional[numpy.ndarray] = None, orientation_offsets: Optional[numpy.ndarray] = None)

Computes the positions and orientations of clones in a grid.

Parameters
  • num_clones (int) – Number of clones.

  • position_offsets (np.ndarray | torch.Tensor) – Positions to be applied as local translations on top of computed clone position.

  • position_offsets – Positions to be applied as local translations on top of computed clone position. Defaults to None, no offset will be applied.

  • orientation_offsets (np.ndarray | torch.Tensor) – Orientations to be applied as local rotations for each clone. Defaults to None, no offset will be applied.

Returns

Computed positions of all clones. orientations (List): Computed orientations of all clones.

Return type

positions (List)

replicate_physics(source_prim_path: str, prim_paths: list, base_env_path: str, root_path: str)

Replicates physics properties directly in omni.physics to avoid performance bottlenecks when parsing physics.

Parameters
  • source_prim_path (str) – Path of source object.

  • prim_paths (List[str]) – List of destination paths.

  • base_env_path (str) – Path to namespace for all environments.

  • root_path (str) – Prefix path for each environment.

Raises

Exception – Raises exception if base_env_path is None or root_path is None.