Python cannot connect to second launch of mavsdk_server
I'm on a RPi Zero W running a fresh Raspbian 2020-01-11. mavsdk-python is installed via pip3.
Connecting to a PX4 flight controller over UART serial. This problem may exist in other configurations.
This problem can be replicated with mission.py. When I run it once, it successfully connects to the flight controller and uploads a mission. However, on the second execution await drone.connect() fails with the error below. There's no mavsdk_server process lingering after the python process exits. After a reboot of the rpi, it works again. Once.
I can start mavsdk_server manually, and connect to it by parameterizing System(...). So long as that process is running, I can connect over and over.
Slack thread here: https://px4.slack.com/archives/C68J8H32A/p1610644642007500
Waiting for drone to connect...
__anext__ grpc exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/aiogrpc/utils.py", line 145, in cb
fut.result()
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/dist-packages/aiogrpc/utils.py", line 131, in _next
return next(self._iterator)
File "/usr/local/lib/python3.7/dist-packages/grpc/_channel.py", line 416, in __next__
return self._next()
File "/usr/local/lib/python3.7/dist-packages/grpc/_channel.py", line 786, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "Socket closed"
debug_error_string = "{"created":"@1610644261.615247515","description":"Error received from peer ipv6:[::1]:50051","file":"src/core/lib/surface/call.cc","file_line":1063,"grpc_message":"Socket closed","grpc_status":14}"