mani_skill.utils.structs.actor#
Classes#
Wrapper around sapien.Entity objects mixed in with useful properties from the RigidBodyDynamicComponent components |
Module Contents#
- class mani_skill.utils.structs.actor.Actor[source]#
Bases:
mani_skill.utils.structs.base.PhysxRigidDynamicComponentStruct[sapien.Entity]Wrapper around sapien.Entity objects mixed in with useful properties from the RigidBodyDynamicComponent components
At the moment, on GPU and CPU one can query pose, linear velocity, and angular velocity easily
On CPU, more properties are available
- apply_force(force)[source]#
Apply an instantaneous external force to this actor in Newtons to the body’s center of mass. Once called no need to call any gpu_apply_x functions as this handles it for you.
- Parameters:
force (mani_skill.utils.structs.types.Array)
- classmethod create_from_entities(entities, scene, scene_idxs, shared_name=None)[source]#
- Parameters:
entities (list[sapien.Entity])
scene_idxs (torch.Tensor)
shared_name (Optional[str])
- get_collision_meshes(to_world_frame=True, first_only=False)[source]#
Returns the collision mesh of each managed actor object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often. Some actors have no collision meshes, in which case this function returns an empty list.
- Parameters:
to_world_frame (bool) – Whether to transform the collision mesh pose to the world frame
first_only (bool) – Whether to return the collision mesh of just the first actor managed by this object. If True, this also returns a single Trimesh.Mesh object instead of a list. This can be useful for efficiency reasons if you know ahead of time all of the managed actors have the same collision mesh
- Return type:
Union[list[trimesh.Trimesh], trimesh.Trimesh]
- get_first_collision_mesh(to_world_frame=True)[source]#
Returns the collision mesh of the first managed actor object. Note results of this are not cached or optimized at the moment so this function can be slow if called too often. Some actors have no collision meshes, in which case this function returns None
- Parameters:
to_world_frame (bool) – Whether to transform the collision mesh pose to the world frame
- Return type:
Union[trimesh.Trimesh, None]
- hide_visual()[source]#
Hides this actor from view. In CPU simulation the visual body is simply set to visibility 0
For GPU simulation, currently this is implemented by moving the actor very far away as visiblity cannot be changed on the fly. As a result we do not permit hiding and showing visuals of objects with collision shapes as this affects the actual simulation. Note that this operation can also be fairly slow as we need to run px.gpu_apply_rigid_dynamic_data and px.gpu_fetch_rigid_dynamic_data.
- is_static(lin_thresh=0.01, ang_thresh=0.1)[source]#
Checks if this actor is static within the given linear velocity threshold lin_thresh and angular velocity threshold ang_thresh
- classmethod merge(actors, name=None)[source]#
Merge actors together under one view so that they can all be managed by one python dataclass object. This can be useful for e.g. randomizing the asset loaded into a task and being able to do object.pose to fetch the pose of all randomized assets or object.set_pose to change the pose of each of the different assets, despite the assets not being uniform across all sub-scenes.
For example usage of this method, see mani_skill/envs/tasks/pick_single_ycb.py
- Parameters:
actors (list[Actor]) – The actors to merge into one actor object to manage
name (str) – A new name to give the merged actors. If none, the name will default to the first actor’s name
- set_collision_group_bit(group, bit_idx, bit)[source]#
Set’s a specific collision group bit for all collision shapes in all parallel actors
- Parameters:
group (int)
bit_idx (int)
bit (Union[int, bool])
- set_pose(arg1)[source]#
- Parameters:
arg1 (Union[mani_skill.utils.structs.pose.Pose, sapien.Pose])
- Return type:
None
- set_state(state, env_idx=None)[source]#
- Parameters:
state (mani_skill.utils.structs.types.Array)
env_idx (Optional[torch.Tensor])
- initial_pose: mani_skill.utils.structs.pose.Pose = None[source]#
The initial pose of this Actor, as defined when creating the actor via the ActorBuilder. It is necessary to track this pose to ensure the actor is still at the correct pose once gpu system is initialized. It may also be useful to help reset a environment to an initial state without having to manage initial poses yourself
- merged: bool = False[source]#
Whether this object is a view of other actors as a result of Actor.merge
- property per_scene_id[source]#
Returns a int32 torch tensor of the actor level segmentation ID for each managed actor object.
- property pose: mani_skill.utils.structs.pose.Pose[source]#
- Return type: