[FEATURE] WIP: Make rigid body simulation fully differentiable#2078
Draft
SonSang wants to merge 10 commits intoGenesis-Embodied-AI:mainfrom
Draft
[FEATURE] WIP: Make rigid body simulation fully differentiable#2078SonSang wants to merge 10 commits intoGenesis-Embodied-AI:mainfrom
SonSang wants to merge 10 commits intoGenesis-Embodied-AI:mainfrom
Conversation
duburcqa
reviewed
Dec 6, 2025
| @gs.assert_built | ||
| def set_dofs_velocity_grad(self, dofs_idx_local, envs_idx, velocity_grad): | ||
| dofs_idx = self._get_idx(dofs_idx_local, self.n_dofs, self._dof_start, unsafe=True) | ||
| dofs_idx = self._get_global_idx(dofs_idx_local, self.n_dofs, self._dof_start, unsafe=True) |
Collaborator
There was a problem hiding this comment.
We need a unit test for this.
duburcqa
reviewed
Dec 6, 2025
Comment on lines
302
to
+307
| if getattr(self._options, "noslip_iterations", 0) > 0: | ||
| gs.raise_exception("Noslip is not supported yet when requires_grad is True.") | ||
|
|
||
| if getattr(self._options, "sparse_solve", False): | ||
| gs.raise_exception("Sparse solve is not supported yet when requires_grad is True.") | ||
|
|
Collaborator
There was a problem hiding this comment.
It would be nice to have unit tests to catch all this forbidden configurations.
…ckward pass 2. fixed bug in save_ckpt, needed to set copy=True in converting taichi field to numpy array
2. use backward mode for rigid body sim only when computing gradient
2. stabilized differentiable contact, now can solve simple optimization problem
… inner loops outside 2. fixed some geometric functions in utils.geom.py to avoid nan grads 3. added rigid entity state queries (e.g. qpos, dofs_vel)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR aims at stitching differentiable components in the rigid body simulation to make it fully differentiable end-to-end. Also, it will provide a minimal demo to demonstrate the differentiability of the rigid body simulation.
Specifically, this PR would contain:
Related Issue
Resolves #2069
Motivation and Context
How Has This Been / Can This Be Tested?
TBD
Screenshots (if appropriate):
TBD
Checklist:
Submitting Code Changessection of CONTRIBUTING document.