networking
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 onceper 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 thePilotorTerminal.
Net_Nodeis a pop-in networking class that can be given to any other object thatwants to send or receive messages.
The 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
by the 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 Station
objects efficiently forward messages without deserializing them at every hop.
Functions:
|
Pack an array with |
- serialize_array(array)[source]
Pack an array with
blosc.pack_array()and serialize withbase64.b64encode()- Parameters:
array (
numpy.ndarray) – Array to serialize- Returns:
{‘NUMPY_ARRAY’: base-64 encoded, blosc-compressed array.}
- Return type:
- station
StationTerminal_StationTerminal_Station.plot_timerTerminal_Station.sent_plotTerminal_Station.pusherTerminal_Station.loopTerminal_Station.start_plot_timer()Terminal_Station.l_ping()Terminal_Station.l_init()Terminal_Station.l_change()Terminal_Station.l_stopall()Terminal_Station.l_data()Terminal_Station.l_continuous()Terminal_Station.l_state()Terminal_Station.l_handshake()Terminal_Station.l_file()
Pilot_StationPilot_Station.pusherPilot_Station.l_noop()Pilot_Station.l_state()Pilot_Station.l_cohere()Pilot_Station.l_ping()Pilot_Station.l_start()Pilot_Station.loopPilot_Station.l_stop()Pilot_Station.l_change()Pilot_Station.l_file()Pilot_Station.l_continuous()Pilot_Station.l_child()Pilot_Station.l_forward()
- node
Net_NodeNet_Node.repeat_intervalNet_Node.contextNet_Node.loopNet_Node.closingNet_Node.listensNet_Node.idNet_Node.upstreamNet_Node.portNet_Node.routerNet_Node.loop_threadNet_Node.sendersNet_Node.init_networking()Net_Node.threaded_loop()Net_Node.handle_listen()Net_Node.send()Net_Node.repeat()Net_Node.l_confirm()Net_Node.l_stream()Net_Node.prepare_message()Net_Node.get_stream()Net_Node.ipNet_Node.release()
- Message