The goal of our most recent project was to mount an ultra-violet laser onto the frame of a Parrot AR-Drone 2.0, control the flight of the drone with turntables and have the laser project onto a giant glow-in-the-dark wall (with much thanks to In The Colorfield and Jessup). We managed to accomplish this, and what I am explaining today is how we tied it all together with Node.js.
What is Node.js?
Why did we use Node?
A big reason for us using Node is that it fit the criteria of the project quite perfectly. We also needed something that would be easy to setup, use, and customize to control our AR.Drone. There is a large community of developers that swear by Node and a great community of people that, using Node, have created libraries to control the flight of the drone in a very effective way.
What did we build?
The first thing we did was find a library that had already been built to control a Drone, we found the ar-drone library and the drone-browser wrapper for it. This made life much easier since a Node and Client were both already setup for us to get going with… so within about a half hour we were flying a drone around using controls in a browser.
The next piece that we needed to solve was getting the midi data from the turntables / Traktor. Christopher was quickly on top of making the data available from the turntables and publishing to a virtual midi device on his computer, while Brendan discovered that there was already a midi package for Node. After some trial and error, Brendan was able to extend the drone-browser library a little bit where he connected to a virtual midi device and accept the input from the midi data output by Traktor.
Once that was all setup, we parsed that midi data and started building in controls in the Node server so that we could control the drone without the need of the browser (though the browser client still comes in handy). We made a bunch of methods to tap into the Drone API and configure it to our specific parameters (vertical / horizontal speed, limits, etc) and we were off to test and tweak everything.
You can find our updated drone-browser library at http://github.com/cttoronto/drone-browser/ we will continue to update the library as we tweak different areas