Tello Dji
  • Introduction
  • Tech Spec
  • SDK
  • Frameworks
    • Python
      • Tellopy
      • PyTello
    • NodeJS
      • Tello-api-client
      • Tello-nodejs
    • Go
      • Gobot driver for the Ryze Tello
      • Tello Go (unofficial)
    • ROS
    • Scratch
    • Droneblocks
  • Applications
    • Requirements
    • FlyControll
      • Tellopy
        • HelloWorld
        • CircuitDemo
    • Image Recognition
      • Object Detection
    • Telemetry
      • HomeAssistant
      • BoschXDK110-RemoteController
        • Requirement
        • XDK110
        • Drone
Powered by GitBook
On this page

Was this helpful?

  1. Applications
  2. FlyControll
  3. Tellopy

CircuitDemo

PreviousHelloWorldNextImage Recognition

Last updated 5 years ago

Was this helpful?

This scripts would help us to create a fly routine that we want that our drone reproduce. We can choose one of the three scripts each one have a different behavior.

RoutineFly

This script would help us that drone rotate 180 degrees and then return to original position. Then drone would make a flip to the right and land.

from time import sleep
import tellopy

def handler(event, sender, data, **args):
   drone = sender
   if event is drone.EVENT_FLIGHT_DATA:
      print(data)

def tellofly():
   drone = tellopy.Tello()
   try:
     drone.subscribe(drone.EVENT_FLIGHT_DATA, handler)

     drone.connect()
     drone.wait_for_connection(60.0)
     drone.takeoff()
     sleep(5)
     drone.cw(180)
     sleep(5)
     drone.ccw(180)
     sleep(5)
     drone.flip(r)
     sleep(5)
     drone.land()
   except Exception as ex:
      print(ex)
   finally:
      drone.quit()

if __name__ == '__main__':
   tellofly()

RoutineGo

This script would make a routine and then land.

from time import sleep
import tellopy


def handler(event, sender, data, **args):
   drone = sender
   if event is drone.EVENT_FLIGHT_DATA:
      print(data)   

def tellofly():
   drone = tellopy.Tello()
   try:
     drone.subscribe(drone.EVENT_FLIGHT_DATA, handler)

     drone.connect()
     drone.wait_for_connection(60.0)
     drone.takeoff()
     sleep(5)
     drone.go(20,20,20,20)
     sleep(5)
     drone.land()
   except Exception as ex:
      print(ex)
   finally:
      drone.quit()

if __name__ == '__main__':
   tellofly()

Routinesquare

This script would make that Drone Tello make a square and then land.

from time import sleep
import tellopy


def handler(event, sender, data, **args):
   drone = sender
   if event is drone.EVENT_FLIGHT_DATA:
      print(data)

def tellofly():
   drone = tellopy.Tello()
   try:
     drone.subscribe(drone.EVENT_FLIGHT_DATA, handler)

     drone.connect()
     drone.wait_for_connection(60.0)
     drone.takeoff()
     sleep(5)
     drone.forward(30)
     sleep(5)
     drone.right(30)
     sleep(5)
     drone.back(30)
     sleep(5)
     drone.left(30)
     sleep(5)
     drone.land()
   except Exception as ex:
      print(ex)
   finally:
      drone.quit()

if __name__ == '__main__':
   tellofly()
routineflip.py
routinego.py
routinesquare.py