Classes for network communication.
There are two general types of network objects -
autopilot.networking.Stationand its children are independent processes that should only be instantiated once
per piece of hardware. They are used to distribute messages between
Net_Nodes, forward messages up the networking tree, and responding to messages that don’t need any input from the
Net_Nodeis a pop-in networking class that can be given to any other object that
wants to send or receive messages.
Message object is used to serialize and pass
messages. When sent, messages are
JSON serialized (with some special magic
to compress/encode numpy arrays) and sent as
zmq multipart messages.
Each serialized message, when sent, can have
n frames of the format:
[hop_0, hop_1, ... hop_n, final_recipient, serialized_message]
Or, messages can have multiple “hops” (a typical message will have one ‘hop’ specified
to field), the second to last frame is always the final intended recipient,
and the final frame is the serialized message. Note that the
to field of a
Message object will always be the final recipient
even if a list is passed for
to when sending. This lets
objects efficiently forward messages without deserializing them at every hop.
Pack an array with