DJITelloPy
DJITelloPy copied to clipboard
Fix Reconnect Issue
Client socket is never bound to receiving port to receive drone replies; This causes DJITelloPy to not be able to reconnect after running a script once. By binding it, the drone is able to reconnect without issue.
This was adopted from my other branch, LightDJITelloPy.
Just saw #143 ; Really interesting. After rigorous testing, this exact line, when removed, gives weird behavior. On all the EDU drones I've tested on, the first time you run any script (even if it only contains a single connect() call) the drone works perfectly. However, if you run the script again while the drone is still on, the program hangs on client_socket.recv(1024)
. This might be good for a simulator, but for a bunch of students it is inconvenient. Sending commands to the drone work perfectly, so it is only client_socket
that can't reconnect.
This seems to be a socket issue rather than a Tello issue. If you run the library both times with the bind() call, you can reconnect just fine. However, if you run the library without the bind(), run it once, then run it again with the bind() call while the drone is still on, you cannot reconnect unless you reboot the drone.
It is important to note that I have tested this on Mac, Linux, Chromebook, and Android (thanks to LightDJITelloPy), and not Windows yet.
I finally got around testing all my Tello batteries, most of them are dead now, but two seem to work. Indeed i had the same problems you describe with one of my Tello EDUs. I merged this PR as part of #168 by @IEEERoboticsWSU which also included an update to the setup.py script