HybridEntity(混合实体)#
- class genesis.engine.entities.hybrid_entity.HybridEntity(idx, scene, material, morph, surface, name: str | None = None)[source]#
Bases:
EntityA hybrid simulation entity composed of both rigid and soft components.
This class encapsulates logic for initializing, coupling, and simulating a physically hybrid object that has rigid bodies (e.g., from URDF or meshes) and soft materials (e.g., MPM). The coupling allows for bi-directional force and motion interaction between the rigid and soft parts during simulation.
- Parameters:
idx (int) – The index of the entity within the scene.
scene (genesis.Scene) – The simulation scene where the entity is added.
material (genesis.materials.Hybrid) – The hybrid material that includes both rigid and soft sub-materials, and defines coupling behavior.
morph (genesis.morphs.Morph) – The shape/morphology of the entity. Must be either a URDF or Mesh.
surface (genesis.surfaces.Surface) – The surface properties applied to the soft part of the entity.
- get_dofs_position(*args, **kwargs)[source]#
Get the current generalized coordinates (positions) of the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s get_dofs_position method.
**kwargs – Passed directly to the rigid entity’s get_dofs_position method.
- Returns:
A tensor containing the position values of the rigid body’s degrees of freedom.
- Return type:
gs.Tensor
- get_dofs_velocity(*args, **kwargs)[source]#
Get the current generalized velocities of the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s get_dofs_velocity method.
**kwargs – Passed directly to the rigid entity’s get_dofs_velocity method.
- Returns:
A tensor containing the velocity values of the rigid body’s degrees of freedom.
- Return type:
gs.Tensor
- get_dofs_force(*args, **kwargs)[source]#
Get the current generalized forces applied on the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s get_dofs_force method.
**kwargs – Passed directly to the rigid entity’s get_dofs_force method.
- Returns:
A tensor representing forces acting on the rigid body’s degrees of freedom.
- Return type:
gs.Tensor
- get_dofs_control_force(*args, **kwargs)[source]#
Get the control forces currently applied to the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s get_dofs_control_force method.
**kwargs – Passed directly to the rigid entity’s get_dofs_control_force method.
- Returns:
A tensor containing the control force values for the rigid body’s degrees of freedom.
- Return type:
gs.Tensor
- set_dofs_velocity(*args, **kwargs)[source]#
Set the generalized velocities for the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s set_dofs_velocity method.
**kwargs – Passed directly to the rigid entity’s set_dofs_velocity method.
- set_dofs_force(*args, **kwargs)[source]#
Set the generalized forces for the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s set_dofs_force method.
**kwargs – Passed directly to the rigid entity’s set_dofs_force method.
- control_dofs_position(*args, **kwargs)[source]#
Apply position control to the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s control_dofs_position method.
**kwargs – Passed directly to the rigid entity’s control_dofs_position method.
- Returns:
Control output for position adjustment of the rigid body’s DOFs.
- Return type:
gs.Tensor
- control_dofs_position_velocity(*args, **kwargs)[source]#
Apply position control to the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s control_dofs_position method.
**kwargs – Passed directly to the rigid entity’s control_dofs_position method.
- Returns:
Control output for position adjustment of the rigid body’s DOFs.
- Return type:
gs.Tensor
- control_dofs_velocity(*args, **kwargs)[source]#
Apply velocity control to the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s control_dofs_velocity method.
**kwargs – Passed directly to the rigid entity’s control_dofs_velocity method.
- Returns:
Control output for velocity adjustment of the rigid body’s DOFs.
- Return type:
gs.Tensor
- control_dofs_force(*args, **kwargs)[source]#
Apply force control to the rigid part of the hybrid entity.
- Parameters:
*args – Passed directly to the rigid entity’s control_dofs_force method.
**kwargs – Passed directly to the rigid entity’s control_dofs_force method.
- Returns:
Control output for force adjustment of the rigid body’s DOFs.
- Return type:
gs.Tensor
- update_soft_part(f)[source]#
Update the state of the soft part of the hybrid entity based on the current simulation frame.
- Parameters:
f (int) – The current simulation frame index.
- property n_dofs: int#
The number of degrees of freedom of the hybrid entity (inherited from the rigid part).
- property fixed: bool#
Check whether the hybrid entity is fixed in space (inherited from the rigid morph).
- property part_rigid#
The rigid part of the hybrid entity.
- property part_soft#
The soft part of the hybrid entity.
- property solver_rigid#
The solver associated with the rigid part of the hybrid entity.
- property solver_soft#
The solver associated with the soft part of the hybrid entity.