Use +Z as default up axis for capsules, cones, cylinders, planes #365#378
Closed
vreutskyy wants to merge 5 commits into
Closed
Conversation
…on-physics#365 Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
Contributor
📝 Walkthrough## Walkthrough
This set of changes standardizes the default axis orientation for capsules, cones, cylinders, and planes to use the +Z axis as the "up" direction throughout the codebase. Adjustments are made to geometric kernels, model building APIs, import utilities, tests, and rendering logic to consistently use the Z-axis convention and update parameter names accordingly.
## Changes
| File(s) | Change Summary |
|---------|----------------|
| `newton/geometry/kernels.py` | All SDFs, collision, and contact routines updated to use Z-axis for vertical/height, replacing Y-axis references; plane logic now uses XY plane at Z=0. |
| `newton/sim/builder.py` | Plane, capsule, cylinder, and cone shape creation now use +Z as default axis; parameter `up_axis` renamed to `axis`; method signatures updated. |
| `newton/solvers/mujoco/solver_mujoco.py`, `newton/tests/test_mujoco_solver.py` | Removed special-case quaternion rotations for capsules/cylinders with Z-up; simplified orientation logic. |
| `newton/tests/test_collision.py` | Added numerical tolerance to array equality assertions in mesh-ground collision test. |
| `newton/tests/test_import_urdf.py` | Updated expected capsule orientation quaternion in URDF import test to identity (no rotation). |
| `newton/tests/test_rigid_contact.py`, `newton/tests/test_up_axis.py` | Changed `up_axis` argument to `axis` in capsule shape addition calls. |
| `newton/utils/import_mjcf.py`, `newton/utils/import_urdf.py`, `newton/utils/import_usd.py` | Changed `up_axis` to `axis` in all relevant shape import functions for capsules, cylinders, and cones. |
| `newton/utils/render.py` | Ground plane normal and shape orientation in rendering updated to Z-up; capsules, cylinders, and cones now rendered with -90° X rotation. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant ModelBuilder
participant GeometryKernels
participant Renderer
User->>ModelBuilder: add_shape_capsule(..., axis=Axis.Z)
ModelBuilder->>GeometryKernels: Compute SDF/collision with Z as up axis
ModelBuilder->>Renderer: Provide shape with Z-up orientation
Renderer->>Renderer: Render ground plane normal as (0,0,1)Assessment against linked issues
Suggested reviewers
Poem
|
Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
adenzler-nvidia
left a comment
Member
There was a problem hiding this comment.
Looks good from my side. Unfortunately I have no idea if we're missing any other places - I hope we have testing for this.
6 tasks
…nes-cylinders-planes Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
…nes-cylinders-planes
Signed-off-by: Viktor Reutskyy <vreutskyy@nvidia.com>
eric-heiden
reviewed
Jul 11, 2025
Member
Author
|
@eric-heiden should I close this PR then? |
Member
|
OK, let's close this PR then - your changes are included in #376. |
vidurv-nvidia
pushed a commit
to vidurv-nvidia/newton
that referenced
this pull request
Mar 6, 2026
# Description Bumps version to 2.1.0 ## Type of change - This change requires a documentation update ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] 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 -->
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 standardizes the internal representation of primitive shapes (capsules, cones, cylinders, and planes) to use the +Z axis as their primary axis or normal. This change, which closes #365, aligns Newton's conventions with other simulation environments like MuJoCo and simplifies the conversion process between them.
Key changes include:
newton/geometry/kernels.py):newton/sim/builder.py):add_shape_capsule,add_shape_cylinder,add_shape_cone) now apply a rotation to align the user-specifiedaxiswith the internal +Z axis.up_axisparameter has been renamed toaxisfor clarity.add_shape_planehas been updated to correctly handle plane equations and compute robust rotations, including for normals opposite to +Z.newton/utils/render.py):newton/solvers/mujoco/solver_mujoco.py):newton/utils/import_*.py):axisparameter correctly.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"
pre-commit run -aSummary by CodeRabbit
New Features
up_axistoaxisfor shape creation methods, improving clarity and consistency.Bug Fixes
Style
Tests
Chores