Skip to main content

DroneBlocksTelloSimulator

Welcome to the DroneBlocks Tello Simulator with Python. If you are looking for the JavaScript version you can check it out here.

The wonderful thing about this library is you can interact with a simulated Tello drone and take the same code and run it with a real Tello drone.

The first thing we recommend you do is set up a virtual environment for your project. This isn't a necessity but it helps keep your project clean.

python3 -m venv venv

or on some systems you may need to use the following:

python -m venv venv

Now that your virtual environment is up and running go ahead and activate it from the root of the project directory.

source venv/bin/activate

on Windows:

.\venv\Scripts\activate

Now install the DroneBlocksTelloSimulator Python package:

pip install DroneBlocksTelloSimulator

Installation is done! Now you need to create your first mission with the DroneBlocks Simulator. You can access the simulator at the link below:

DroneBlocks Simulator Link

You will need configure Chrome to "Allow Insecure Content" for the simulator. This is not a security risk and will only be done for this domain. This will allow the DroneBlocks simulator to receive commands from Python. Follow these steps:

  1. Click on the lock icon next to the web address
  2. Click on "Site settings"
  3. Scroll to the bottom and look for "Insecure content"
  4. Change "Block" to "Allow"
  5. Close the tab and refresh the simulator

You can now move onto programming your first simulated drone mission in Python! Click the button in the top left of the DroneBlocks simulator that says "Get Drone Simulator Key". Copy this unique key to your clipboard as it will be used in your mission code below.

Create a simulated mission using the following code:

from DroneBlocksTelloSimulator.DroneBlocksSimulatorContextManager import DroneBlocksSimulatorContextManager

if __name__ == '__main__':

    sim_key = 'YOUR_SIM_KEY_GOES_HERE'
    distance = 40
    with DroneBlocksSimulatorContextManager(simulator_key=sim_key) as drone:
        drone.takeoff()
        drone.fly_forward(distance, 'in')
        drone.fly_left(distance, 'in')
        drone.fly_backward(distance, 'in')
        drone.fly_right(distance, 'in')
        drone.flip_backward()
        drone.land()

Congrats on your first simulated mission! Now let's run the exact same code on a real Tello. We're assuming you know how to connect to Tello from your computer so go ahead and do that.

Once connected you'll run the exact same code above with one small difference. We've changed the sim_key to None and Python now knows to send the same commands to your real Tello, Tello EDU, or Tello Talent!

from DroneBlocksTelloSimulator.DroneBlocksSimulatorContextManager import DroneBlocksSimulatorContextManager

if __name__ == '__main__':

    sim_key = None
    distance = 40
    with DroneBlocksSimulatorContextManager(simulator_key=sim_key) as drone:
        drone.takeoff()
        drone.fly_forward(distance, 'in')
        drone.fly_left(distance, 'in')
        drone.fly_backward(distance, 'in')
        drone.fly_right(distance, 'in')
        drone.flip_backward()
        drone.land()

Ta-da! Now you've run the same code in both the DroneBlocks simulator and on Tello! Let's take a look at all the commands available to both the Simulator and Tello:

drone.takeoff()
drone.fly_forward(20, 'in')
drone.fly_backward(20, 'in')
drone.fly_left(20, 'in')
drone.fly_right(20, 'in')
drone.fly_up(20, 'in')
drone.fly_down(20, 'in')
drone.fly_to_xyz(10, 20, 30, 'in')
drone.fly_curve(25, 25, 0, 0, 50, 0, 'in')
drone.flip_forward()
drone.flip_backward()
drone.flip_left()
drone.flip_right()
drone.land()

Give it a try and let us know what you think! If you run into any issues please open a bug here.

Release files for DroneBlocksTelloSimulator 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DroneBlocksTelloSimulator 0.0.8
File Size Uploaded
DroneBlocksTelloSimulator-0.0.8.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DroneBlocksTelloSimulator 0.0.8
File Interpreter ABI Platform
DroneBlocksTelloSimulator-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / DroneBlocksTelloSimulator-0.0.8.tar.gz

Download URL DroneBlocksTelloSimulator-0.0.8.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d3f6ac748a956af8c9222818ba0e0ea8b38145d72965ebbc0b2324d4b4c07719
BLAKE2b-256 checksum
How to use checksums
e6d19bf51c8a9109c7f5cf59dcb67d8ac2e72cef9f025ff7ddc449af060d79ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.4

Release files / DroneBlocksTelloSimulator-0.0.8-py3-none-any.whl

Download URL DroneBlocksTelloSimulator-0.0.8-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc460c3376c03b0cede06a3b5cce5cc88d29406487d4b7a328ce90526ee28f1e
BLAKE2b-256 checksum
How to use checksums
27abd9268d79902acc362f2205e293e6107f8cd21c781e7c296069ecb2648e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page