Slide 1

Slide 1 text

nodecopter Yes, this is about JavaScript.

Slide 2

Slide 2 text

@zachleat http://zachleat.com Filament Group

Slide 3

Slide 3 text

First, an apology.

Slide 4

Slide 4 text

Viewing this talk will probably cost you about $370.

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Cameras: Front: 720p (1280x720) 30fps, 92° view, H.264 Bottom: QVGA (320x240) 60fps for ground speed

Slide 10

Slide 10 text

Linux 2.6.32 (BusyBox) 802.11B,G,N WiFi access point Gyroscope (orientation) Accelerometer Magnetometer (compass, direction) Pressure Sensor (altitude) Ultrasound Sensor (altitude up to 6m)

Slide 11

Slide 11 text

Emergency Mode Flip upside down or (in extreme cases) stick something in the propeller.

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Meh.

Slide 15

Slide 15 text

“It’s all talk until the code runs.” —Ward Cunningham

Slide 16

Slide 16 text

Prerequisites Node.js nodejs.org NPM npmjs.org

Slide 17

Slide 17 text

$ npm install ar-drone

Slide 18

Slide 18 text

Connect to the drone

Slide 19

Slide 19 text

var  arDrone  =  require(  'ar-­‐drone'  ); var  client  =  arDrone.createClient(); client.takeoff(); client.after(  4000,  function()  {   this.stop();   this.land(); }); Save this in takeoff-and-land.js

Slide 20

Slide 20 text

$ node takeoff-and-land.js

Slide 21

Slide 21 text

//  argument:  speed  0-­‐1 client.up(  1  );  //  altitude client.down(  1  ); client.left(  1  );  //  bank  (roll) client.right(  1  );  //  bank  (roll) client.front(  1  );  //  pitch client.back(  1  );  //  pitch client.clockwise(  1  );  //  yaw  (spin) client.counterClockwise(  1  );  //  yaw  (spin) client.stop();  //  movement=0 Also http://ministryoftype.co.uk/words/article/pitch_bank_and_yaw/

Slide 22

Slide 22 text

client.animate('flipLeft',  1500); client.animate('flipRight',  1500); /* 'phiM30Deg',  'phi30Deg',  'thetaM30Deg',  'theta30Deg',  'theta20degYaw200deg', 'theta20degYawM200deg',  'turnaround',  'turnaroundGodown',  'yawShake', 'yawDance',  'phiDance',  'thetaDance',  'vzDance',  'wave',  'phiThetaMixed', 'doublePhiThetaMixed',  'flipAhead',  'flipBehind' */ Also

Slide 23

Slide 23 text

var  pngStream  =  client.getPngStream(); pngStream.on('data',  console.log); var  videoStream  =  client.getVideoStream(); videoStream.on('data',  console.log); Camera

Slide 24

Slide 24 text

var  arDrone  =  require(  'ar-­‐drone'  ); var  fs  =  require(  'fs'  ); var  client    =  arDrone.createClient(); var  png  =  client.getPngStream(); png.on(  'error',  function  (  error  )  {   console.error(  'error:  '  +  err  ); }); png.on(  'data',  function(  buffer  )  {   console.log(  buffer.length  );   fs.writeFile(  'camera.png',  buffer,  'binary',  function(  error  )  {     if(  error  )  {       console.log(  error  );     }  else  {       console.log(  'Success.'  );     }     process.exit(0);   }); }); Take a picture, save it to the file system

Slide 25

Slide 25 text

Full API https://github.com/felixge/node-ar-drone

Slide 26

Slide 26 text

Bonus Round http://opencv.org/ https://github.com/peterbraden/node- opencv

Slide 27

Slide 27 text

var  cv  =  require('opencv'); cv.readImage("./hobbiton.jpg",  function(err,  im){   im.detectObject(cv.FACE_CASCADE,  {},  function(err,   faces){     for  (var  i=0;i

Slide 28

Slide 28 text

Community Modules http://nodecopter.com/hack#modules

Slide 29

Slide 29 text

http://eschnou.github.io/ardrone-webflight/

Slide 30

Slide 30 text

Control drone with a Kinect https://github.com/maxogden/drone-kinect Control with Wii remote https://github.com/voodootikigod/wii-drone LeapMotion http://www.youtube.com/watch?v=sWjbdZU23_0&t=22

Slide 31

Slide 31 text

A ton more ideas and demos: http://nodecopter.com/impressions