Tello drone integration with Jetson
Project description
jetson-tello
Utility code for using the NVIDIA Jetson and tello-asyncio to interact with the Tello EDU drone.
The primary function so far is to pipe video frame data from the drone through to neural networks running on the Jetson, typically for object or face detection.
Created for my autonomous drone project, drone-braain.
Prerequisites
There are two prerequisites that require manual installation:
-
NVIDIA's jetson-inference project, following these instructions to build from source and install.
-
My fork of h264decoder. This is identical to the original repo apart from building with the slightly old version of CMake (3.10) available on the Jetson.
Example code
The face_and_object_detection.py example demonstrates feeding video frames to object and face detection neural nets
#!/usr/bin/env python3
import asyncio
import jetson.inference
from jetson_tello import h264_frame_to_cuda, FrameDecodeError
from tello_asyncio import Tello
face_detector = jetson.inference.detectNet("facenet", threshold=0.5)
object_detector = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5)
async def process_frame(frame):
try:
cuda, width, height = h264_frame_to_cuda(frame)
face_detections = face_detector.Detect(cuda)
object_detections = object_detector.Detect(cuda)
print('faces:')
for d in face_detections:
print(d)
print('objects:')
for d in object_detections:
print(d)
except FrameDecodeError:
pass
async def main():
global next_frame
drone = Tello()
await drone.wifi_wait_for_network()
await drone.connect()
await drone.start_video()
async def fly():
await drone.takeoff()
async def process_video():
async for frame in drone.video_stream:
await process_frame(frame)
try:
await asyncio.wait([fly(), process_video()])
finally:
await drone.stop_video()
await drone.disconnect()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Which typically outputs a stream of results like this (along with a fair amount of spam from the h.264 decoder):
faces:
<detectNet.Detection object>
-- ClassID: 0
-- Confidence: 0.809878
-- Left: 434.667
-- Top: 0
-- Right: 702.267
-- Bottom: 302.5
-- Width: 267.6
-- Height: 302.5
-- Area: 80949
-- Center: (568.467, 151.25)
objects:
<detectNet.Detection object>
-- ClassID: 7
-- Confidence: 0.500977
-- Left: 0
-- Top: 7.30054
-- Right: 959
-- Bottom: 719.04
-- Width: 959
-- Height: 711.74
-- Area: 682559
-- Center: (479.5, 363.171)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jetson_tello-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aea72ff8e50cc39005212acb7347e426e5e27470449dac9264d4e3a91dbe4f2 |
|
MD5 | 4b5b56b63d03eba26245ac01a3235a7d |
|
BLAKE2b-256 | 2669f0d4f5b2c51f5eeb4db0015123c473a4eb1962806b0a964b91219e65d077 |