Messaging System
The Roboticks SDK provides a distributed publish/subscribe messaging system for inter-module communication.Overview
Modules communicate by publishing messages to topics and subscribing to receive messages from topics. This decouples modules and enables flexible system composition.Defining Ports in YAML
The easiest way to create publishers and subscribers is through YAML configuration:sensor_data_input_- A subscriber to/sensors/lidarprocessed_output_- A publisher to/processed/data
Using Ports in Code
Publishing Messages
Receiving Messages
Quality of Service (QoS)
The messaging system supports two QoS levels:| QoS | Use Case | Behavior |
|---|---|---|
RELIABLE | Commands, status, critical data | Guarantees delivery, may queue messages |
BEST_EFFORT | High-frequency sensors, streaming | Drops messages if receiver is slow |
Choosing QoS
Manual Port Creation
For advanced use cases, create ports programmatically:Message Types
Built-in Messages
The SDK includes common message types:Defining Custom Messages
Create YAML message definitions inmessages/definitions/:
Using Custom Messages
Topic Naming Conventions
Use hierarchical topic names:Multi-Robot Communication
For fleet-wide communication, use namespaced topics:Performance Tips
Batch high-frequency data
Batch high-frequency data
Instead of publishing every sensor reading individually, batch them:
Use appropriate buffer sizes
Use appropriate buffer sizes
Configure subscriber buffers based on your needs:
Avoid blocking in callbacks
Avoid blocking in callbacks
Process messages asynchronously if they take time:
Next Steps
Examples
See complete working examples