Incorrect Inertia Computation for Capsules, Cylinders, and Cones Due to Default Axis Mismatch #486#505
Conversation
…to Default Axis Mismatch newton-physics#486 Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
📝 WalkthroughWalkthroughThe inertia computation functions for capsules, cylinders, and cones were updated to use the z-axis as the principal extension direction, correcting prior inconsistencies in documentation, comments, and inertia tensor construction. A new unit test was added to verify that inertia tensors for these shapes reflect the correct axis-dependent symmetry properties. Changes
Sequence Diagram(s)sequenceDiagram
participant TestCase as test_capsule_cylinder_cone_axis_inertia
participant ModelBuilder
participant InertiaFunc as compute_capsule_inertia / compute_cylinder_inertia / compute_cone_inertia
TestCase->>ModelBuilder: add_body(), add_shape_capsule/cylinder/cone(axis, ...)
ModelBuilder->>InertiaFunc: compute inertia tensor (shape, axis)
InertiaFunc-->>ModelBuilder: inertia tensor (aligned with z-axis)
ModelBuilder-->>TestCase: finalized model with inertia
TestCase->>TestCase: assert inertia tensor diagonal elements reflect axis symmetry
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Assessment against linked issues
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
…es-cylinders-and-cones-due-to-default-axis-mismatch
…to Default Axis Mismatch newton-physics#486 (newton-physics#505) Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
# Description Correct teleop system requirements doc <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html --> Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) <!-- As a practice, it is recommended to open an issue to have discussions on the proposed pull request. This makes it easier for the community to keep track of what is being developed or added, and if a given feature is demanded by more than one party. --> ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - This change requires a documentation update ## Screenshots Please attach before and after screenshots of the change if applicable. <!-- Example: | Before | After | | ------ | ----- | | _gif/png before_ | _gif/png after_ | To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task -->
…to Default Axis Mismatch newton-physics#486 (newton-physics#505) Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
Description
Fixes incorrect inertia computation for capsules, cylinders, and cones due to axis mismatch. Closes #486
Problem
When adding capsule, cylinder, or cone shapes, they are internally stored with Z-axis orientation:
However, the inertia computation functions (
compute_capsule_inertia,compute_cylinder_inertia,compute_cone_inertia) were calculating inertia assuming Y-axis orientation. This mismatch caused incorrect inertia tensors, leading to inaccurate rotational dynamics in physics simulations.Solution
Updated the inertia computation functions in
newton/geometry/inertia.pyto compute inertia for Z-axis orientation:I = [[Ia, 0, 0], [0, Ib, 0], [0, 0, Ia]](Y-axis) toI = [[Ia, 0, 0], [0, Ia, 0], [0, 0, Ib]](Z-axis)test_inertia.pyto verify correct inertia computation for all three axes (X, Y, Z)Testing
Added
test_capsule_cylinder_cone_axis_inertia()which verifies:All existing tests continue to pass.
Newton Migration Guide
Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this MR.
docs/migration.rstis up-to-dateBefore your PR is "Ready for review"
newton/tests/test_examples.py)pre-commit run -aSummary by CodeRabbit
Documentation
Tests