Skip to content

Commit c17fa2a

Browse files
author
Ubuntu
committed
feat(viewer): Ctrl+click nav goals, multi-robot teleop, overlay UX
- Ctrl+click in 3D view publishes nav goal (PointStamped LCM); plain click is normal Rerun selection with no side effects. Uses Arc<AtomicBool> shared between DimosApp and on_event callback. - Multi-robot teleop: KeyboardHandler.set_active_robot() switches WASD publishing to /<robot>/cmd_vel. Sends stop to old robot first. - Overlay shifted to (280,12) to clear Rerun's left panel. Greyed out when idle, bright when active. Shows active robot name. - New StartupOptionsPatch API for injecting on_event callbacks through run_with_app_wrapper without touching CLI arg parsing.
1 parent 2e989cf commit c17fa2a

File tree

5 files changed

+267
-330
lines changed

5 files changed

+267
-330
lines changed

crates/top/rerun/src/commands/entrypoint.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ pub fn start_native_viewer(
898898

899899
let startup_options = native_startup_options_from_args(args)?;
900900

901+
902+
903+
901904
let connect = args.connect.is_some();
902905
let follow = args.follow;
903906
let renderer = args.renderer.as_deref();
@@ -1708,6 +1711,10 @@ fn record_cli_command_analytics(args: &Args) {
17081711
/// Used by dimos-viewer to inject keyboard teleop and other behaviors.
17091712
pub type AppWrapper = Box<dyn FnOnce(re_viewer::App) -> Result<Box<dyn re_viewer::external::eframe::App>, Box<dyn std::error::Error + Send + Sync>> + Send>;
17101713

1714+
/// A function that patches StartupOptions after they're built from CLI args.
1715+
/// Used by dimos-viewer to inject on_event callbacks, etc.
1716+
pub type StartupOptionsPatch = Box<dyn FnOnce(&mut re_viewer::StartupOptions) + Send>;
1717+
17111718
/// Like [`run`], but accepts an optional `app_wrapper` callback that wraps the
17121719
/// viewer App before it is handed to eframe. When `app_wrapper` is `None`,
17131720
/// behavior is identical to stock Rerun.
@@ -1720,6 +1727,7 @@ pub fn run_with_app_wrapper<I, T>(
17201727
call_source: CallSource,
17211728
args: I,
17221729
app_wrapper: Option<AppWrapper>,
1730+
startup_patch: Option<StartupOptionsPatch>,
17231731
) -> anyhow::Result<u8>
17241732
where
17251733
I: IntoIterator<Item = T>,
@@ -1812,6 +1820,7 @@ where
18121820
#[cfg(feature = "native_viewer")]
18131821
profiler,
18141822
app_wrapper,
1823+
startup_patch,
18151824
)
18161825
};
18171826

@@ -1838,6 +1847,7 @@ fn run_impl_with_wrapper(
18381847
tokio_runtime_handle: &tokio::runtime::Handle,
18391848
#[cfg(feature = "native_viewer")] profiler: re_tracing::Profiler,
18401849
app_wrapper: Option<AppWrapper>,
1850+
startup_patch: Option<StartupOptionsPatch>,
18411851
) -> anyhow::Result<()> {
18421852
let connection_registry = re_redap_client::ConnectionRegistry::new_with_stored_credentials();
18431853

@@ -1959,6 +1969,7 @@ fn run_impl_with_wrapper(
19591969
#[cfg(feature = "server")]
19601970
server_options,
19611971
app_wrapper,
1972+
startup_patch,
19621973
)
19631974
} else {
19641975
Err(anyhow::anyhow!(
@@ -1985,11 +1996,15 @@ fn start_native_viewer_with_wrapper(
19851996
#[cfg(feature = "server")] server_addr: std::net::SocketAddr,
19861997
#[cfg(feature = "server")] server_options: re_sdk::ServerOptions,
19871998
app_wrapper: Option<AppWrapper>,
1999+
startup_patch: Option<StartupOptionsPatch>,
19882000
) -> anyhow::Result<()> {
19892001
use re_viewer::external::re_viewer_context;
19902002
use crate::external::re_ui::{UICommand, UICommandSender as _};
19912003

1992-
let startup_options = native_startup_options_from_args(args)?;
2004+
let mut startup_options = native_startup_options_from_args(args)?;
2005+
if let Some(patch) = startup_patch {
2006+
patch(&mut startup_options);
2007+
}
19932008

19942009
let connect = args.connect.is_some();
19952010
let follow = args.follow;

crates/top/rerun/src/commands/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod analytics;
3535

3636
#[cfg(feature = "analytics")]
3737
pub(crate) use self::analytics::AnalyticsCommands;
38-
pub use self::entrypoint::{run, run_with_app_wrapper, AppWrapper, Args as RerunArgs, native_startup_options_from_args};
38+
pub use self::entrypoint::{run, run_with_app_wrapper, AppWrapper, StartupOptionsPatch, Args as RerunArgs, native_startup_options_from_args};
3939
#[cfg(feature = "data_loaders")]
4040
pub use self::mcap::McapCommands;
4141
pub use self::rrd::RrdCommands;

crates/top/rerun/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub mod demo_util;
124124
pub mod log_integration;
125125

126126
#[cfg(feature = "run")]
127-
pub use commands::{CallSource, run, run_with_app_wrapper, AppWrapper, RerunArgs, native_startup_options_from_args};
127+
pub use commands::{CallSource, run, run_with_app_wrapper, AppWrapper, StartupOptionsPatch, RerunArgs, native_startup_options_from_args};
128128
#[cfg(feature = "log")]
129129
pub use log_integration::Logger;
130130
#[cfg(feature = "log")]

0 commit comments

Comments
 (0)