damiafuentes / DJITelloPy

DJI Tello drone python interface using the official Tello SDK. Feel free to contribute!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reconnect to the drone in the same script

azizbelkhiria opened this issue · comments

is there a way to disconnect and reconnect tot the drone without leaving the script? I using it on a training algorithm and need to change the battery sometime.

The drone uses stateless UDP packets.
This means after swapping batteries and reconnecting the WiFi all you need to do is call drone.connect() again, which tells the restarted drone you PC controls it.
If you are also using the camera stream you can stop the video stream using drone.streamoff() before swapping the battery and drone.streamon() for starting it again. Maybe it could even work without restarting, but you have to try that.

Nevertheless training is usually done "offline", i.e. record a bunch of videos and other data and then use that data for training. You will probably change the parameters of the training a couple of times. Only training with live data will result in a very long development and training duration.