Fix kinematics for mocap bodies with child bodies#858
Merged
adenzler-nvidia merged 14 commits intoNov 21, 2025
Merged
Conversation
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
3 tasks
Collaborator
|
confirmed that this is a bug with the MJX implementation, thanks for reporting and fixing this bug with MJWarp @adenzler-nvidia! |
thowell
reviewed
Nov 20, 2025
| xml = """ | ||
| <mujoco> | ||
| <worldbody> | ||
| <body name="mocap_parent" mocap="true" pos="0 0 0"> |
Collaborator
There was a problem hiding this comment.
we don't need to specify pos="0 0 0" since this is the default
Collaborator
Author
There was a problem hiding this comment.
removed, thanks for the pointer.
thowell
reviewed
Nov 20, 2025
| _assert_eq(d.xpos.numpy()[0], mjd.xpos, "initial xpos") | ||
|
|
||
| # Expected: child should be at mocap_pos + (1, 0, 0) relative offset | ||
| np.testing.assert_allclose(initial_child_xpos, [1.0, 0.0, 0.0], atol=1e-5) |
Collaborator
There was a problem hiding this comment.
can we use _assert_eq here and below?
Collaborator
Author
There was a problem hiding this comment.
done, thanks,
thowell
approved these changes
Nov 20, 2025
Signed-off-by: Alain Denzler <adenzler@nvidia.com>
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.
The sequence of kinematics -> mocap was wrong because if a mocap body had descendant bodies, the kinematics for these bodies were calculated based on the body_pos/quat values instead of mocap_pos/mocap_quat.
I took the liberty of just fusing in the mocap update into the kinematics kernel because it made sense to me, and it looks like there is a slight edge to this performance-wise. It will definitely help for scenes with a lot of mocap bodies.