feat(viewer): interactive click-to-coordinate with Python bridge#1
Open
spomichter wants to merge 3 commits intomainfrom
Open
feat(viewer): interactive click-to-coordinate with Python bridge#1spomichter wants to merge 3 commits intomainfrom
spomichter wants to merge 3 commits intomainfrom
Conversation
…ration Adds click-to-coordinate support to the custom_callback viewer example. When a user clicks on an entity in a 2D/3D spatial view, world-space coordinates are sent via TCP to a Python bridge for downstream processing. Changes: - interaction/protocol.rs: ViewerEvent + AppCommand enums (bincode serde) - interaction/handle.rs: InteractionHandle mpsc wrapper with unit tests - interaction/sender.rs: TCP client with auto-reconnect to Python bridge - viewer.rs: on_event callback intercepting SelectionChange events, 100ms debounce, rapid-click detection - build-viewer.yml: CI workflow for Linux x64 + macOS arm64 Uses the official StartupOptions::on_event callback API — zero changes to rerun core crates. All modifications are in examples/rust/custom_callback/. DIM-643
There was a problem hiding this comment.
Hi! Thanks for opening this pull request.
Because this is your first time contributing to this repository, make sure you've read our Contributor Guide and Code of Conduct.
Python TCP server + bincode codec that receives click events from the custom viewer. Provides @on_click decorator API for handling world-space coordinates. Files: - bincode_codec.py: pure Python bincode encoder/decoder - bridge_bincode.py: production TCP server (bincode protocol) - bridge.py: development TCP server (JSON protocol) - test_bridge.py: 4 JSON bridge tests - test_bridge_bincode.py: 6 bincode bridge tests DIM-643
Rerun's picking only fires on entity clicks. This adds a helper that logs a large, nearly-invisible subdivided mesh at z=0 so clicks on empty floor space still produce world-space coordinates. Usage: from ground_plane import log_ground_plane log_ground_plane() # 200m x 200m at z=0, alpha=1 DIM-643
5343326 to
ea403b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
adds click-to-coordinate support to the custom_callback viewer example. click on an entity in a 2D/3D spatial view → world-space coordinates sent via TCP to a Python bridge.
why
DimOS needs click-to-navigate — operators click on a map point, robot goes there. rerun is currently read-only with no backchannel from viewer to application.
uses the official
StartupOptions::on_eventcallback API. zero changes to rerun core crates — everything lives inexamples/rust/custom_callback/.changes
interaction/protocol.rsViewerEvent+AppCommandenums with bincode serdeinteraction/handle.rsInteractionHandle— mpsc channel wrapper, 3 unit testsinteraction/sender.rsViewerEventSender— TCP client with auto-reconnectinteraction/mod.rsviewer.rson_eventcallback: interceptSelectionChange, debounce (100ms), send via TCPpython_bridge/bincode_codec.pypython_bridge/bridge_bincode.pypython_bridge/bridge.pypython_bridge/ground_plane.pybuild-viewer.ymlarchitecture
setup & build (Ubuntu 22.04)
1. install rust
2. install system dependencies
sudo apt-get update && sudo apt-get install -y \ build-essential cmake clang \ libgtk-3-dev \ libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ libxkbcommon-x11-dev libxkbcommon-dev \ libvulkan-dev \ libwayland-dev3. clone & build
4. run tests
e2e test (requires display)
terminal 1 — python bridge
terminal 2 — viewer
should see in terminal 1:
Viewer connected from ('127.0.0.1', ...)terminal 3 — log test data
option A: entity spheres only (click on visible objects)
option B: with ground plane (click anywhere on the floor)
what to verify
DIM-643