-
Notifications
You must be signed in to change notification settings - Fork 5
Create DDS Transport Protocol #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
* raw rospubsub and benchmarks * typefixes, shm added to the benchmark * SHM is not so important to tell us every time when it starts * greptile comments * Add co-authorship line to commit message filter patterns * Remove unused contextmanager import --------- Co-authored-by: Ivan Nikolic <lesh@sysphere.org>
Replace base64 string encoding with native IDL bytearray type to eliminate buffer overflow issues. The original base64 encoding exceeded CycloneDDS's default string size limit (~256 bytes) and caused crashes on messages >= 1KB. Key changes: - Use make_idl_struct with bytearray field instead of string - Convert bytes to bytearray when publishing to DDS - Convert bytearray back to bytes when receiving from DDS - Add _DDSMessageListener for async message dispatch - Implement thread-safe DataWriter/DataReader management - Add pickle support via __getstate__/__setstate__ Result: All 12 DDS benchmark tests pass (64B to 10MB messages).
…or Message payload.
The double-checked locking pattern avoids lock contention on every call after initial object creation. Initial benchmarking shows this pattern performs better than simple locking for repeated accesses to the same topics.
Greptile OverviewGreptile SummaryThis PR implements DDS (Data Distribution Service) transport protocol using CycloneDDS, providing a new high-performance pub/sub transport option alongside existing LCM and shared memory transports. Key Changes:
Thread Safety:
Testing: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App
participant DDSTransport
participant DDS
participant DDSService
participant DomainParticipant
participant DataWriter
participant DataReader
participant Listener
Note over App,Listener: Initialization
App->>DDSTransport: __init__(topic, type)
DDSTransport->>DDS: __init__()
DDS->>DDSService: __init__()
Note over App,Listener: Publishing Flow
App->>DDSTransport: broadcast(msg)
DDSTransport->>DDSTransport: acquire _start_lock
DDSTransport->>DDSTransport: check _started
alt not started
DDSTransport->>DDS: start()
DDS->>DDSService: get_participant()
DDSService->>DDSService: acquire _participant_lock
DDSService->>DomainParticipant: create(domain_id)
DDSService->>DDSService: release _participant_lock
end
DDSTransport->>DDSTransport: release _start_lock
DDSTransport->>DDS: publish(topic, msg)
DDS->>DDS: acquire _writer_lock
DDS->>DataWriter: write(msg)
DDS->>DDS: release _writer_lock
Note over App,Listener: Subscription Flow
App->>DDSTransport: subscribe(callback)
DDSTransport->>DDSTransport: acquire _start_lock
DDSTransport->>DDSTransport: check _started
alt not started
DDSTransport->>DDS: start()
end
DDSTransport->>DDSTransport: release _start_lock
DDSTransport->>DDS: subscribe(topic, callback)
DDS->>DDS: acquire _callback_lock
DDS->>DDS: add callback to list
DDS->>Listener: create with callback reference
Listener->>Listener: store callbacks[topic] reference
DDS->>DataReader: create with listener
DDS->>DDS: release _callback_lock
Note over App,Listener: Message Reception
DataReader->>Listener: on_data_available(reader)
Listener->>DataReader: take()
DataReader-->>Listener: samples
loop for each sample
loop for each callback
Listener->>App: callback(sample, topic)
end
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 files reviewed, 3 comments
|
@greptile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 files reviewed, no comments
This merge request implements DDS (Data Distribution Service) transport layer using CycloneDDS, providing a new high-performance pub/sub transport option.
Quick Start
Note
We currently use Eclipse Cyclone DDS as our DDS implementation. Its IdlStruct feature lets you define DDS topic types in pure Python, eliminating the need for separate IDL files, with automatic serialization support.
Unit Tests/Benchmarks
This builds off of #1036, which was closed because the branch was renamed to
miguel/dds_transport