The Pub / Sub Paradigm - Overview
Introduction to the Topic / Sub paradigm used by Sunset.
Last updated
Introduction to the Topic / Sub paradigm used by Sunset.
Last updated
In other systems such as programming the implementor usually creates individual subsystem classes to represent their robot. One might have a drivetrain subsystem, an elevator mechanism, vision, etc. This works well for smaller, more controlled environments where design goals and constraints are very well known. This model unfortunately begins to fall apart once you need to perform lots of communication between subsystems or integrate new APIs quickly.
The Topic / Subscriber (or pub / sub) system works a little differently. The Pub/Sub paradigm defines Topics (similar to smaller, less complete subsystems) that can do nothing but send and receive messages each time their periodic method is called. In Sunset these messages will take the form of python dictionaries.
To take full advantage of the sunset logging capability, make sure all of your message types are serializable to JSON.
These messages will be sent to all of the subscribers of the sending topic once generated by the periodic method. A copy of this message will then be stored in the messages dictionary of the subscriber for it to use in its own processing.