RigidGeom(刚体几何体)#

class genesis.engine.entities.rigid_entity.rigid_geom.RigidGeom(link: RigidLink, idx, cell_start: int, vert_start: int, face_start: int, edge_start: int, verts_state_start: int, mesh: Mesh, type: GEOM_TYPE, friction: float, sol_params, init_pos, init_quat, needs_coup: bool, contype, conaffinity, center_init=None, data=None)[source]#

Bases: RBC

A RigidGeom is the basic building block of a RigidEntity for collision checking. It is usually constructed from a single mesh. This can be accessed via link.geoms.

get_trimesh()[source]#

Get the geom’s trimesh object.

get_sdf_trimesh(color=[1.0, 1.0, 0.6, 1.0])[source]#

Reconstruct trimesh object from sdf.

visualize_sdf(pos=None, T=None, color=(1.0, 1.0, 0.3, 1.0), show_axis=False, axis_color=(1.0, 0.0, 0.0, 1.0), axis_length=0.3, show_boundary=False, boundary_color=(0.0, 1.0, 0.0, 0.2))[source]#

Visualizes the signed distance field (SDF) of the rigid geometry in the viewer.

set_friction(friction)[source]#

Set the friction coefficient of this geometry.

get_pos(envs_idx=None)[source]#

Get the position of the geom in world frame.

get_quat(envs_idx=None)[source]#

Get the quaternion of the geom in world frame.

get_verts()[source]#

Get the vertices of the geom in world frame.

get_AABB()[source]#

Get the axis-aligned bounding box (AABB) of the geom in world frame.

set_sol_params(sol_params)[source]#

Set the solver parameters of this geometry.

property sol_params#

Get the solver parameters of this geometry.

property uid#

Get the unique ID of the geom.

property idx: int#

Get the global index of the geom in RigidSolver.

property type: GEOM_TYPE#

Get the type of the geom.

property friction#

Get the friction coefficient of the geom.

property data#

Get the additional data of the geom.

property metadata#

Get the metadata of the geom.

Get the link that the geom belongs to.

property entity: RigidEntity#

Get the entity that the geom belongs to.

property solver: RigidSolver#

Get the solver that the geom belongs to.s

property is_convex: bool#

Get whether the geom is convex.

property mesh: Mesh#
property needs_coup: bool#

Get whether the geom needs coupling with other non-rigid entities.

property contype: int#

Get the contact type of the geometry for collision pair filtering.

The two geoms are deemed “compatible” (i.e. collisions between them is allowed) if the ‘contype’ of one geom and the ‘conaffinity’ of the other geom have a common bit set to 1, i.e. (geom1.contype & geom2.conaffinity) || (geom2.contype & geom1.conaffinity) == True. This is a powerful mechanism borrowed from Open Dynamics Engine.

property conaffinity: int#

Get the contact affinity of the geometry for collision pair filtering.

See contype documentation for details.

property coup_softness: float#

Get the softness coefficient of the geom for coupling.

property coup_friction: float#

Get the friction coefficient of the geom for coupling.

property coup_restitution: float#

Get the restitution coefficient of the geom for coupling.

property init_pos: ndarray#

Get the initial position of the geom.

property init_quat: ndarray#

Get the initial quaternion of the geom.

property init_verts#

Get the initial vertices of the geom.

property init_faces#

Get the initial faces of the geom.

property init_edges#

Get the initial edges of the geom.

property init_normals#

Get the initial normals of the geom.

property init_center_pos#

Get the initial center position of the geom.

property uvs#

Get the UV coordinates of the geom.

property surface#

Get the surface object of the geom.

property gsd_path#

Get the path to the preprocessed .gsd file.

property sdf_res#

Get the resolution of the geom’s signed distance field (SDF).

property sdf_val#

Get the signed distance field (SDF) of the geom.

property sdf_val_flattened#

Get the flattened signed distance field (SDF) of the geom.

property sdf_grad#

Get the gradient of the geom’s signed distance field (SDF).

property sdf_grad_flattened#

Get the flattened gradient of the geom’s signed distance field (SDF).

property sdf_max#

Get the maximum value of the geom’s signed distance field (SDF).

property sdf_cell_size#

Get the cell size of the geom’s signed distance field (SDF).

property sdf_grad_delta#

Get the delta value for computing the gradient of the geom’s signed distance field (SDF).

property sdf_closest_vert#

Get the closest vertex of each cell of the geom’s signed distance field (SDF).

property sdf_closest_vert_flattened#

Get the flattened closest vertex of each cell of the geom’s signed distance field (SDF).

property T_mesh_to_sdf#

Get the transformation matrix of the geom’s mesh frame w.r.t its signed distance field (SDF) frame.

property n_cells#

Number of cells in the geom’s signed distance field (SDF).

property n_verts: int#

Number of vertices of the geom.

property n_faces: int#

Number of faces of the geom.

property n_edges#

Number of edges of the geom.

property cell_start#

Get the starting index of the cells of the signed distance field (SDF) in the rigid solver.

property vert_start#

Get the starting index of the geom’s vertices in the rigid solver.

property face_start#

Get the starting index of the geom’s faces in the rigid solver.

property edge_start#

Get the starting index of the geom’s edges in the rigid solver.

property verts_state_start#

Get the starting index of the geom’s vertices in the rigid solver.

property cell_end#

Get the ending index of the cells of the signed distance field (SDF) in the rigid solver.

property vert_end#

Get the ending index of the geom’s vertices in the rigid solver.

property verts_state_end#

Get the ending index of the geom’s vertices in the rigid solver.

property face_end#

Get the ending index of the geom’s faces in the rigid solver.

property edge_end#

Get the ending index of the geom’s edges in the rigid solver.

property is_built#

Whether the rigid entity the geom belongs to is built.

property is_free#
property is_fixed: bool#

Whether this geom is fixed in the world.