ROS(ROS2) are solutions to the inter-process communication problem, among other metaphors
python-eventdispatch (github) uses ROS2 as a message bus for robotics use-cases.
It does so with 3 packages in this upstream super-repo.
- eventdispatch_python (provides the eventdispatch library)
- eventdispatch_ros2_interfaces (ROSEvent.msg/srv)
- eventdispatch_ros2 (ed_node, stage.launch)
Instantiates a class child of CSBQCVED, Node
class ROS2QueueCVED(CSBQCVED, Node):
CSBQCVED :
Composite
Semaphore
Blackboard
Queue
Condition
Variable
Event
Dispatch
~/dispatchservice, subscription~/dispatch_listservice, subscription (batch version)events_module_pathros2 parameter
The events_module_path is a folder that is expected to have an events.py file that defines the following variables:
from events import event_dict, initial_events, events_module_update_blackboard, on_shutdown, make_validator
(note that events.py can be symlinked, and import each other or refactored for reuse)
- event_dict
This is a mapping str -> Class for the blackboard
- initial_events
list[[event primitives]], initial boundary conditions to dispatch
- events_module_update_blackboard
populate the blackboard with assets, ROS adapters, etc.
- on_shutdown
intended to be a graceful handler, but ROS shutdown is blunt
- make_validator
return a class that checks requests, stub to add extra logic
Convienence launch file, exposing the 2 most important launch args to ed_node
- node_name
- events_module_path
The idea is to stand up various ed_node instances via stage.launch as needed.
Since ed is such a compact framework, it may be more likely to expand capability by growing the Event subclasses in a blackboard than spawning more instances, but is an option anyways.