Skip to content

OMPE-118553 Add UI toggle for LiDAR point visualization - #9215

Open
huidongc wants to merge 3 commits into
isaac-sim:mainfrom
huidongc:OMPE-118553/visualizer-toggles
Open

huidongc wants to merge 3 commits into
isaac-sim:mainfrom
huidongc:OMPE-118553/visualizer-toggles

Conversation

@huidongc

@huidongc huidongc commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Lidar hit overlay in Newton GL and Viser is now opt-in. A dense scan is expensive to copy to the host and upload every visualizer step, so the previous every-tenth-step upload is gone.

The overlay is off by default. Enable it at launch with NewtonGLBackendCfg.show_lidar_hits or ViserBackendCfg.show_lidar_hits, or at runtime from the Newton HUD / Viser Visualization Markers checkbox. Turning it off hides the last batch.

Kit keeps its existing debug-draw path and has no checkbox.

Type of change

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

Screenshots

Screencast.from.2026-11-25.21-13-23.mp4

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request, or run-ci ovstage to include kitless OVStage rendering tests for that run.
Subsequent pushes and plain run-ci comments do not run OVStage tests unless you comment run-ci ovstage again.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

- Skip the host copy and upload unless the overlay is on; a dense scan is expensive every visualizer step
- Newton GL and Viser expose a checkbox
- Backend `show_lidar_points` opts in at launch
* Rename ``show_lidar_points`` to ``show_lidar_hits`` on Newton GL and Viser
* Update the HUD checkboxes to Lidar Hits
* Drop the Kit launch flag so only Newton GL and Viser expose the overlay
@huidongc
huidongc requested a review from a team November 25, 2026 13:10
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Nov 25, 2026
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with non-blocking concerns about Kit's extra work and points remaining visible while paused.

Findings

  1. P2 Kit redraws scans too often ▶
  2. P2 Paused points stay visible ▶

Summary

Makes lidar overlays opt-in for Newton GL and Viser.

  • Newton GL and Viser let users choose when lidar hits appear.
  • Kit draws current lidar hits on every visualizer step.

Reviews (2) · Last reviewed commit: "Drop unused Kit lidar step counter" · Reviewed by Greptile

return any(isinstance(sensor, lidar_cls) for sensor in scene.sensors.values())


def collect_lidar_hits(sim: SimulationContext, env_ids: list[int] | None) -> list[tuple[str, np.ndarray]]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Kit window updates fail

collect_lidar_hits now accepts two arguments, but KitVisualizer._draw_lidar_points still passes three. Every non-headless Kit step reaches that call, even without a lidar sensor, and raises TypeError before the app update. Preserve the existing Kit call and its ten-step interval, or update Kit alongside this change.

Comment on lines +582 to +584
@lidar_cb.on_update
def _(event):
self._show_lidar_hits = event.target.value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Paused points stay visible

Turning off Lidar Hits while rendering is paused leaves the last cloud visible. The callback only changes _show_lidar_hits, while step returns before reaching the code that hides the cloud. Newton has the same pause gate around _log_lidar_hits. Apply the hide operation outside the pause gate, without copying a new scan.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isaac Lab Review Bot

Needs attention: Scope and over-engineering (2), Compatibility and deprecation (3), Implementation (2), Style consistency (4). Other reviewed categories look good.

  • PR description: Correct the non-breaking label and pause claim; report validation and baseline/candidate upload latency with revisions, command/workload, hardware, backend, environment count, scan density, runtime environment, and warmup.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: extend lidar_points.py, NewtonGLVisualizer._render_frame, ViserVisualizer.step, and existing backend configs; collapse forwarding methods and reuse Viser's viewer-flag checkbox loop; no source modules were added. Keep only toggle state, conditional uploads, and hide transitions. Replace with one smaller PR: these existing implementation/config files, test_lidar_points.py, and the changelog, validated at collector compatibility and backend toggle boundaries. Scope is cohesive; no split recommended.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: LIDAR_LOG_INTERVAL disappears, collect_lidar_hits loses its third argument and skipped-step result, and unchanged configurations lose automatic overlays; retain old behavior through warnings, migration documentation, removal guidance, and transition coverage.
  • Implementation: Both backends skip hide synchronization while rendering is paused, leaving disabled clouds visible; process pending hides outside the pause gates without collecting new hits.
  • Style consistency: The edited LiDAR imports violate the required same-package relative-import convention; use relative imports in both visualizers.
  • Test quality: Test quality looks good.

Significant concerns. Posted 11 inline findings.

Automated review; human maintainers own approval decisions.

from isaaclab.visualizers.base_visualizer import BaseVisualizer


LIDAR_LOG_INTERVAL = 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Compatibility — Retain the interval constant

Removing the documented LIDAR_LOG_INTERVAL breaks existing imports. Retain it for the collector's deprecation transition and document its replacement and removal.

sim: SimulationContext, env_ids: list[int] | None, step_counter: int
) -> list[tuple[str, np.ndarray]] | None:
"""Return every visualized environment's lidar hits on every tenth visualizer step.
def _ovrtx_lidar_cls() -> type | None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Style Consistency — Place private helper after public functions

_ovrtx_lidar_cls interrupts the public-function sequence before scene_has_lidar and collect_lidar_hits. Move it after the public functions, as required by the module-order convention.

return any(isinstance(sensor, lidar_cls) for sensor in scene.sensors.values())


def collect_lidar_hits(sim: SimulationContext, env_ids: list[int] | None) -> list[tuple[str, np.ndarray]]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Compatibility — Preserve the collector contract

Existing three-argument calls now raise TypeError, and skipped steps no longer return None. Keep the throttled signature through a warned deprecation transition; give the new toggle an unthrottled path and document and test both.


from isaaclab_visualizers.desktop_entry import write_desktop_entry
from isaaclab_visualizers.lidar_points import collect_lidar_hits, frame_visualizer_closeup, log_lidar_hits
from isaaclab_visualizers.lidar_points import frame_visualizer_closeup, scene_has_lidar, sync_lidar_hits

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Style Consistency — Use relative package imports

This edited LiDAR import and the corresponding Viser import use absolute paths within the same package. The contribution guide requires relative imports at this depth; change both.

"""Newton GL window with Isaac Lab controls and device-image presentation."""

_contacts_available = True
_lidar_available = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Style Consistency — Annotate new class variables

_lidar_available and show_lidar_hits are class-level defaults without the required ClassVar[bool] annotations. Add those annotations so their ownership follows the class-member convention.

if self.cfg.enable_markers:
render_newton_visualization_markers(viewer, self._env_ids, num_envs=self.backend.model.num_envs)
self._log_lidar_points(viewer)
self._log_lidar_hits(viewer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Implementation — Clear GL clouds while paused

The HUD can turn hits off while paused, but this call is inside the unpaused branch. The last cloud remains visible until resume; process the pending hide within a frame without collecting hits.

show_particles: bool = True
"""Show simulation particles. Set to False to hide them, for example in a surface-only view."""

show_lidar_hits: bool = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Compatibility — Transition the overlay defaults

This and ViserBackendCfg silently hide overlays for unchanged configurations that previously displayed hits every tenth step. Distinguish an omitted flag from explicit False, retain legacy behavior during a warned transition, and document and test migration.

def _(event, _attr=attr):
setattr(viewer, _attr, event.target.value)

lidar_cb = server.gui.add_checkbox("Lidar Hits", initial_value=self._show_lidar_hits)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Scope Complexity — Reuse Viser's viewer flags

The adjacent _VIZ_FLAGS loop already initializes viewer checkboxes and updates their flags. This separate visualizer state and callback duplicate that path; put show_lidar_hits on the viewer and use the existing loop.


@lidar_cb.on_update
def _(event):
self._show_lidar_hits = event.target.value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Implementation — Clear Viser clouds while paused

This callback changes the flag, but step returns before LiDAR synchronization when rendering is paused. The old cloud remains visible; clear it on the toggle or process hides outside the pause gate.


def test_collect_lidar_hits_returns_lidar_clouds_on_the_interval():
"""Only lidar sensors are returned, and only on every tenth step."""
def _lidar_sim():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Style Consistency — Annotate new test returns

The new _lidar_sim helper and test_sync_lidar_hits_hides_previous_clouds_until_enabled omit return annotations required by the typing guide. Add -> SimpleNamespace and -> None, respectively.

collect_lidar_hits no longer throttles by step, so KitVisualizer does not
need to count steps or pass that argument.
debug-draw interface is reported once and the step continues.
"""
hits = collect_lidar_hits(self._sim, self._env_ids, self._step_counter)
hits = collect_lidar_hits(self._sim, self._env_ids)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Kit redraws scans too often

Kit now copies and redraws lidar hits on every visualizer step instead of every tenth step. Each call copies the selected hits to the CPU and builds a Python tuple for every point. Dense scans therefore repeat this expensive work ten times as often, with no toggle to disable it. Keep Kit's ten-step interval around the updated two-argument call.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant