CrazyFlie control software
A node.js control library for the Crazyflie nano-copter. This is a work in progress! Your contributions are more than welcome.
brew install libusb
Then install Aerogel:
npm install aerogel
Aerogel uses new-style node streams so it requires node 0.10.x or later.
copter object is what your control scripts should manipulate.
A simple script for taking off then landing again immediately looks like this:
var Aerogel = require'../index';var driver = ;var copter = driver;processon'SIGINT' copterlandbindcopter;driverfindCoptersthenif copterslength === 0console.error'No copters found! Is your copter turned on?';processexit1;var uri = copters0;console.log'Using copter at' uri;return uri;then return copterconnecturi;then return coptertakeoff;then return copterland;then return coptershutdown;done;
Look at the scripts directory for more.
The protocol driver emits telemetry information as events that the copter object listens for. The handlers for these events don't do anything yet, but the plan is that they'll eventually be used to implement higher-level flight control constructs & autonomous goal-seeking.
copter.handleStabilizerTelemetry() gets an object with three orientation fields:
copter.handleMotorTelemetry() gets an object with the state of the four motors:
copter.handleAccTelemetry() gets an object with the state of the accelerometer:
z. The accelerometer data is available only for copters running tip-of-tree firmware.
Aerogel exposes a promises API at the moment. Eventually I plan to offer a standard callback API as well. If you do not pass a callback to a method, a promise is returned.
If you're lucky enough to have a LeapMotion, there's a rough example of controlling the copter with circle gestures & vertical swipes in
Everything. See the Github issues for my plan about where I'd like this project to go. The Crazyflie is difficult to control with a gamepad, and my theory is that software can eventually fly it better than I can. Also, I dream of a cloud of Crazyflies orbiting my head, all under control of a little Beaglebone or Raspberry PI hidden inside my hat. Maybe you have a dream for your copter!
Allman bracing, tabs to indent, camel case. Do cool things.