DroneBlocks Python with Tello Webinar - June 28, 2022

Here is the video from the DroneBlocks webinar hosted by Clinton Evans:

The code from the webinar can be found below:

# Import required Libraries 
from droneblocks.DroneBlocksTello import DroneBlocksTello
import time

# Start the Tello instance
tello = DroneBlocksTello()

# Join RMTT Wifi first
# Once you have connected to the Tello Wifi then run tello.connect() 

# Find out the battery life

# Some Tello movements below, remove the # if you want to use the code
# tello.takeoff()
# tello.fly_forward(100)
# tello.rotate_clockwise(90)
# tello.fly_backward(100)
# tello.rotate_counter_clockwise(90)

# Running this function returns the battery value
def BatReport():
    return tello.get_battery()

# If statement to see if we can fly if battery is above 50%
if BatReport() > 50:
    print("Let's fly!!")

# Create flight check function. Let's do some fancy inline comments
def PreFlightCheck(): # name function
    if tello.get_battery() > 30: # if battery life is higher than 30
        print("Drone's Up! " + str(tello.get_battery()) + "% Battery Left") # print message + battery life %
    else: # else do the following
        print("Not enough power captain") # print message saying not enough power

# Create mission to fly in a square
def SquareMission():
    for i in range(4):

# Create function that asks if it is safe to fly
def SafeToFly():
    ans = input("Is it safe to fly? ").lower() # this makes the typed answer lower case and easier to compare 
    if ans == "yes": # if yes == yes then print success message and take off
        print("Awesome! Drones Up!")
        print("Well maybe next time")

Here you can find the DroneBlocksPythonUtils pip package that will enable you to run the code above and do a lot of cool stuff covered in many of these courses.

If you’d like to give the DroneBlocks Python Simulator a try, please go here and read through the instructions. If you have any problems don’t hesitate to post a question and we’ll be happy to respond.

Lastly, you can learn about OpenCV with Tello from Pat Ryan by checking out this course.

In the demo you talked about using VisualStudio. In starting the online curriculum, we load Anaconda and you mention not worrying about VisualStudio. So what is the best path to follow? I would like to follow a path I could show the students how to follow.

I’ve personally adopted VS Code over the years. I would recommend taking that path and following Clinton’s advice in the Webinar. There is not right/wrong answer, but as you know technology and best practices evolve over time. If the VS Code dependency becomes a challenge please let us know. Sometimes there are hurdles regarding what software districts will allow. We’re happy to help you walk through it.