Open merlinran opened 2 years ago
Some thoughts on communication in the large. A robot needs to communicate with either the server / control application, other robots in the fleet, or optionally, 3rd party services, directly or forwarded by the server. The network environment is inherently unreliable. The Wifi signal can be weak; The target robot / server may be temporarily loss power or out of signal coverage. Weather and electromagnetic noise can happen.
The types of messages can be categorized as follows:
If we use zMQ, PUB/SUB may be a better fit than REQ/REP patterns, and possibly with multicast. An alternative is https://github.com/libp2p/py-libp2p, which has message propagation and security features built in, if we want to use in conjunction with wireless ad-hoc network.
For now, given that we introduced SocketIO for realtime update of herd data, it makes sense to replace zMQ based robot-server communication with SocketIO as well, to greatly reduce code complexity. If we ever want to use zMQ again, the PUB/SUB pattern needs a different implementation from the current REQ/REP one.
You might like https://github.com/markqvist/Reticulum once C port is complete I'm hoping meshtastic.org will use it as network stack.
Currently pipe, zMQ and shared memory are used. Pipe is feature limited and caused some issues.