Git Product home page Git Product logo

aerogel's Introduction

aerogel

A node.js control library for the Crazyflie nano-copter. This is a work in progress! Your contributions are more than welcome.

Dependencies NPM version

NPM

Installation

libusb is required for the radio driver. On OS X, install with homebrew:

brew install libusb

Then install Aerogel:

npm install aerogel

Aerogel uses new-style node streams so it requires node 0.10.x or later.

Basics

The 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 = new Aerogel.CrazyDriver();
var copter = new Aerogel.Copter(driver);
process.on('SIGINT', copter.land.bind(copter));

driver.findCopters()
.then(function(copters)
{
    if (copters.length === 0)
    {
        console.error('No copters found! Is your copter turned on?');
        process.exit(1);
    }

    var uri = copters[0];
    console.log('Using copter at', uri);
    return uri;
})
.then(function(uri) { return copter.connect(uri); })
.then(function() { return copter.takeoff(); })
.then(function() { return copter.land(); })
.then(function() { return copter.shutdown(); })
.done();

Look at the scripts directory for more.

Telemetry

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: roll, pitch, yaw.

copter.handleMotorTelemetry() gets an object with the state of the four motors: m1, m2, m3, and m4.

copter.handleAccTelemetry() gets an object with the state of the accelerometer: x, y, and z. The accelerometer data is available only for copters running tip-of-tree firmware.

API

TODO

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.

LeapMotion

If you're lucky enough to have a LeapMotion, there's a rough example of controlling the copter with circle gestures & vertical swipes in scripts/leap-takeoff.js.

To-do

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!

Contributing

Allman bracing, tabs to indent, camel case. Do cool things.

Aerogel does not currently have any tests worth noting. If you feel inspired, the project needs some. Write tests in Mocha. mocha-as-promised and chai-as-promised are available.

License

MIT.

aerogel's People

Contributors

ceejbot avatar mrose17 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.