embodichain.lab.sim.shapes#
Overview#
Geometry configuration objects used to build collision, visual, and deformable
simulation shapes. ShapeCfg is the common base; MeshCfg,
CubeCfg, and SphereCfg describe triangle-mesh, box, and
sphere primitives respectively. MeshCollisionCfg explicitly selects
the collision representation and its cooking settings, while
LoadOption controls mesh loading.
MeshCfg accepts either a file path or explicit vertex/triangle arrays; for
surface deformables, the array-backed form preserves node order for particle
flags and kinematic trajectories. Volume deformables generate a separate
tetrahedral simulation mesh during voxelization.
Type aliases
|
Supported collision representations for a triangle mesh. |
Classes
Configuration parameters for a cube shape. |
|
LoadOption(rebuild_normals: 'bool' = <factory>, rebuild_tangent: 'bool' = <factory>, rebuild_3rdnormal: 'bool' = <factory>, rebuild_3rdtangent: 'bool' = <factory>, smooth: 'float' = <factory>, gltfloader: 'bool' = <factory>) |
|
Collision-geometry construction for |
|
Configuration parameters for a triangle mesh shape. |
|
ShapeCfg(shape_type: 'str' = <factory>, visual_material: 'VisualMaterialCfg | None' = <factory>) |
|
Configuration parameters for a sphere shape. |
- class embodichain.lab.sim.shapes.ShapeCfg[source]#
Bases:
objectShapeCfg(shape_type: ‘str’ = <factory>, visual_material: ‘VisualMaterialCfg | None’ = <factory>)
Methods:
from_dict(init_dict)Initialize the configuration from a dictionary.
Attributes:
Type of the shape.
Configuration parameters for the visual material of the shape.
- classmethod from_dict(init_dict)[source]#
Initialize the configuration from a dictionary.
- Return type:
-
shape_type:
str# Type of the shape. Must be specified in subclasses.
-
visual_material:
VisualMaterialCfg|None# Configuration parameters for the visual material of the shape. Defaults to None.
- class embodichain.lab.sim.shapes.MeshCfg[source]#
Bases:
ShapeCfgConfiguration parameters for a triangle mesh shape.
Attributes:
Optional collision representation and cooking parameters.
Whether to compute UV coordinates for the shape.
File path to the shape mesh file.
Options for loading and processing the shape.
Optional per-vertex normals with shape
(N, 3).Direction to project the UV coordinates.
Type of the shape.
Optional array-backed triangle indices with shape
(M, 3).Optional per-vertex texture coordinates with shape
(N, 2).Optional array-backed mesh vertices with shape
(N, 3).Configuration parameters for the visual material of the shape.
-
collision:
MeshCollisionCfg|None# Optional collision representation and cooking parameters.
Noneuses a single convex hull. Mesh collision construction belongs to the geometry because it cannot be applied meaningfully to primitive shapes or to articulation links without a named source-shape overlay.
-
compute_uv:
bool# Whether to compute UV coordinates for the shape. Defaults to False.
If the shape already has UV coordinates, setting this to True will recompute and overwrite them.
-
fpath:
str|None# File path to the shape mesh file.
-
load_option:
LoadOption# Options for loading and processing the shape.
-
normals:
Union[Sequence[Sequence[float]],ndarray,None]# Optional per-vertex normals with shape
(N, 3).
-
project_direction:
List[float]# Direction to project the UV coordinates. Defaults to [1.0, 1.0, 1.0].
-
shape_type:
str# Type of the shape. Must be specified in subclasses.
-
triangles:
Union[Sequence[Sequence[int]],ndarray,None]# Optional array-backed triangle indices with shape
(M, 3).
-
uv_coords:
Union[Sequence[Sequence[float]],ndarray,None]# Optional per-vertex texture coordinates with shape
(N, 2).
-
vertices:
Union[Sequence[Sequence[float]],ndarray,None]# Optional array-backed mesh vertices with shape
(N, 3).Array-backed meshes preserve vertex order, which is useful when per-node deformable flags or kinematic trajectories refer to stable node indices.
-
visual_material:
VisualMaterialCfg|None# Configuration parameters for the visual material of the shape. Defaults to None.
-
collision:
- class embodichain.lab.sim.shapes.MeshCollisionCfg[source]#
Bases:
objectCollision-geometry construction for
MeshCfg.The approximation is explicit. Strategy-specific fields are rejected when they do not apply, so changing a numerical cooking value cannot silently select a different collision representation.
Attributes:
Approximate-convex-decomposition implementation.
Collision representation built from the source triangle mesh.
Whether Newton uses the generated SDF for hydroelastic contact.
Deprecated compatibility view of
max_hulls.Maximum hull count for
convex_decomposition; must be at least two.Inner and outer signed-distance limits of the Newton SDF band [m].
Extra padding used while Newton builds the mesh SDF [m].
Maximum SDF grid resolution; valid only for the
sdfstrategy.Target Newton sparse-SDF voxel size [m], alternative to resolution.
Newton SDF voxel storage format.
Methods:
from_dict(init_dict)Parse a mesh-collision mapping, including deprecated field names.
-
acd_method:
Optional[Literal['visacd','coacd','vhacd']]# Approximate-convex-decomposition implementation.
Noneselectsvisacdwhen compiling mesh collision geometry. VisACD requires a DexSim build with CUDA/OptiX support.
-
approximation:
Literal['convex_hull','convex_decomposition','triangle_mesh','sdf']# Collision representation built from the source triangle mesh.
- classmethod from_dict(init_dict)[source]#
Parse a mesh-collision mapping, including deprecated field names.
- Return type:
-
is_hydroelastic:
bool|None# Whether Newton uses the generated SDF for hydroelastic contact.
-
max_hulls:
int|None# Maximum hull count for
convex_decomposition; must be at least two.
-
sdf_narrow_band_range:
tuple[float,float] |None# Inner and outer signed-distance limits of the Newton SDF band [m].
-
sdf_padding:
float|None# Extra padding used while Newton builds the mesh SDF [m].
-
sdf_resolution:
int|None# Maximum SDF grid resolution; valid only for the
sdfstrategy.
-
sdf_target_voxel_size:
float|None# Target Newton sparse-SDF voxel size [m], alternative to resolution.
-
sdf_texture_format:
Optional[Literal['uint16','float32','uint8']]# Newton SDF voxel storage format.
-
acd_method:
- class embodichain.lab.sim.shapes.CubeCfg[source]#
Bases:
ShapeCfgConfiguration parameters for a cube shape.
Attributes:
Type of the shape.
Size of the cube (in m) as [length, width, height].
Configuration parameters for the visual material of the shape.
-
shape_type:
str# Type of the shape. Must be specified in subclasses.
-
size:
List[float]# Size of the cube (in m) as [length, width, height].
-
visual_material:
VisualMaterialCfg|None# Configuration parameters for the visual material of the shape. Defaults to None.
-
shape_type:
- class embodichain.lab.sim.shapes.SphereCfg[source]#
Bases:
ShapeCfgConfiguration parameters for a sphere shape.
Attributes:
Radius of the sphere (in m).
Resolution of the sphere mesh.
Type of the shape.
Configuration parameters for the visual material of the shape.
-
radius:
float# Radius of the sphere (in m).
-
resolution:
int# Resolution of the sphere mesh. Defaults to 20.
-
shape_type:
str# Type of the shape. Must be specified in subclasses.
-
visual_material:
VisualMaterialCfg|None# Configuration parameters for the visual material of the shape. Defaults to None.
-
radius:
- class embodichain.lab.sim.shapes.LoadOption[source]#
Bases:
objectLoadOption(rebuild_normals: ‘bool’ = <factory>, rebuild_tangent: ‘bool’ = <factory>, rebuild_3rdnormal: ‘bool’ = <factory>, rebuild_3rdtangent: ‘bool’ = <factory>, smooth: ‘float’ = <factory>, gltfloader: ‘bool’ = <factory>)
Methods:
__init__([rebuild_normals, rebuild_tangent, ...])copy(**kwargs)Return a new object replacing specified fields with new values.
from_dict(init_dict)Initialize the configuration from a dictionary.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
Attributes:
Whether to force DexSim's glTF loader.
Whether to rebuild the normal for the shape using 3rd party library.
Whether to rebuild the tangent for the shape using 3rd party library.
Whether to rebuild normals for the shape.
Whether to rebuild tangents for the shape.
Angle threshold (in degrees) for smoothing normals.
- __init__(rebuild_normals=<factory>, rebuild_tangent=<factory>, rebuild_3rdnormal=<factory>, rebuild_3rdtangent=<factory>, smooth=<factory>, gltfloader=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- classmethod from_dict(init_dict)[source]#
Initialize the configuration from a dictionary.
- Return type:
-
gltfloader:
bool# Whether to force DexSim’s glTF loader. Defaults to False.
-
rebuild_3rdnormal:
bool# Whether to rebuild the normal for the shape using 3rd party library. Defaults to False.
-
rebuild_3rdtangent:
bool# Whether to rebuild the tangent for the shape using 3rd party library. Defaults to False.
-
rebuild_normals:
bool# Whether to rebuild normals for the shape. Defaults to False.
-
rebuild_tangent:
bool# Whether to rebuild tangents for the shape. Defaults to False.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
-
smooth:
float# Angle threshold (in degrees) for smoothing normals. Defaults to -1.0 (no smoothing).
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores all names starting with “__” (i.e. built-in methods).
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[str,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.