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.
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.