Repository navigation
Expose Newton visualizer particle options - #6042
Conversation
There was a problem hiding this comment.
🤖 Isaac Lab Review Bot — PR #6042
Expose Newton visualizer particle options by @maxkra15
✅ Summary
Clean, focused PR that adds two new config options (show_particles and particle_color) to NewtonVisualizerCfg and threads them through to the Newton viewer. The implementation correctly caches the Warp color buffer to avoid per-frame allocations and preserves Newton defaults when particle_color=None.
📋 Findings
| # | Severity | File | Finding |
|---|---|---|---|
| 1 | 💡 suggestion | newton_visualizer.py |
The log_points override only intercepts /model/particles. Consider whether this should be documented in a docstring to clarify it will not apply to other particle-like point clouds (e.g. /model/debris or user-defined paths). |
| 2 | 💡 suggestion | newton_visualizer_cfg.py |
The particle_color field allows any tuple[float, float, float] without clamping to [0, 1]. Consider adding a __post_init__ validator or a note in the docstring that values outside [0, 1] are passed through to Newton as-is. |
| 3 | ℹ️ note | newton_visualizer.py |
In initialize(), self._viewer.particle_color = self.cfg.particle_color assigns the cfg tuple directly to the viewer instance. This is then also picked up by the log_points override via self.particle_color. Confirm there is no conflict — the __init__ also sets self.particle_color = None, so initialize() must run before particles render (which it does). Looks correct. |
| 4 | newton_visualizer.py |
_particle_color_array uses self.device which is set in NewtonViewerGL.__init__. If particle_color is set before __init__ completes (e.g., via a subclass), this could error. Current usage path is safe but worth a note. |
|
| 5 | ✅ positive | test_newton_adapter.py |
Good test coverage: config instantiation, color override on /model/particles, and pass-through for other point names. |
🏁 CI Status
- ❌
Check changelog fragments— Missing changelog fragment. Please add a fragment for the new feature. - ✅
pre-commitpassed - ✅
Build Wheelpassed - ⏳ Several checks still pending (Docker builds, installation tests)
🎯 Verdict
Looks good overall. Minor suggestions above. The main actionable item is the missing changelog fragment (CI failure). Once that is addressed this should be ready.
Findings: 5 (0 blocking, 1 minor, 2 suggestions, 1 note, 1 positive)
🔄 Update (0b464f3e)
Force-push with changelog fragment added (changelog.d/max-newton-visualizer-particles.rst). This addresses the CI failure noted above — the Check changelog fragments check should now pass. ✅
No other functional code changes detected in this update. The implementation, tests, and config remain the same as previously reviewed.
Status: Ready to merge (pending CI green). Previous suggestions remain non-blocking recommendations.
🔄 Update (8e4c70d5)
Commits squashed into a single clean commit. No functional changes — implementation, tests, config, and changelog fragment are all identical to the previously reviewed version.
Status: Ready to merge ✅ — all previous feedback remains non-blocking.
Greptile SummaryThis PR exposes two new particle visualization controls —
Confidence Score: 4/5Safe to merge. The changes are additive, well-contained, and follow the established patterns for other show_* config flags. The implementation is clean and the new log_points override correctly guards both the name and None checks before touching the colors argument. The only noticeable inconsistency is that show_particles is not wired up to a live UI checkbox in render_left_panel, whereas every other show* property has one — meaning the flag is locked to its initial config value at runtime. newton_visualizer.py — specifically the render_left_panel Visualization section, which should receive a show_particles checkbox to match the existing show* UI pattern. Important Files Changed
Sequence DiagramsequenceDiagram
participant NV as NewtonVisualizer
participant GL as NewtonViewerGL
participant VGL as ViewerGL (Newton)
NV->>GL: initialize() — set show_particles, particle_color
Note over GL: stores particle_color on self
loop Each frame
NV->>GL: step() → viewer.log_state(state)
VGL-->>GL: log_points("/model/particles", points, ...)
GL->>GL: "log_points override: check name == /model/particles"
alt particle_color is set
GL->>GL: _particle_color_array(len(points)) → cached wp.array
GL->>VGL: "super().log_points(..., colors=wp.array)"
else particle_color is None
GL->>VGL: "super().log_points(..., colors=original)"
end
end
|
b53b1b1 to
0b464f3
Compare
0b464f3 to
8e4c70d
Compare
| def log_points(self, name, points, radii=None, colors=None, hidden=False): | ||
| """Apply configured model-particle appearance while preserving Newton's point logging. | ||
|
|
||
| The configured particle color only applies to Newton's canonical | ||
| ``/model/particles`` point batch. User-defined point clouds retain the | ||
| colors provided by their own ``log_points`` calls. | ||
| """ |
There was a problem hiding this comment.
This is a public function please document the I/Os
Description
This PR adds particle visualization controls to
NewtonVisualizerCfg.It exposes:
show_particlesto enable Newton particle rendering through config.particle_colorto optionally override the Newton viewer particle color for/model/particles.Motivation: MPM and particle-based demos currently need to reach into the private Newton viewer instance to show particles
or customize particle appearance. This keeps that behavior on the public visualizer config surface and preserves Newton’s
default behavior when
particle_color=None.Fixes # N/A
Type of change
Screenshots
Not applicable.
Checklist
pre-commitchecks with./isaaclab.sh --format