curobo.geom.types module

class curobo.geom.types.Material(metallic: 'float' = 0.0, roughness: 'float' = 0.4)

Bases: object

Parameters:
  • metallic (float) –

  • roughness (float) –

metallic: float = 0.0
roughness: float = 0.4
class curobo.geom.types.Obstacle(name, pose=None, scale=None, color=None, texture_id=None, texture=None, material=Material(metallic=0.0, roughness=0.4), tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))

Bases: object

Base class for all obstacles.

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

name: str

Unique name of obstacle.

pose: List[float] | None = None

Pose of obstacle as a list with format [x y z qw qx qy qz]

scale: List[float] | None = None

implement scaling for all obstacle types.

Type:

NOTE

color: List[float] | None = None

Color of obstacle to use in visualization.

texture_id: str | None = None

texture to apply to obstacle in visualization.

texture: str | None = None

texture to apply to obstacle in visualization.

material: Material = Material(metallic=0.0, roughness=0.4)

material properties to apply in visualization.

tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32)
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

save_as_mesh(file_path, transform_with_pose=False)
Parameters:
  • file_path (str) –

  • transform_with_pose (bool) –

get_cuboid()

Get oriented bounding box of obstacle (OBB).

Returns:

returns obstacle as a cuboid.

Return type:

Cuboid

get_mesh(process=True)

Get obstacle as a mesh.

Parameters:

process (bool, optional) – process mesh from file. Defaults to True.

Returns:

obstacle as a mesh.

Return type:

Mesh

get_transform_matrix()

Get homogenous transformation matrix from pose.

Returns:

transformation matrix.

Return type:

np.ndarray

get_sphere(n=1)

Compute a sphere that fits in the volume of the object.

Parameters:

n (int) – number of spheres

Returns:

spheres

Return type:

Sphere

get_bounding_spheres(n_spheres=1, surface_sphere_radius=0.002, fit_type=SphereFitType.VOXEL_VOLUME_SAMPLE_SURFACE, voxelize_method='ray', pre_transform_pose=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))

Compute n spheres that fits in the volume of the object.

Parameters:
  • n – number of spheres

  • n_spheres (int) –

  • surface_sphere_radius (float) –

  • fit_type (SphereFitType) –

  • voxelize_method (str) –

  • pre_transform_pose (Pose | None) –

  • tensor_args (TensorDeviceType) –

Returns:

spheres

Return type:

List[Sphere]

class curobo.geom.types.Cuboid(name, pose=None, scale=None, color=None, texture_id=None, texture=None, material=Material(metallic=0.0, roughness=0.4), tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), dims=<factory>)

Bases: Obstacle

Represent obstacle as a cuboid.

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • dims (List[float]) –

dims: List[float]

Dimensions of cuboid in meters [x_length, y_length, z_length].

get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

class curobo.geom.types.Capsule(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'Optional[List[float]]' = None, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), radius: 'float' = 0.0, base: 'List[float]' = <factory>, tip: 'List[float]' = <factory>)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • radius (float) –

  • base (List[float]) –

  • tip (List[float]) –

radius: float = 0.0
base: List[float]
tip: List[float]
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

class curobo.geom.types.Cylinder(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'Optional[List[float]]' = None, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), radius: 'float' = 0.0, height: 'float' = 0.0)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • radius (float) –

  • height (float) –

radius: float = 0.0
height: float = 0.0
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

class curobo.geom.types.Sphere(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'Optional[List[float]]' = None, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), radius: 'float' = 0.0, position: 'Optional[List[float]]' = None)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • radius (float) –

  • position (List[float] | None) –

radius: float = 0.0
position: List[float] | None = None

position is deprecated, use pose instead

get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

get_cuboid()

Get oriented bounding box of obstacle (OBB).

Returns:

returns obstacle as a cuboid.

Return type:

Cuboid

class curobo.geom.types.Mesh(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'Optional[List[float]]' = None, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), file_path: 'Optional[str]' = None, file_string: 'Optional[str]' = None, urdf_path: 'Optional[str]' = None, vertices: 'Optional[List[List[float]]]' = None, faces: 'Optional[List[int]]' = None, vertex_colors: 'Optional[List[List[float]]]' = None, vertex_normals: 'Optional[List[List[float]]]' = None, face_colors: 'Optional[List[List[float]]]' = None)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • file_path (str | None) –

  • file_string (str | None) –

  • urdf_path (str | None) –

  • vertices (List[List[float]] | None) –

  • faces (List[int] | None) –

  • vertex_colors (List[List[float]] | None) –

  • vertex_normals (List[List[float]] | None) –

  • face_colors (List[List[float]] | None) –

file_path: str | None = None
file_string: str | None = None
urdf_path: str | None = None
vertices: List[List[float]] | None = None
faces: List[int] | None = None
vertex_colors: List[List[float]] | None = None
vertex_normals: List[List[float]] | None = None
face_colors: List[List[float]] | None = None
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

update_material()
get_mesh_data(process=True)
Parameters:

process (bool) –

static from_pointcloud(pointcloud, pitch=0.02, name='world_pc', pose=[0, 0, 0, 1, 0, 0, 0], filter_close_points=0.0)
Parameters:
  • pointcloud (ndarray) –

  • pitch (float) –

  • pose (List[float]) –

  • filter_close_points (float) –

class curobo.geom.types.BloxMap(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'List[float]' = <factory>, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), map_path: 'Optional[str]' = None, voxel_size: 'float' = 0.02, integrator_type: 'str' = 'tsdf', mesh_file_path: 'Optional[str]' = None, mapper_instance: 'Any' = None, mesh: 'Optional[Mesh]' = None)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float]) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • map_path (str | None) –

  • voxel_size (float) –

  • integrator_type (str) –

  • mesh_file_path (str | None) –

  • mapper_instance (Any) –

  • mesh (Mesh | None) –

map_path: str | None = None
voxel_size: float = 0.02
integrator_type: str = 'tsdf'

[“tsdf”, “occupancy”]

Type:

integrator type to use in nvblox. Options

mesh_file_path: str | None = None
mapper_instance: Any = None
mesh: Mesh | None = None
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

class curobo.geom.types.PointCloud(name: 'str', pose: 'Optional[List[float]]' = None, scale: 'Optional[List[float]]' = None, color: 'Optional[List[float]]' = None, texture_id: 'Optional[str]' = None, texture: 'Optional[str]' = None, material: 'Material' = Material(metallic=0.0, roughness=0.4), tensor_args: 'TensorDeviceType' = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), points: 'Union[torch.Tensor, np.ndarray, List[List[float]]]' = None, points_features: 'Union[torch.Tensor, np.ndarray, List[List[float]], None]' = None)

Bases: Obstacle

Parameters:
  • name (str) –

  • pose (List[float] | None) –

  • scale (List[float] | None) –

  • color (List[float] | None) –

  • texture_id (str | None) –

  • texture (str | None) –

  • material (Material) –

  • tensor_args (TensorDeviceType) –

  • points (Tensor | ndarray | List[List[float]]) –

  • points_features (Tensor | ndarray | List[List[float]] | None) –

points: Tensor | ndarray | List[List[float]] = None
points_features: Tensor | ndarray | List[List[float]] | None = None
get_trimesh_mesh(process=True, process_color=True)

Create a trimesh instance from the obstacle representation.

Parameters:
  • process (bool, optional) – process when loading from file. Defaults to True.

  • process_color (bool) –

Raises:

NotImplementedError – requires implementation in derived class.

Returns:

instance of obstacle as a trimesh.

Return type:

trimesh.Trimesh

get_mesh_data(process=True)
Parameters:

process (bool) –

static from_camera_observation(camera_obs, name='pc_obstacle', pose=None)
Parameters:
get_bounding_spheres(n_spheres=1, surface_sphere_radius=0.002, fit_type=SphereFitType.VOXEL_VOLUME_SAMPLE_SURFACE, voxelize_method='ray', pre_transform_pose=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))

Compute n spheres that fits in the volume of the object.

