Skip to content

feat(viewer): native Rerun CLI arg handling via run_with_app_wrapper()#14

Merged
spomichter merged 1 commit intomainfrom
feat/rerun-native-args
Mar 16, 2026
Merged

feat(viewer): native Rerun CLI arg handling via run_with_app_wrapper()#14
spomichter merged 1 commit intomainfrom
feat/rerun-native-args

Conversation

@spomichter
Copy link
Copy Markdown

Summary

Replace dimos-viewer's custom 5-flag Args struct with Rerun's full native CLI parser. All ~30 stock Rerun flags now work unchanged (--connect, --serve-grpc, --serve-web, --memory-limit, --port, --bind, --save, subcommands, etc.).

DimOS behavior (keyboard teleop, click-to-nav) is injected cleanly via two new extension points:

  • AppWrapper — wraps re_viewer::App in DimosApp for keyboard teleop overlay
  • StartupOptionsPatch — patches StartupOptions after CLI parsing (injects on_event for click-to-nav)

Changes

Native CLI args

  • viewer.rs: 265 → ~100 lines. Delegates to rerun::run_with_app_wrapper() instead of manual setup.
  • All stock Rerun flags, subcommands (reset, rrd, auth), and .rrd file loading work.
  • Old custom --open flag removed; unknown flags properly rejected by clap.

Ctrl+click nav goals

  • Plain click = normal Rerun selection (no side effects)
  • Ctrl+click (or Cmd+click on macOS) in 3D view publishes PointStamped LCM on /clicked_point
  • Debounced at 100ms to prevent rapid-fire
  • Uses Arc<AtomicBool> shared between DimosApp (writes ctrl state) and on_event callback (reads it)

Keyboard teleop overlay

  • Overlay shifted from (12,12) to (280,12) — right of Rerun's left panel
  • Greyed out when idle (low alpha bg/keys/text), bright when active
  • Shows active robot name in title

Multi-robot teleop

  • KeyboardHandler.set_active_robot(Some("/world/go2")) publishes to /world/go2/cmd_vel
  • Sends stop command to old robot before switching
  • None = default /cmd_vel channel

Rerun entrypoint extensions

  • pub type AppWrapper — wraps App before eframe gets it
  • pub type StartupOptionsPatch — patches StartupOptions post-CLI-parse
  • pub fn run_with_app_wrapper() — like run() but with both hooks
  • Made Args, native_startup_options_from_args pub for downstream use

Testing

14/14 CLI integration tests, 27+ unit tests pass.

cargo build -p dimos-viewer --release
cargo test -p dimos-viewer --lib --release
./target/release/dimos-viewer --help
./target/release/dimos-viewer --connect rerun+http://127.0.0.1:9876/proxy
./target/release/dimos-viewer --serve-grpc --port 9877

Breaking Changes

  • Custom --open flag removed (use Rerun's native --connect instead)
  • Default port reverts to Rerun's 9876 (was hardcoded 9877 — use --port 9877 if needed)

…apper

Replace custom Args struct (5 flags) with Rerun's full CLI parser.
All stock Rerun flags now work: --connect, --serve-grpc, --serve-web,
--memory-limit, --port, --bind, --save, subcommands (reset, rrd, auth), etc.

DimOS behavior (keyboard teleop, click-to-nav) injected via AppWrapper
callback that wraps re_viewer::App in DimosApp — only for the native
viewer path. All other modes (headless gRPC, web viewer, save) work
identically to stock Rerun.

viewer.rs: 265 → 92 lines.
@spomichter spomichter force-pushed the feat/rerun-native-args branch from c17fa2a to 2e989cf Compare March 15, 2026 02:23
@spomichter spomichter changed the title feat(viewer): native Rerun CLI arg handling + Ctrl+click nav + multi-robot teleop feat(viewer): native Rerun CLI arg handling via run_with_app_wrapper() Mar 16, 2026
@spomichter spomichter merged commit a77934f into main Mar 16, 2026
69 of 99 checks passed
spomichter added a commit that referenced this pull request Mar 18, 2026
* feat: deag, click on enable

* fix: remove logging

* fix: reposition default

* fix: default position

* fix(viewer): restore click-to-nav via StartupOptionsPatch

PR #14's run_with_app_wrapper rewrote viewer.rs and dropped the
on_event handler for click-to-navigate. This restores it properly:

- Add StartupOptionsPatch struct to rerun entrypoint with on_event callback
- Wire Ctrl+click -> PointStamped LCM on /clicked_point in viewer.rs
- Arc<AtomicBool> for ctrl state sharing (Send required by AppWrapper)
- 100ms debounce on nav goal publishing

---------

Co-authored-by: ruthwikdasyam <ruthwikdasyam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant