Skip to content

Instantly share code, notes, and snippets.

@nickleefly
Forked from felixge/drone.js
Created January 11, 2014 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickleefly/8367981 to your computer and use it in GitHub Desktop.
Save nickleefly/8367981 to your computer and use it in GitHub Desktop.
// Done inside a repl so I can call land() when the drone is mis-behaving
// The client library will probably handle the forSec() queue stuff in the future
var client = require('.').createClient();
client.startRepl(function(err) {
if (err) throw err;
forSec(5, 'takeoff');
forSec(3, 'stop');
forSec(5, 'frontBack', -0.1);
forSec(3, 'stop');
forSec(5, 'vertical', 0.1);
forSec(3, 'stop');
forSec(3, 'angular', -0.1);
forSec(3, 'frontBack', 0.1);
forSec(3, 'stop');
forSec(100, 'land');
});
var offset = 0;
function forSec(sec, method, arg) {
setTimeout(function() {
console.log(method, arg);
client[method](arg);
}, offset * 1000);
offset += sec;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment