python-eventdispatch
eventdispatch is a Python package for solving the discrete time synchronization problem in any computer system. It consists of:
- A core python module, containing the following classes:
- Blackboard, a thread safe dictionary
- EventThread, a thread subclass
- Event, the abstract base class to override
- Your use case can be decomposed down to
EventDispatchandEventchild classes
- Your use case can be decomposed down to
- EventDispatch, which defines core mechanism functions
- Various other decorators, helper functions
- A common1 python module, with:
- BlackboardQueueCVED, a example Dispatch subclass that ties the above together
- You are encouraged to subclass and override or create your own
EventDispatchchild class
- You are encouraged to subclass and override or create your own
- A
CommonEventclass, with some useful, but not necessary logic - Various other decorators, helper functions
- BlackboardQueueCVED, a example Dispatch subclass that ties the above together
-
[0.2.*] A composite_semaphore python module, with:
- CompositeSemaphore, a semaphore that supports multiple 'left's and 'right's
- CSWait, an Event subclass that registers a CompositeSemaphore on some tokens (comma-separated strs) and some Event serializations on the right
- CSRelease, an Event subclass that produces some tokens to possibly unblock some CSWaits.
- Combined with CSWait, this pair allows volatility, on-the-fly associations between Events as opposed to an Event type hardcoding what to dispatch next in its finish definition
- CSBQCVED, a BlackboardQueueCVED subclass that enforces CSWait ordering, necessary if one wants to use CS* mechanisms
-
A example1 python program, you can run after installing via command line:
eventdispatch_example1 - A cs_main python program, you can run after installing via command line:
eventdispatch_cs_main - A example2 python program, you can run after installing via command line:
eventdispatch_example2
virtualenv try-eventdispatch
. try-eventdispatch/bin/activate
pip install eventdispatch
Install via ROS2-(>=Jazzy) APT
sudo apt-get install -y ros-jazzy-eventdispatch-python
sudo apt-get install -y ros-jazzy-eventdispatch-ros2-interfaces
sudo apt-get install -y ros-jazzy-eventdispatch-ros2
-
EventDispatch is based on the idea that what happens defines what happens next. Independently derived, the idea is a mirror of Markov chains.
- EventDispatch frames all computer programs as superpositioned Markov processes.
- Control is about inducing and then injecting synthetic steering into superpositioned Markov transitions.
-
Other synchronization architectures exist such as behavior trees and state machines.
- Compared to those architectures, eventdispatch is thin, scalable, inherently concurrent.
- The number of events active in memory in a system using EventDispatch is theoretically limited by the CPU's thread limit.
- The number of Events defined/declared/dispatchable in such a system theoretically limited by the machine's runtime memory limit.
- Dispatch is a verb, not a noun. Within a system, more than one component can dispatch events.
- Events do not impose any meta-language on the practioner, within the 3 interface functions you are free to write in the native language. It remains trivial to express complex behaviours.
- Compared to those architectures, eventdispatch is thin, scalable, inherently concurrent.
-
EventDispatch is a mechanism from robotics. However, it is relevant to any system that faces volatility in what is asked of it (the right), and uncertainty in what it asks of others (the left). See Usage patterns & best practices.
The EventDispatch mechanism can be extended to a variety of messaging mechanisms in their respective packages, their documentations listed here:
- ROS2 (WIP)
For any new messaging mechanism integrations or use case ideas, email me!