We’ll write code to connect to, receive telemetry from, and send commands to our Tello drone to allow us to fly in position control.
This and future set of practicals utilize the DJI Tello Drone and its Python SDK. All the challenges should be completed using Python >= 3.6.
SDK documentation for the
djitellopy library is available here. As of December 2021, this repository is more actively maintained than DJI’s official repository. There are also lots of great YouTube tutorials if you get stuck.
The content on Tello passports is adapted from the slide deck used to track student progress.
This unit’s challenges include:
- Connect to your drone
- Display drone telemetry
- Fly your drone in position control
- Fly around objects in your house
If you get stuck, refer to the resources page and reach out to other students and your instructors for help!
Write a simple script in your IDE of choice to initialize your Tello, connect to it over Wi-Fi, and display some basic information about the drone (e.g. battery percentage) to confirm that you have successfully connected. When done, take a screenshot of your python output where you printed your drone information and show it to your instructors. You may run into seem errors establishing a socket connection through the SDK. Make sure you read the documentation FAQs before asking for help.
Write a script to connect to your Tello the same way you did in the previous challenge, but now, have the drone takeoff, hover for a certain period of time (e.g. 3 seconds), then land.
Hint Use the
sleep()function from the
timepackage to have the drone hover before it lands. When done, take a picture of your Tello with your phone while it’s hovering.
Write a script to fly around your room via commands that tell the drone to move a specific distance. (e.g. make your drone fly in a square)
rotate_clockwise()functions will help a lot! Take a video on your phone and embed the link on the next slide. YouTube unlisted might be a good way to do this if you have an account.
Write a script to fly around a specific object in your room via commands that tell the drone to move a specific distance. (e.g. fly around a chair) Get creative!!
Take a video on your phone and upload to an unlisted YouTube video. Think - where is programming a predefined series of instructions like this likely to be useful, and where will it fail?