Code Monkey home page Code Monkey logo

tello's Introduction

DISCLAIMER

I do not own a Tello. This code and documentation is based on the Tello SDK documentation as of 3/19/2018.

WHAT THE BLEEP IS THIS

A Python interface for the Ryze Tello drone.

The tello module provides a Tello class, which interacts with the Tello API.

The Tello has an IP of 192.168.10.1. The device sending commands must be connected to the Tello WiFi network and have an IP in the 192.168.10.0/24 range.

CREATE A MAGIC TELLO OBJECT

Tello objects require a minimum of 2 parameters to initialize, the local IP address and port to bind.

Ex. drone = tello.Tello('192.168.10.2', 8888)

Methods that require distance or speed parameters expect feet or MPH. Include parameter imperial=False for meters and KPH.

Ex. drone = tello.Tello('192.168.10.2', 8888, imperial=False)

If you send a command to the Tello and it doesn't respond within .3 seconds, a RuntimeError is raised. You may specify the number of seconds to wait with the timeout parameter.

Ex. drone = tello.Tello('192.168.10.2', 8888, imperial=False, timeout=.5)

When you initialize a Tello object, it attempts to connect to the Tello and enter command mode. If this fails, a RuntimeError is raised.

DO VARIOUS THINGS

Once initialized, a number of methods are available to send commands to the Tello. It will respond with 'OK', 'FALSE' or a numeric value, which the methods return.

These methods do what you'd expect. Responses are 'OK' or 'FALSE'.

Tello.takeoff() Tello.land()

Methods that perform vertical or horizontal movements require a single parameter, distance. Responses are 'OK' or 'FALSE'.

The unit of distance is feet or meters. The SDK accepts distances of 1 to 500 centimeters. Realistically, this translates to .1 - 5 meters or .7 - 16.4 feet.

Tello.move_forward(distance) Tello.move_backward(distance) Tello.move_right(distance) Tello.move_left(distance) Tello.move_up(distance) Tello.move_down(distance)

Methods that rotate require a single parameter, degrees. The SDK accepts values from 1 to 360. Responses are 'OK' or 'FALSE'.

Tello.rotate_cw(degrees) Tello.rotate_ccw(degrees)

The method to set speed requires a single parameter, speed. Responses are 'OK' or 'FALSE'.

The unit of speed is KPH or MPH. The SDK accepts speeds from 1 to 100 centimeters/second. Realistically, this translates to .1 to 3.6 KPH or .1 to 2.2 MPH.

Tello.set_speed(speed)

The method to flip requires a single parameter, direction. The SDK accepts 'l', 'r', 'f', 'b', 'lf', 'lb', 'rf' or 'rb'. Responses are 'OK' or 'FALSE'.

Tello.flip(direction)

Methods that retrieve information from the Tello take no parameters. Responses are numeric values.

Get current speed in KPH or MPH: Tello.get_speed()

Get percent battery life remaining: Tello.get_battery()

Get elapsed flight time in seconds: Tello.get_flight_time()

DO THE HOKEY POKEY

Put it all together, and you might do something like this.

import tello import time

drone = tello.Tello('192.168.10.2', 8888)

drone.takeoff() time.sleep(5)

drone.set_speed(2) time.sleep(1)

drone.move_up(3) time.sleep(5)

drone.move_forward(10) time.sleep(10)

drone.rotate_cw(180) time.sleep(5)

drone.move_forward(10) time.sleep(10)

drone.land()

print 'Flight time: %s' % drone.get_flight_time()

tello's People

Contributors

microlinux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tello's Issues

Camera control

Great work, may I ask is it also possible to control the cameras (take pics, record videos) using python as well?

NVM, saw the other thread

Download

How do you download this package?

Python exception on take-off

After applying the little patch in #9 , the Tello drone does take off, but:

Traceback (most recent call last):
  File "Tello/hello_tello.py", line 6, in <module>
    drone.takeoff()
  File "Tello/tello.py", line 286, in takeoff
    return self.send_command('takeoff')
  File "Tello/tello.py", line 242, in send_command
    raise RuntimeError('No response to command')
RuntimeError: No response to command

Process finished with exit code 1

RuntimeError('Tello rejected attempt to enter command mode') - CAPS LOCK issue

I bought the Tello, and updated it to the latest firmware: 01.04.78.01
Upon trying to instantiate the object "Tello", the __init__ method would raise a RuntimeError('Tello rejected attempt to enter command mode').
After a little debugging, I figured out that the exception was thrown because the 'OK' expected as a response upon send_command('command') (line 59) was returned in lower caps format, i.e. 'ok'.
Possibly this mismatch was due to the latest firmware update, and to have the tello.py library work again, it's simply necessary to change the 'OK' in line 59 to 'ok'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.