1.0.1 • Published 3 months ago

tello-drone-controller v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Tello Drone Controller API

  • This project provides a API interface to control a Tello drone using Express.js.
  • It allows users to send commands to the Tello drone through HTTP GET requests, making it easier to integrate drone control into web applications or services.

Install Globally

npx tello-drone-controller

or

npm install -g tello-drone-controller

This will install the package globally and you can run the server from any directory.

Usage

tello-drone-controller # starts the server on port 9000

Development

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js (version 12 or newer recommended)
  • A Tello drone connected to your computer's Wi-Fi network

Installation

To install the Tello Drone Controller API, follow these steps:

  1. Clone the repository to your local machine:

    git clone git@github.com:cagataycali/tello-drone-controller.git
  2. Navigate to the project directory:

    cd tello-drone-controller
  3. Install the required npm packages:

    npm install

Usage

To start the server, run the following command in your project directory:

npm start

The server will listen on port 9000. You can change the port by modifying the port variable in the server script.

API Endpoints

The API currently supports the following endpoints:

  • GET /:command - Send a command to the Tello drone.

    • command: The command to send to the drone (e.g., takeoff, land, up, down, etc.).
    • Query Parameters:
      • value: (Optional) The value for commands that require it (e.g., distance, angle).
      • Additional command-specific parameters as needed.

Example Request

To make the drone take off:

GET http://localhost:9000/takeoff

To move the drone up by 30 cm:

GET http://localhost:9000/up?value=30
CommandDescription or Example Usage
commandInitializes the command mode. GET http://localhost:9000/command
takeoffCommands the drone to take off. GET http://localhost:9000/takeoff
landCommands the drone to land. GET http://localhost:9000/land
streamonTurns on video streaming. GET http://localhost:9000/streamon
streamoffTurns off video streaming. GET http://localhost:9000/streamoff
emergencyStops all motors immediately. GET http://localhost:9000/emergency
upMoves the drone up. Example: GET http://localhost:9000/up?value=30
downMoves the drone down. Example: GET http://localhost:9000/down?value=30
leftMoves the drone left. Example: GET http://localhost:9000/left?value=30
rightMoves the drone right. Example: GET http://localhost:9000/right?value=30
forwardMoves the drone forward. Example: GET http://localhost:9000/forward?value=30
backMoves the drone back. Example: GET http://localhost:9000/back?value=30
cwRotates the drone clockwise. Example: GET http://localhost:9000/cw?value=90
ccwRotates the drone counterclockwise. Example: GET http://localhost:9000/ccw?value=90
flipFlips the drone. Example: GET http://localhost:9000/flip?value=l (l for left)
goSends the drone to coordinates. Example: GET http://localhost:9000/go?x=20&y=20&z=20&speed=10
curveCommands the drone to fly in a curve. Example: GET http://localhost:9000/curve?x1=20&y1=20&z1=20&x2=30&y2=30&z2=30&speed=10
speedSets the speed of the drone. Example: GET http://localhost:9000/speed?value=10
rcRemote control the drone with more granularity. Example: GET http://localhost:9000/rc?a=0&b=0&c=0&d=0
wifiSets the Wi-Fi SSID and password. Example: GET http://localhost:9000/wifi?ssid=yourSSID&pass=yourPass
speed?Queries the current speed. GET http://localhost:9000/speed?
battery?Queries the current battery percentage. GET http://localhost:9000/battery?
time?Queries the current flight time. GET http://localhost:9000/time?
wifi?Queries the current Wi-Fi SNR. GET http://localhost:9000/wifi?
sdk?Queries the SDK version. GET http://localhost:9000/sdk?
sn?Queries the serial number. GET http://localhost:9000/sn?

Note: For commands that require parameters (like up, down, left, right, go, curve, etc.), replace the value=30, x=20, y=20, z=20, speed=10, a=0, b=0, c=0, d=0, ssid=yourSSID, and pass=yourPass with actual values you intend to use. The example parameters provided here are for illustration purposes only.

Contributing

Contributions to the Tello Drone Controller API are welcome. To contribute, please fork the repository and create a new branch for your feature or fix.

License

This project is licensed under the MIT License - see the LICENSE file for details.