[vibed experiment] Add Rust language interop example#1622
Conversation
Adds a Rust robot control example that subscribes to /odom (PoseStamped) and publishes /cmd_vel (Twist) via LCM UDP multicast, matching the existing C++/Lua/TypeScript interop examples. Includes a minimal LCM transport implementation using socket2 and the generated Rust message types from dimos-lcm. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move LCM UDP transport to the dimos-lcm repo where it belongs (matching the TS @dimos/lcm pattern). The example now depends on the dimos-lcm crate for transport and lcm-msgs for message types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ep loop - Pin dimos-lcm and lcm-msgs deps to specific rev instead of branch (branch refs are mutable; rev is immutable for reproducible builds) - Replace fixed 1ms sleep with deadline-aware sleep capped at 10ms, avoiding unnecessary CPU wake-ups while still being responsive Addresses review comments on PR #1622. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Non-interactive Rust LCM interop test resultsAdded automated tests to the 7 roundtrip/binary tests (
4 UDP multicast pubsub tests (
All 11 tests pass. No external services, no interactive steps. A few non-blocking observations for the PR author:
None of these block the PR. |
Wire compat tests validate Python/Rust binary format agreement (fingerprints, known byte layouts, roundtrips) without needing external toolchains. Subprocess integration tests run Rust, TS, and C++ binaries against headless simplerobot via LCM, skipping gracefully when toolchains are unavailable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds test_lua_interop.py following the same subprocess/graceful-skip pattern as Rust/TS/C++ tests. Also adds LUA_DIR constant to conftest.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Non-interactive language interop tests addedFollowing the request to add non-interactive tests for Rust and other languages, the following test files were added to Wire compatibility tests (
Subprocess integration tests (skip gracefully if toolchain absent):
All integration tests use Run wire-only tests with no dependencies: |
| os.environ.get("CI_NO_MULTICAST") is not None, | ||
| reason="multicast unavailable", | ||
| ) | ||
| def test_rust_binary_receives_pose( |
There was a problem hiding this comment.
Should be marked with slow
| return str(e.stdout or ""), str(e.stderr or "") | ||
|
|
||
|
|
||
| def test_rust_binary_publishes_twist( |
There was a problem hiding this comment.
Should be marked with slow.
| pytestmark = pytest.mark.interop | ||
|
|
||
|
|
||
| def test_cpp_receives_pose_and_publishes_twist( |
There was a problem hiding this comment.
Two of the tests fail for me:
_________________________________________________________________________________________ test_cpp_receives_pose_and_publishes_twist __________________________________________________________________________________________
simplerobot = <Popen: returncode: None args: ['/home/p/pro/dimensional/dimos/.venv/bin/pyt...>, cpp_binary = PosixPath('/home/p/pro/dimensional/dimos/examples/language-interop/cpp/build/robot_control')
def test_cpp_receives_pose_and_publishes_twist(
simplerobot: subprocess.Popen[str],
cpp_binary: Path,
) -> None:
"""Run the C++ binary for a few seconds and verify message exchange."""
try:
result = subprocess.run(
[str(cpp_binary)],
capture_output=True,
text=True,
timeout=5,
)
except subprocess.TimeoutExpired as e:
stdout = e.stdout or ""
stderr = e.stderr or ""
else:
stdout = result.stdout
stderr = result.stderr
> assert "[pose]" in stdout, (
f"C++ binary never received a PoseStamped.\nstdout: {stdout!r}\nstderr: {stderr!r}"
)
E TypeError: a bytes-like object is required, not 'str'
examples/language-interop/tests/test_cpp_interop.py:46: TypeError
__________________________________________________________________________________________ test_ts_receives_pose_and_publishes_twist __________________________________________________________________________________________
simplerobot = <Popen: returncode: None args: ['/home/p/pro/dimensional/dimos/.venv/bin/pyt...>, deno_available = None
def test_ts_receives_pose_and_publishes_twist(
simplerobot: subprocess.Popen[str],
deno_available: None,
) -> None:
"""Run the Deno TS script for a few seconds and verify message exchange."""
try:
result = subprocess.run(
["deno", "run", "--allow-net", "--unstable-net", str(TS_DIR / "main.ts")],
capture_output=True,
text=True,
timeout=5,
cwd=str(TS_DIR),
)
except subprocess.TimeoutExpired as e:
stdout = e.stdout or ""
stderr = e.stderr or ""
else:
stdout = result.stdout
stderr = result.stderr
> assert "[pose]" in stdout, (
f"TS script never received a PoseStamped.\nstdout: {stdout!r}\nstderr: {stderr!r}"
)
E TypeError: a bytes-like object is required, not 'str'
examples/language-interop/tests/test_ts_interop.py:55: TypeError
=================================================================================================== short test summary info ===================================================================================================
SKIPPED [1] examples/language-interop/tests/test_lua_interop.py:35: lua not found on PATH
FAILED examples/language-interop/tests/test_cpp_interop.py::test_cpp_receives_pose_and_publishes_twist - TypeError: a bytes-like object is required, not 'str'
FAILED examples/language-interop/tests/test_ts_interop.py::test_ts_receives_pose_and_publishes_twist - TypeError: a bytes-like object is required, not 'str'
|
|
||
| from .conftest import LUA_DIR | ||
|
|
||
| pytestmark = pytest.mark.interop |
There was a problem hiding this comment.
What is the use for this interop mark?
|
@leshy These commits have Claude as a co-author... not sure if we care about that anymore. Also, I assume Claude doesn't run |
| @@ -0,0 +1,51 @@ | |||
| # Copyright 2026 Dimensional Inc. | |||
There was a problem hiding this comment.
Some of the scripts and docs use pytest dimos. That means these tests will not be executed. Can you please move them or change all those places to remove dimos.
Actually, the tests don't get executed at all even in CI because we have testpaths = ["dimos"] in pyproject.toml
|
yeah sorry, I should have tagged the PR (talked on discord on this also) was experimenting with fully autonomous PRs last night |
Summary
examples/language-interop/rust/matching the existing C++, Lua, and TypeScript examples/odom(PoseStamped) and publishes/cmd_vel(Twist) at 10 Hzrust-codegenbranch)Dependencies
lcm-msgsgit dependency fromdimos-lcmrust-codegenbranch — once that PR merges, update tomainbyteorderandsocket2from crates.io (no system deps)Test plan
cargo checkpassescargo build --releasepassescargo clippypasses with no warningssimplerobot(requires running robot instance)🤖 Generated with Claude Code