Skip to content

Instantly share code, notes, and snippets.

@gilesbowkett
Created December 6, 2014 21:30
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 gilesbowkett/93e06c9f7ab572671778 to your computer and use it in GitHub Desktop.
Save gilesbowkett/93e06c9f7ab572671778 to your computer and use it in GitHub Desktop.
Leap = require("leapjs");
var arDrone = require("ar-drone");
var client = arDrone.createClient();
var aloft = false;
Leap.loop(function(frame) {
var x, y, z;
frame.gestures.forEach(function(gesture) {
console.log(gesture.type);
});
if (1 == frame.hands.length && !aloft) {
client.takeoff();
aloft = true;
} else if (1 == frame.hands.length && aloft) {
// client.clockwise(0.25);
if (0 < frame.pointables.length) {
x = frame.pointables[0].tipPosition[0];
y = frame.pointables[0].tipPosition[1];
z = frame.pointables[0].tipPosition[2];
}
if (y > 150) {
client.up(0.25);
}
if (y < 150) {
client.down(0.25);
}
} else {
client.stop();
client.land();
aloft = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment