Tuesday, July 2, 2013

AR Drone Developments

This past week has been chock-full of AR Drone developments.  First of all, I made the switch from Javascript (node.js) to Python development.  This was an important step because developing with Javascript was counter-intuitive and was becoming a pain for me.  I also wasn't interested in viewing the video online, but rather in an app on the computer, where I could do more filtering with OpenCV.  I am using a python library called libardrone (https://github.com/venthur/python-ardrone) that has given me control of the quadcopter with minimal complexity.  So far I have been able to do all sorts of development including autonomous and controlled flying.

One of the big issues that I have been dealing with was how to get video from the drone and filter it.  Parrot changed the video codec in its 2nd model of the AR Drone, so that it sends back h264 video with a proprietary encoding (PAVE).  From reading online, there were a few ways that people were getting the video.  One way was to capture frames as png images with the node.js library, but after a lot of testing, I became frustrated with this method.  I was able to get the video to show in a browser, but the frame rate was atrocious.  Another way was to use the Parrot SDK to gather the video, but for some reason, they took it down, and I could not find a recent version that would work with AR Drone 2.0.

Finally, I discovered a method that used FFMPEG to quickly decode the video and play it.  After installing FFMPEG and OpenCV (this was a real pain), I typed in a simple line into the terminal and boom I was receiving video from the drone.  All I needed was: "ffplay tcp://".  This allowed me to view the video in real time.  Next, I needed to incorporate that in my program.  It turns out that OpenCV uses ffmpeg to take in video streams.  How simple!  All I needed to do was use the python OpenCV module and capture the video stream.  I had a working a result in no time.  Since then, I have been experimenting with different OpenCV filtering techniques that might help me locate fire.  I have been reading papers and trying different techniques.  A few have even worked!

This is the setup I have been working with this week.  It's been so beautiful outside!