Skip to content

ROS transports initial#1057

Merged
paul-nechifor merged 41 commits intodevfrom
ros-transport-wrap
Jan 20, 2026
Merged

ROS transports initial#1057
paul-nechifor merged 41 commits intodevfrom
ros-transport-wrap

Conversation

@leshy
Copy link
Contributor

@leshy leshy commented Jan 19, 2026

Dimos LCM and ROS msgs have the same structure, conversion between the two should be automatic and transparent. we want to send anything from dimos.msgs to ros

(using fg here but don't want anything actually :D)
./bin/dev dimos --viewer-backend foxglove --replay run unitree-go2-ros
rviz2

2026-01-19_20-00

main stuff

  • Implements ROSTransport
  • rospubsub_converter.py mostly vibed, converts LCM<->ROS msgs - works but might completely rewrite soon

funny stuff

  • some of our dimos.msgs have non standard init and storage (can't init like other LCM msgs) so we can't do a smooth recursive copy from ros (like PointCloud2, totally diff init totally diff attrs) so we first build a raw LCM msg, then LCM.encode() and PointCloud2.decode() this binary - this sucks. For non standard types we should still accept default fields for init() but have custom classmethod inits or something like this

cleanup

  • Removes dispatch from Vector3 class
  • removed LidarMessage from unitree go2, we just use PointCloud2 now, (will delete a lot from unitree_webrtc in the follow up PRs)

misc

  • adds X11 passthrough to a devcontainer
  • adds md-babel-py to dev deps (for docs code exec)

@leshy leshy requested a review from a team January 19, 2026 03:58
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 19, 2026

Greptile Overview

Greptile Summary

Implements ROS transport integration for dimos, enabling automatic conversion between dimos.msgs and ROS messages with transparent LCM↔ROS interoperability.

Key changes:

  • Implemented RawROS and DimosROS pubsub classes with automatic message conversion
  • Created rospubsub_conversion.py module with recursive field copying and LCM roundtrip for complex types (PointCloud2, Image, CameraInfo, PoseStamped)
  • Added ROSTransport to core transport layer
  • Refactored Vector3.__init__ from plum dispatch to standard conditionals for better compatibility
  • Removed custom LidarMessage class in favor of standard PointCloud2
  • Added comprehensive test coverage for simple and complex message types
  • Added X11 passthrough to devcontainer and md-babel-py dev dependency

Issue found:

  • Test fixture ros_node() missing @pytest.fixture decorator (line 35)

Confidence Score: 4/5

  • This PR is safe to merge with one test fixture issue that needs fixing
  • Score reflects solid implementation of ROS transport with comprehensive test coverage, but has one syntax error preventing tests from running correctly
  • Pay close attention to dimos/protocol/pubsub/test_rospubsub.py - the missing fixture decorator will cause test failures

Important Files Changed

Filename Overview
dimos/protocol/pubsub/rospubsub.py Implemented ROS transport with auto-generated node names, improved threading, proper cleanup, and DimosROS wrapper for automatic message conversion
dimos/protocol/pubsub/rospubsub_conversion.py New conversion module handling recursive LCM↔ROS message conversion with special handling for complex types via LCM roundtrip
dimos/core/transport.py Added ROSTransport class integrating DimosROS into the transport layer with proper lifecycle management
dimos/protocol/pubsub/test_rospubsub.py Added comprehensive ROS pubsub tests covering simple types, complex types with custom representations, and nested messages; missing fixture decorator
dimos/msgs/geometry_msgs/Vector3.py Replaced plum dispatch with standard Python conditionals for cleaner init logic and better ROS compatibility

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant DRT as DimosROS Transport
    participant RR as RawROS
    participant Conv as Conversion Module
    participant ROS as ROS2 Node
    participant Sub as Subscriber

    Note over App,Sub: Publishing Flow
    App->>DRT: publish(ROSTopic, dimos_msg)
    DRT->>Conv: dimos_to_ros(dimos_msg, ros_type)
    alt Complex Type (PointCloud2, Image, etc)
        Conv->>Conv: msg.lcm_encode()
        Conv->>Conv: lcm_type.lcm_decode(bytes)
        Conv->>Conv: _copy_lcm_to_ros_recursive()
    else Simple Type (Vector3, Twist, etc)
        Conv->>Conv: _copy_lcm_to_ros_recursive()
    end
    Conv-->>DRT: ros_msg
    DRT->>RR: publish(RawROSTopic, ros_msg)
    RR->>ROS: publisher.publish(ros_msg)
    ROS->>Sub: ros_msg delivered

    Note over App,Sub: Subscribing Flow
    App->>DRT: subscribe(ROSTopic, callback)
    DRT->>RR: subscribe(RawROSTopic, wrapped_callback)
    RR->>ROS: create_subscription(ros_type, internal_callback)
    ROS-->>RR: subscription
    RR-->>DRT: unsubscribe_fn
    DRT-->>App: unsubscribe_fn

    Note over App,Sub: Message Reception
    Sub->>ROS: publish ros_msg
    ROS->>RR: internal_callback(ros_msg)
    RR->>DRT: wrapped_callback(ros_msg)
    DRT->>Conv: ros_to_dimos(ros_msg, dimos_type)
    alt Complex Type
        Conv->>Conv: _copy_ros_to_lcm_recursive()
        Conv->>Conv: lcm_msg.lcm_encode()
        Conv->>Conv: dimos_type.lcm_decode(bytes)
    else Simple Type
        Conv->>Conv: _copy_ros_to_lcm_recursive()
    end
    Conv-->>DRT: dimos_msg
    DRT->>App: callback(dimos_msg, topic)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@leshy
Copy link
Contributor Author

leshy commented Jan 20, 2026

@greptileai can you recheck

greptile-apps[bot]

This comment was marked as outdated.

@leshy leshy changed the title WIP: ros transport msg conversions ROS transports initial Jan 20, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

self.x = float(lcm_vector.x)
self.y = float(lcm_vector.y)
self.z = float(lcm_vector.z)
def __init__(self, *args: Any, **kwargs: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

paul-nechifor
paul-nechifor previously approved these changes Jan 20, 2026
@paul-nechifor paul-nechifor merged commit 9cd4921 into dev Jan 20, 2026
14 checks passed
spomichter added a commit that referenced this pull request Jan 23, 2026
… Unitree Go2 Navigation & Exploration Beta

Pre-Release v0.0.8: Unitree Go2 Navigation & Exploration Beta, Transport Updates, Documentation updates, Rerun fixes, Person follow, Readme updates

## What's Changed
* Small docs clarification about stream getters by @leshy in #1043
* Fix split view on wide monitors by @jeff-hykin in #1048
* Docs: Install & Develop  by @jeff-hykin in #1022
* Add uv to nix and fix resulting problems by @jeff-hykin in #1021
* v0.0.8 by @paul-nechifor in #1050
* Style changes in docs by @paul-nechifor in #1051
* Revert "Add uv to nix and fix resulting problems" by @leshy in #1053
* Transport benchmarks + Raw ros transport by @leshy in #1038
* feat: default to rerun-web and auto-open browser on startup (browser … by @Nabla7 in #1019
* bbox detections visual check by @leshy in #1017
* fix: only auto-open browser for rerun-web viewer backend by @Nabla7 in #1066
* move slow tests to integration by @paul-nechifor in #1063
* Streamline transport start/stop methods by @Kaweees in #1062
* Person follow skill with EdgeTAM by @paul-nechifor in #1042
* fix: increase costmap floor z_offset to avoid z-fighting by @Nabla7 in #1073
* Fixed issue #1074 by @alexlin2 in #1075
* ROS transports initial by @leshy in #1057
* Fix System Config Values for LCM on MacOS and Refactor by @jeff-hykin in #1065
* SHM Transport basic fixes by @leshy in #1041
* commented out Mem Transport test case by @leshy in #1077
* Docs/advanced streams update 2 by @leshy in #1078
* Fix more tests by @paul-nechifor in #1071
* feat: navigation docker updates from bona_local_dev by @baishibona in #1081
* Fix missing dependencies by @Kaweees in #1085
* Release readme fixes by @spomichter in #1076

## New Contributors
* @baishibona made their first contribution in #1081

**Full Changelog**: v0.0.7...v0.0.8
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.

2 participants