Hello Guys

Ever wished to write an intelligent script using Computer vision to play with your drone? I did. In fact yesterday I started working on some basic thing and came up with a small drone game.

Drone will climb up 1m when it detects a blue object and will climb down 1m when it detects a red object. Thats it!

It took me about an hour to put together everything and get this demo onboard a 460 size hexcopter running FlytOS on FlytPOD (includes autopilot and odroid XU4) and Sony PS3 Eye camera.

After few initial searches I came across a nice python script on instructables to detect a round object with specific color. I modified it to track two objects of different color simultaneously and selected Blue and Red dishes as two colored objects for the game. With the logic handling unwanted situations like no object or both objects at a time, I was good to go. And went on to integrate it with drone, using FlytOS python APIs.

Then I took off the drone and switched to offboard mode(FlytOS taking over from me here). And started playing :)

To replicate this demo all your need is a drone with pixhawk, odroid XU4, web cam.

For information on putting together all the hardware, watch this, read this.

To get the flytOS go here.

Download above code from here.

If you face any issues post on forums.

CC users group on DIYD is a great resource for companion computer users.

With FlytOS it becomes very easy to command any drone from simple python scripts. It also exposes high level APIs in CPP, ROS, RESTful, Websocket,etc. A day or two more and you can have some mobile app for your application using flytOS.

Join the Flyt users group on DIYD to get posted of new demos.


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • FlytPOD is live on Indiegogo. You can Preorder it now :https://www.indiegogo.com/projects/flytpod-advanced-flight-computer...

  • @benbojangles Yeah, looking forward to support APM soon.

  • Dhiraj!!!! Will you please do a Python scripting tutorial for APM? Something like this would be like a "Hello World" for APM. Best wishes.

  • NAAA!!! It's amaizing !! :O   like a dog choosing objects :D

  • Hi Matt,

    Companion computers are more powerful than FC. They are there because autopilots are very complicated to write such application logic on. So basically an autopilot would give out its standard interface (mavlink) to companion computer so that we can write simple stuff like commanding autopilot to take us from point A to point B. 

    So you can put onboard a CC like Odroid XU4 along with your autopilot. 

    But only Companion computer is not enough. You need some software like flytOS running on it which gets you APIs of the drone. Using these APIs you can write such onboard apps. 

    Companion computers are the future of the drones. Combined with a good software architecture they can make the drone more intelligent. Check this nice post and comments by Patrick. It is far fledged but should give you the idea how it is going to evolve. 

    CC computer group is a great place to start with, there's great deal of discussion going on there. 

    To replicate this demo you can start following the steps given.

  • 'Love this!  I don't fully understand the whole companion computers thing...are they basically used to inject mavlink commands via python scripts to the FC?  Is there a basic tutorial anywhere that I can use to inform myself as to their purpose, how they work, and what their limitations are?

This reply was deleted.