Coding4Fun Drone posts
- Introduction to DJI Tello
- Analyzing Python samples code from the official SDK
- Drone Hello World ! Takeoff and land
- Tips to connect to Drone WiFi in Windows 10
- Reading data from the Drone, Get battery level
- Sample for real time data read, Get Accelerometer data
- How the drone camera video feed works
- Accesing the drone camera video feed
I my previous posts I shared some links about the DJI Tello drone. One of them is the SDK 188.8.131.52. In this document we can find the main commands and descriptions of the specifics commands to use to communicate with the drone.
The document also links a Python sample file with the following code:
The code is very easy to read:
- Lines 10-14. Defines the main libraries to be used. I never used sockets and threads in Python, so this is an excellent chance for me to learn about this
- Lines 16-26. Implements the basic communication via UDP described in the architecture from the SDK. Accessing the drone via IP 192.168.10.1 and port 8889, and bind to localhost with post 9000
- Lines 28-48. Function to receive data from the drone. It’s executed in an different thread, so here are my 1st multi-threading python app.
- Lines 50-74. Main App Loop, where it waits for user type command and send the command to the drone. It also checks for Python version, and close the socket before end.
An amazing way to start playing with the drone. Just 5 minutes to connect and have something up and running.