Skip to content
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

[BugFix] Improve GPU sim speed and new docs on initial pose handling #655

Merged
merged 10 commits into from
Oct 26, 2024

Conversation

StoneT2000
Copy link
Member

No description provided.

@StoneT2000
Copy link
Member Author

StoneT2000 commented Oct 26, 2024

We discovered a few important things that can easily slow down the GPU simulation (and even break it!), primarily around setting initial poses of builders before building robots/actors/articulations. The latest commit and eventually future releases have new details on how to make GPU simulation faster and importantly accurate. Existing envs you make are not affected really but you may get some warnings from our code about not setting initial poses.

In particular, we strongly recommend the following when building your own tasks

  • override the _load_agent function to set the robot's initial pose (you cannot do it anywhere else). You should pick a pose that isn't too big in values but also is unlikely to collide with other objects if it was placed there. This has caused bugs when e.g. the initial pose of a robot and cabinet were both at 0, and GPU sim uses initial poses to initialize contact buffers and other data. The intersections are bad for GPU sim especially for articulated objects.
import sapien
class YourEnv(BaseEnv):
    def _load_agent(self, options: dict):
        super()._load_agent(options, sapien.Pose(p=[0, 0, 1]))
  • ensure to specify an initial pose in your actor / articulation builders. Again following the same general rule of thumb to place objects such that they don't intersect.
def _load_scene(self, options: dict):
    builder.initial_pose = sapien.Pose(p=[0, 1, 0]) # for example
    builder.build()

For envs specifically with complex articulations and more than 1, these fixes are critical to ensuring less bugs occur and for faster simulation. Docs for these recommendations have been updated on the custom tasks tutorial: https://maniskill.readthedocs.io/en/latest/user_guide/tutorials/custom_tasks/intro.html#loading

@StoneT2000 StoneT2000 merged commit 3086a0f into main Oct 26, 2024
@StoneT2000 StoneT2000 deleted the improve-gpu-sims-speed branch October 26, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant