TelloDrone with Keyboard and Object Detection#

This project demonstrates how to control a Tello drone using your keyboard and perform real-time object detection using a pre-trained model. The droneโ€™s movements are controlled via arrow keys and specific hotkeys for takeoff, landing, and flips. Object detection is performed on the live video stream from the droneโ€™s camera.

Videos#

๐ŸŽฏ Object Detection Demo#

๐Ÿ•น๏ธ Keyboard Control Demo#

Prerequisites#

  • Python 3.x

  • getter module

  • djitellopy

  • pygame

  • opencv-python (cv2)

  • cvzone

Installation#

Clone the repository and install dependencies:

git clone https://github.com/sainavaneet/TelloDrone-with-KeyBoard-and-Objectdetection.git
cd TelloDrone-with-KeyBoard-and-Objectdetection
pip install getter djitellopy pygame opencv-python cvzone

Usage#

1. Connect and Initialize the Drone#

import getter as kg
from djitellopy import tello
from time import sleep

kg.init()

drone = tello.Tello()
drone.connect()

2. Define Keyboard Input Function#

def getKeyboardInput(isFlying):
    # Custom key-to-movement logic
    return [lr, fb, ud, yw, isFlying]

3. Main Control Loop#

while True:
    inputs = getKeyboardInput(isFlying)
    isFlying = inputs[4]
    drone.send_rc_control(inputs[0], inputs[1], inputs[2], inputs[3])
    sleep(0.01)

4. Object Detection from Drone Feed#

thres = 0.50
nmsThres = 0.2

# Load model and class names

while True:
    # Capture frame
    # Run detection
    # Annotate and display frame
    # Accept keyboard input for control

Contributing#

Contributions are welcome! If you find issues or want to enhance this project, feel free to open an issue or submit a pull request.