Created
July 24, 2012 19:08
-
-
Save felixge/3171943 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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