Parameters:
  • n – number of spheres

  • n_spheres (int) –

  • surface_sphere_radius (float) –

  • fit_type (SphereFitType) –

  • voxelize_method (str) –

  • pre_transform_pose (Pose | None) –

  • tensor_args (TensorDeviceType) –

Returns:

spheres

Return type:

List[Sphere]

class curobo.geom.types.WorldConfig(sphere=None, cuboid=None, capsule=None, cylinder=None, mesh=None, blox=None, objects=None)

Bases: Sequence

Representation of World for use in CuRobo.

Parameters:
  • sphere (List[Sphere] | None) –

  • cuboid (List[Cuboid] | None) –

  • capsule (List[Capsule] | None) –

  • cylinder (List[Cylinder] | None) –

  • mesh (List[Mesh] | None) –

  • blox (List[BloxMap] | None) –

  • objects (List[Obstacle] | None) –

sphere: List[Sphere] | None = None

List of Sphere obstacles.

cuboid: List[Cuboid] | None = None

List of Cuboid obstacles.

capsule: List[Capsule] | None = None

List of Capsule obstacles.

cylinder: List[Cylinder] | None = None

List of Cylinder obstacles.

mesh: List[Mesh] | None = None

List of Mesh obstacles.

blox: List[BloxMap] | None = None

BloxMap obstacle.

objects: List[Obstacle] | None = None

List of all obstacles in world.

clone()
static from_dict(data_dict)
Parameters:

data_dict (Dict[str, Any]) –

Return type:

WorldConfig

static create_obb_world(current_world)
Parameters:

current_world (WorldConfig) –

static create_mesh_world(current_world, process=False)
Parameters:
static create_collision_support_world(current_world, process=True)
Parameters:
static get_scene_graph(current_world, process_color=True)
Parameters:
  • current_world (WorldConfig) –

  • process_color (bool) –

static create_merged_mesh_world(current_world, process=True, process_color=True)
Parameters:
  • current_world (WorldConfig) –

  • process (bool) –

  • process_color (bool) –

get_obb_world()
get_mesh_world(merge_meshes=False, process=False)
Parameters:
  • merge_meshes (bool) –

  • process (bool) –

get_collision_check_world(mesh_process=False)
Parameters:

mesh_process (bool) –

save_world_as_mesh(file_path, save_as_scene_graph=False, process_color=True)
Parameters:
  • file_path (str) –

  • process_color (bool) –

get_cache_dict()

Computes the number of obstacles in each type

Returns:

_description_

Return type:

Dict[str, int]

add_obstacle(obstacle)
Parameters:

obstacle (Obstacle) –

randomize_color(r=[0, 1], g=[0, 1], b=[0, 1])

Randomize color of objects within the given range

Parameters:
  • r – _description_. Defaults to [0,1].

  • g – _description_. Defaults to [0,1].

  • b – _description_. Defaults to [0,1].

Returns:

_description_

add_color(rgba=[0.0, 0.0, 0.0, 1.0])
add_material(material=Material(metallic=0.0, roughness=0.4))
get_obstacle(name)
Parameters:

name (str) –

Return type:

None | Obstacle

remove_obstacle(name)
Parameters:

name (str) –

remove_absolute_paths()
Return type:

WorldConfig

_abc_impl = <_abc._abc_data object>
curobo.geom.types.tensor_sphere(pt, radius, tensor=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))
curobo.geom.types.tensor_capsule(base, tip, radius, tensor=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))
curobo.geom.types.tensor_cube(pose, dims, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))
Parameters:
  • pose (_type_) – x,y,z, qw,qx,qy,qz

  • dims (_type_) – _description_

  • tensor_args (_type_, optional) – _description_. Defaults to TensorDeviceType().

Returns:

_description_

Return type:

_type_

curobo.geom.types.batch_tensor_cube(pose, dims, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32))
Parameters:
  • pose (_type_) – x,y,z, qw,qx,qy,qz

  • dims (_type_) – _description_

  • tensor_args (_type_, optional) – _description_. Defaults to TensorDeviceType().

Returns:

_description_

Return type:

_type_