-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Accessing and Modifying Actor Scales During Simulation #593
Comments
Modifying collision shapes at runtime (after loading the objects and starting the gpu simulation) is not possible at the moment. Therefore they cannot be changed during an environment reset. You can however with GPU simulation generate a ton of parallel environments each with different scales for the actors and maybe that will be sufficient randomization. If that is not enough, you can turn on the reconfiguration frequency (set reconfiguration_freq >= 1), which essentially destroys all objects and allows you to recreate them but with new actor scales With GPU sim you will need to iterate over each the |
Is it possible to extend the SAPIEN API to support batched properties? This would be useful for domain randomization. For example, consider the current @dataclass
class CollisionShapeRecord:
type: Literal[
"convex_mesh",
"multiple_convex_meshes",
"nonconvex_mesh",
"plane",
"box",
"capsule",
"sphere",
"cylinder",
]
# for mesh type
filename: str = ""
# mesh & box
scale: Tuple = (1, 1, 1)
# circle & capsule
radius: float = 1
# capsule
length: float = 1
material: Union[sapien.physx.PhysxMaterial, None] = None
pose: sapien.Pose = sapien.Pose()
density: float = 1000
patch_radius: float = 0
min_patch_radius: float = 0
is_trigger: bool = False
decomposition: str = "none"
decomposition_params: Union[Dict[str, Any], None] = None And the current class PhysxMaterial:
dynamic_friction: float
restitution: float
static_friction: float Would it be possible to modify class PhysxMaterial:
dynamic_friction: float | torch.Tensor
restitution: float | torch.Tensor
static_friction: float | torch.Tensor
@dataclass
class CollisionShapeRecord:
type: Literal[
"convex_mesh",
"multiple_convex_meshes",
"nonconvex_mesh",
"plane",
"box",
"capsule",
"sphere",
"cylinder",
]
# for mesh type
filename: str = ""
# mesh & box
scale: Tuple | torch.Tensor = (1, 1, 1)
# circle & capsule
radius: float | torch.Tensor = 1
# capsule
length: float | torch.Tensor = 1
material: Union[sapien.physx.PhysxMaterial, None] = None
pose: sapien.Pose = sapien.Pose()
density: float | torch.Tensor = 1000
patch_radius: float = 0
min_patch_radius: float = 0
is_trigger: bool = False
decomposition: str = "none"
decomposition_params: Union[Dict[str, Any], None] = None Additionally, could
|
I see the use case and it would be really useful to do more batch randomizations (textures can also be given the same treatment, currently the way it is done is not as convenient). What would you prefer most as an API for this? When building a task (I imagine the randomization must occur during the _load_scene function). We can change the API in maniskill to support more batched like convenience operations to avoid users writing for loops and simply supplying a batched array which may be easier to understand/read. SAPIEN's API will very likely remain the same without batched APIs. Between maintainers this is what we decided was best (SAPIEN is the most low-level of the python APIs for very intricate control over the simulation setup and ManiSkill is prebuilt / simplified APIs for fast iteration and ML workflows) |
Thank you! Below is my idea on how to change the API: Modify
|
I am looking to adjust the scales of actors when an environment is reset. I have identified where the properties for entities in subscenes are specified, which is in
sapien.wrapper.actor_builder.ActorBuilder.build_physx_component
:My question is: How can I access these
PhysxCollisionShape
instances and modify their properties, such as scale, during the simulation? Thank you very much!The text was updated successfully, but these errors were encountered: