Skip to content

Commit 880ae69

Browse files
kongchen1992meta-codesync[bot]
authored andcommitted
{Feature} Visualization - Auto-show optional panels on first stream
Summary: Explanation: `aria_streaming_viewer` sets up its Rerun blueprint once from an `AriaDataViewerConfig` snapshotted at construction time. GPS and Neural Band panels stay hidden even when the device is actively publishing those streams, while the Fixation Crop / Cropped POV panels are hardcoded on regardless of the recording profile. It cannot mirror the offline `aria_rerun_viewer` up front because the Client SDK offers no API to enumerate the sensors a streaming session will actually push (only the profile name is exposed; `RecordingProfile` in `sdk_gen2.pyi` carries no sensor bits). Fix follows the pattern already used in `multi_device_streaming_viewer`: observe stream first-fires and rebuild the blueprint via `rr.send_blueprint()`. - `aria_data_plotter.py` gains `AriaDataViewer.set_optional_panel_visible(panel, visible)` — a public, idempotent seam that flips one of `enable_gps` / `enable_neural_band_batch` / `enable_crop_visualization` and calls `update_rerun_blueprint()` when the flag actually changed. Respects `blueprint_path` (custom blueprint mode) and defers when the first calibration has not yet arrived, in which case the flag is still updated so it takes effect on the next blueprint build. - `aria_streaming_viewer.py` drops the hardcoded `enable_crop_visualization = True`, tracks a `_seen_optional_panels` set, and calls `set_optional_panel_visible(panel, True)` on the first arrival of `gps` / `neural_band_batch` / `fixation_crop` / `cropped_pov_image` data. Additive-only: panels can appear during a session but do not disappear, mirroring the offline viewer's behavior. Rebuild is bounded to one call per optional panel per session (idempotency at both layers); callback-thread races at worst cause a duplicate rebuild. Trade-off: optional panels pop in during the first few milliseconds of their stream instead of being present at spawn. This is intentional and mirrors the offline viewer, which gates its Neural Band panel by VRS-content detection at open time — the streaming case has no equivalent up-front knowledge, so it detects empirically. Reproducibility: Streamed a Gen2 profile that publishes GPS and fixation crop but not Neural Band; before: crop panels visible with no data, GPS panel absent despite GPS ticking. After: GPS panel appears once the first GPS sample lands; crop panels appear once the first crop lands; the Neural Band panel stays absent for the whole session. Reviewed By: nrraina Differential Revision: D114112124 fbshipit-source-id: f5826caf90eeaecef02080aee508e94b60bb78c3
1 parent 5f4d563 commit 880ae69

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

projectaria_tools/tools/aria_rerun_viewer/aria_data_plotter.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,36 @@ def set_device_calibration(self, device_calibration):
341341
self.update_rerun_blueprint()
342342
self.plot_device_extrinsics()
343343

344+
OPTIONAL_PANEL_CONFIG_FLAGS = {
345+
"gps": "enable_gps",
346+
"neural_band_batch": "enable_neural_band_batch",
347+
"crop_visualization": "enable_crop_visualization",
348+
}
349+
350+
def set_optional_panel_visible(self, panel: str, visible: bool) -> None:
351+
"""Show or hide an optional panel, rebuilding the blueprint if it changed.
352+
353+
Idempotent: repeated calls with the same value are no-ops. When a custom
354+
blueprint is in use or the first calibration has not yet arrived, the
355+
config flag is still updated so it takes effect on the next blueprint
356+
build, but no rebuild is triggered here.
357+
358+
panel: one of the keys in `OPTIONAL_PANEL_CONFIG_FLAGS`
359+
(`"gps"`, `"neural_band_batch"`, `"crop_visualization"`).
360+
"""
361+
if panel not in self.OPTIONAL_PANEL_CONFIG_FLAGS:
362+
raise ValueError(
363+
f"Unknown optional panel {panel!r}; expected one of "
364+
f"{sorted(self.OPTIONAL_PANEL_CONFIG_FLAGS)}"
365+
)
366+
flag = self.OPTIONAL_PANEL_CONFIG_FLAGS[panel]
367+
if getattr(self.config, flag) == visible:
368+
return
369+
setattr(self.config, flag, visible)
370+
if self.config.blueprint_path or self.device_calibration is None:
371+
return
372+
self.update_rerun_blueprint()
373+
344374
def _get_plot_color(self, plot_label):
345375
"""Helper function to get the color for 2D plots."""
346376
if plot_label in self.PLOT_COLORS_AND_SIZES_2D:

0 commit comments

Comments
 (0)