Skip to content

feat(viewer): replace TCP bridge with LCM publisher#2

Open
spomichter wants to merge 1 commit intofeat/interactive-click-bridgefrom
feat/lcm-click-transport
Open

feat(viewer): replace TCP bridge with LCM publisher#2
spomichter wants to merge 1 commit intofeat/interactive-click-bridgefrom
feat/lcm-click-transport

Conversation

@spomichter
Copy link

replaces the custom TCP socket bridge with native LCM transport for click events.

what

viewer now publishes geometry_msgs/PointStamped to /clicked_point via LCM UDP multicast (239.255.76.67:7667), matching the rviz /clicked_point convention.

why

TCP bridge was fragile (port conflicts, connection management, custom protocol). LCM is:

  • connectionless (UDP multicast, no handshake)
  • standard dimos transport (any module can subscribe)
  • wire-compatible with dimos-lcm PointStamped type
  • follows rviz convention (/clicked_point topic, frame_id = entity path)

changes

file what
interaction/lcm.rs new LCM publisher — ClickEvent type, encode_point_stamped, build_lcm_packet, LcmPublisher (UDP multicast), 10 unit tests
interaction/mod.rs export LCM types
viewer.rs replaced TCP ViewerEventSender with LcmPublisher

wire format

LCM packet: magic(4) + seq(4) + channel_len(4) + channel + data_len(4) + data
Data: fingerprint(8) + Header(seq + stamp + frame_id) + Point(x + y + z)
Fingerprint: 0x9cd764738ea629af (verified byte-exact match with Python LCM)

testing

cargo test -p custom_callback -- interaction::lcm  # 10 tests

cross-language wire compat verified — rust and python produce byte-identical payloads.

DIM-643

Replace the TCP-based ViewerEventSender with an LCM UDP multicast
publisher for sending click events from the Rerun viewer to Python.

Changes:
- Add interaction/lcm.rs: LcmPublisher that encodes and sends
  geometry_msgs/PointStamped messages via UDP multicast (239.255.76.67:7667)
- Update viewer.rs: use LcmPublisher instead of ViewerEventSender,
  publish click events on '/clicked_point#geometry_msgs.PointStamped'
- Update interaction/mod.rs: export LCM types (ClickEvent, LcmPublisher,
  click_event_from_ms, click_event_now)

The LCM encoding is verified byte-for-byte compatible with Python's
dimos_lcm.geometry_msgs.PointStamped via unit tests (10 Rust tests)
and cross-language integration tests (15 Python tests).

Wire format: [8B fingerprint hash][Header: seq+stamp+frame_id][Point: x+y+z]
Fingerprint: 0x9cd764738ea629af (matches Python LCM recursive hash)
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