Decouples the MQTT section of Astoria from sr-robot3, the message structures are still imported from Astoria.
To avoid the issues surrounding appropriate methods to do async event loop clean up in a largely synchronous codebase, this moves to using the paho-mqtt library which uses a background thread to handle the network loop. Cleanup is then handled by an atexit handler to disconnect and close the network loop thread.
To keep it simple there is a single long running client that is created within the robot's init routine and metadata and wait_start are done by temporarily subscribing to the relevant topics. Timeouts are used on the threading Events to prevent indefinite blocking.
Fixes the issue with make_safe not running when killed from the webUI when used with https://github.com/srobo/astoria/pull/180.
Decouples the MQTT section of Astoria from sr-robot3, the message structures are still imported from Astoria. To avoid the issues surrounding appropriate methods to do async event loop clean up in a largely synchronous codebase, this moves to using the paho-mqtt library which uses a background thread to handle the network loop. Cleanup is then handled by an atexit handler to disconnect and close the network loop thread.
To keep it simple there is a single long running client that is created within the robot's init routine and metadata and wait_start are done by temporarily subscribing to the relevant topics. Timeouts are used on the threading Events to prevent indefinite blocking.