Skip to content

Add show collision and inertia visualization toggles to Newton viewer#5161

Open
vidurv-nvidia wants to merge 6 commits intoisaac-sim:developfrom
vidurv-nvidia:vidur/feature/newton-viewer-collision
Open

Add show collision and inertia visualization toggles to Newton viewer#5161
vidurv-nvidia wants to merge 6 commits intoisaac-sim:developfrom
vidurv-nvidia:vidur/feature/newton-viewer-collision

Conversation

@vidurv-nvidia
Copy link
Copy Markdown

@vidurv-nvidia vidurv-nvidia commented Apr 3, 2026

Description

Add visualization toggles for collision meshes and inertia boxes to the Newton viewer.

  • Add show_collision config option and UI checkbox to visualize collision meshes at runtime
  • Add show_inertia_boxes config option and UI checkbox to visualize body inertia boxes at runtime

Both options wire through NewtonVisualizerCfg to the underlying Newton ViewerGL attributes.

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks 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

Add show_collision option to NewtonVisualizerCfg and corresponding
checkbox in the Newton viewer UI, allowing users to visualize
collision meshes at runtime.
@github-actions github-actions bot added enhancement New feature or request isaac-lab Related to Isaac Lab team labels Apr 3, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 3, 2026

Greptile Summary

This PR adds a show_collision toggle to the Newton viewer — a show_collision: bool = False config field on NewtonVisualizerCfg, a corresponding "Show Collision" imgui checkbox in _render_left_panel, and wiring from the config value to _viewer.show_collision in initialize(). The change is small, follows the same pattern as the existing show_joints, show_contacts, show_springs, and show_com toggles, and is safe to merge.

One minor ordering inconsistency was found:

  • The show_collision field is placed after show_springs in newton_visualizer_cfg.py, but in both the imgui UI and the initialize() assignment block it sits between show_contacts and show_springs. Aligning these orders makes the files easier to audit together.

Additionally, the project guidelines in AGENTS.md require a CHANGELOG.rst update for every change targeting a source/<package>/ directory. The isaaclab_visualizers package does not yet have a source/isaaclab_visualizers/docs/CHANGELOG.rst file, so either that file should be created with an initial entry covering this addition, or the existing changelog infrastructure should be confirmed as intentionally absent for this package.

Confidence Score: 4/5

Safe to merge — small, additive change that mirrors the pattern of existing show_* toggles with no logic risk.

The change is a straightforward, additive feature following a well-established pattern (show_joints, show_contacts, show_springs, show_com). There are no logic errors, no security concerns, and no breaking API changes. The only issue is a minor field-ordering inconsistency between the cfg file and the visualizer file, and a missing CHANGELOG entry per project guidelines.

No files require special attention; the ordering inconsistency in newton_visualizer_cfg.py is cosmetic.

Important Files Changed

Filename Overview
source/isaaclab_visualizers/isaaclab_visualizers/newton/newton_visualizer_cfg.py Adds show_collision: bool = False field to NewtonVisualizerCfg; field is inserted between show_springs and show_com, but the corresponding UI and initializer in newton_visualizer.py place it between show_contacts and show_springs, creating an ordering inconsistency.
source/isaaclab_visualizers/isaaclab_visualizers/newton/newton_visualizer.py Adds "Show Collision" imgui checkbox in _render_left_panel (placed between "Show Contacts" and "Show Springs") and wires cfg.show_collision to _viewer.show_collision during initialization; consistent with how other show_* flags are handled.

Sequence Diagram

sequenceDiagram
    participant User
    participant NewtonVisualizer
    participant NewtonViewerGL
    participant ViewerGL

    User->>NewtonVisualizer: initialize(scene_data_provider)
    NewtonVisualizer->>NewtonViewerGL: NewtonViewerGL(width, height, ...)
    NewtonVisualizer->>NewtonViewerGL: show_collision = cfg.show_collision
    Note over NewtonViewerGL: Attribute set on viewer instance

    loop Each rendered frame
        NewtonViewerGL->>NewtonViewerGL: _render_left_panel()
        NewtonViewerGL->>ViewerGL: imgui.checkbox("Show Collision", show_collision)
        User->>NewtonViewerGL: Toggle "Show Collision" checkbox
        NewtonViewerGL->>NewtonViewerGL: self.show_collision = new_value
        ViewerGL->>ViewerGL: Render collision meshes (if show_collision=True)
    end
Loading

Reviews (1): Last reviewed commit: "Add show collision mesh toggle to Newton..." | Re-trigger Greptile

…_visualizer_cfg.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: vidurv-nvidia <vidurv@nvidia.com>
Copy link
Copy Markdown

@isaaclab-review-bot isaaclab-review-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — PR #5161: Add show collision mesh toggle to Newton viewer

Overall: The feature itself is clean and follows the existing toggle pattern well. However, there's a blocking bug in the cfg file — duplicate field declarations that need to be cleaned up before merge.

Summary

Category Finding
🔴 Bug Duplicate show_contacts and show_springs field declarations in cfg
✅ Good newton_visualizer.py changes are correct and consistent with existing patterns
✅ Good UI ordering matches initializer ordering
ℹ️ Note PR is 1 commit behind develop — rebase recommended before merge
ℹ️ Note Checklist items for docs, tests, and changelog are unchecked — confirm if those are needed

CI Status

Only the labeler check ran (passed). No lint/test CI triggered — this may be expected for the visualizer extension, but worth confirming.

vidurv-nvidia and others added 3 commits April 2, 2026 23:31
…_visualizer_cfg.py

Co-authored-by: isaaclab-review-bot[bot] <270793704+isaaclab-review-bot[bot]@users.noreply.github.com>
Signed-off-by: vidurv-nvidia <vidurv@nvidia.com>
Signed-off-by: vidurv-nvidia <vidurv@nvidia.com>
show_joints, show_contacts, show_collision, and show_springs were
defined multiple times. Keep each once and preserve the new
show_collision field.
Copy link
Copy Markdown

@isaaclab-review-bot isaaclab-review-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Isaac Lab Review Bot — Follow-up

New commits (d232e02→0d0d99a): attempted to apply the ordering suggestion but duplicates got worse — the file now has show_joints ×2, show_contacts ×3, show_collision ×2, show_springs ×2, plus an orphaned docstring.

"""Show collision visualization."""

show_springs: bool = False
"""Show spring visualization."""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Duplicates multiplied instead of being fixed. The new commit added a block with the correct ordering but kept all the original lines too. The file now has massive duplication:

  • show_joints — 2 declarations
  • show_contacts — 3 declarations
  • show_collision — 2 declarations
  • show_springs — 2 declarations + orphaned docstring

The entire field section (lines 38–63) should be replaced with exactly:

Suggested change
"""Show spring visualization."""
show_joints: bool = False
"""Show joint visualization."""
show_contacts: bool = False
"""Show contact visualization."""
show_collision: bool = False
"""Show collision visualization."""
show_springs: bool = False
"""Show spring visualization."""

That is: each field declared exactly once, in the order matching the UI and initializer.

Add show_inertia_boxes option to NewtonVisualizerCfg and corresponding
checkbox in the Newton viewer UI, allowing users to visualize body
inertia boxes at runtime.
@vidurv-nvidia vidurv-nvidia changed the title Add show collision mesh toggle to Newton viewer Add show collision and inertia visualization toggles to Newton viewer Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant