Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Detecting Objects with a Tello Drone
Pooja Mistry
Pooja Mistry

Posted on • Edited on

     

Detecting Objects with a Tello Drone

Have you ever wanted to detect objects using live video streaming from a drone? If so, with this tutorial you now can!

Let's Get Started

In this tutorial, we will be usingNode-RED. Designed and built by IBM,Node-RED is a free open source logic engine that allows programmers of any level to interconnect IoT, cloud-based systems, web services, databases, API’s and more!

Step 1: Get started by installing Node-RED locally

You can check outthis tutorial on how to install Node-RED on your local computer , or follow the commands below :

sudo npm install -g --unsafe-perm node-red

This should install Node-RED, once installed run this command :

node-red

This should point you to a Node-RED URLhttp://127.0.0.1:1880/ that you can put in your browser to see the Node-RED editor

Note: In later steps, we will be adjusting the settings.js file that comes when you install Node-RED

Alt Text

Node-RED editor in your browser

Step 2: InstallFFMpeg on your local computer

FFMpeg is a very powerful command-line tool that is used for performing various conversion operations on audio and video files. This tool will be the bread and butter for video streaming! It is free to use and is available for Windows, Linux and Mac operating systems

If you have a Mac, the best way to install it is by using homebrew.

Run:brew install ffmpeg to install FFmpeg locally to your computer.

This will be critical to see streams that are flowing in from your local computer!

Step 3: Install theFFMpeg Node in Node-RED

There are two ways you can install this node

  1. Donpm install node-red-contrib-ffmpeg in the same directory that node-RED (from step 1) was installed

  2. Open your node-RED browser and findnode-red-contrib-ffmpeg in manage pallet

Alt Text

Open hamburger menu on right hand side > manage palette

Alt Text

Click install and you should see the ffmpeg node in your palette

Step 4: Train a Model

Followthis tutorial to train an object detection model .

Alt Text

Once you finish this tutorial you should end up with amodel_web folder.

Step 5: Copymodel_web into Node-RED and adjust settings

Once you have amodel_web directory with your trained object model you will need to copy that into the directory that you installed Node-RED

We will then adjust the settings.js file in your node-RED director

Opensettings.js and search for and uncomment out the following

httpAdminRoot: '/editor',
httpStatic: '<path to model web directory >',

I set the endpoint ofhttpAdminRoot to editor, so now when you runnode-red command to see your node-RED editor you will now go to this urlhttp://127.0.0.1:1880/editor

httpStatic will include the location of your model_web folder

Step 6: Configure yourTello Drone

Before you can use your Tello Drone you MUST activate it in the official Tello Drone app. Once your drone is activated, you can connect to it's WiFi Network TELLO-XXXXXX and send it commands via UDP

Step 7: Import Flow into Node-RED

Start Node-RED locally and Import the following flow :

To import this flow , copy the json in the GIST above to your clipboard.

On your Node-RED editor go to the hamburger menu on top right-hand side > Import > Clipboard

Alt Text

Paste the json that you copied from your clipboard and click Import

Alt Text

You should see the following flow on your editor :

Alt Text

Step 8: Adjust Nodes and Stream from Tello!

Double click on the FFmpeg node and make sure it is configured for Tello Drone. Also by default, the URL will be set to/stream .Note, this can be changed to whatever url endpoint you want

Alt Text

In this example our stream will be accessible at ws://:/stream

Using the stream
To render the video stream in the browser, we use a library calledJSMpeg.

*If you changed the stream url endpoint to something else , make sure you configure this in the template node on line 58. In the default we have it set as /stream *

const url = `ws://${window.location.hostname}:${window.location.port}/<url_endpoint>

Alt Text

Turn Tello Wifi On
Make sure your Tello drone is charged and you have turned it on. You should be able to connect to your Tello's wifi.

Once connected click Command and then Stream on

Alt Text

Go tohttp://127.0.0.1:1880/dashboard and you should see video streaming from your tello! If you have trained an object detection model, you should also see your tello detect objects! In my case I trained a model to distinguish between thumbs up and thumbs down

Alt Text

If you want to stop stream make sure to click on the stopstream inject button in the node-RED editor

The End

That's all folks :). Thank you so much for reading!

Check outthis repo if you're interested in video streaming without the object detection!

Feel free to reach out to me with any questions in the comments below, or connect with me on twitter@poojamakes

If you found this tutorial fun and helpful, it would mean a lot to me if you gave it some <3 and shared it to help others! Thank you again!

Top comments(3)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
sanjpradhan profile image
sanjpradhan
I am very interested in Digital Manufacturing, specifically IoT, Blockchain, Digital Twins and 3D Printing.
  • Location
    Brighton, UK
  • Work
    Master Solutions Engineer at Salesforce
  • Joined

Hi Pooja,

In your opinion would Node-RED scale to IoT Scale projects connecting potentially millions and potentially billions of events? Is it production IoT read in your view? Be great to get the thoughts of the community on this one.

Sanjay

CollapseExpand
 
upkarlidder profile image
Upkar Lidder
Upkar Lidder is a Full Stack Developer and Data Wrangler with a decade of development experience in a variety of roles. Educated in Canada and currently residing in the USA. <3 Python and JS!
  • Location
    San Francisco
  • Joined

Nicely done!

CollapseExpand
 
jitheshkt profile image
Jithesh. KT
  • Joined

Nice! I see you work for IBM and from your name sounds like you are somehow connected to India. It is so hard to get this drone in India. Please do something 😒

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Technologist and Developer Advocate who is always learning new things and is excited to share!
  • Location
    Washinton DC
  • Work
    Developer Advocate
  • Joined

More fromPooja Mistry

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp