Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nodecopter - BristolJS

Nodecopter - BristolJS

Andrew Nesbitt

May 21, 2014
Tweet

More Decks by Andrew Nesbitt

Other Decks in Technology

Transcript

  1. andrew

    View Slide

  2. View Slide

  3. Nodecopter

    View Slide

  4. View Slide

  5. Felix Geisendörfer

    View Slide

  6. AR Drone 2.0

    View Slide

  7. HD
    Camera
    Downfacing camera
    Gyroscope
    Wifi
    1GHz CPU
    Linux
    Accelerometer
    Magnetometer
    Ultrasound

    View Slide

  8. ardrone2.parrot.com/developer-zone

    View Slide

  9. View Slide

  10. Node.js is a platform built on Chrome's JavaScript
    runtime for easily building fast, scalable network
    applications. Node.js uses an event-driven, non-
    blocking I/O model that makes it lightweight and
    efficient, perfect for data-intensive real-time
    applications that run across distributed devices.

    View Slide

  11. View Slide

  12. Server-side Javascript
    Asynchronous
    Runs on v8 from Chrome
    Perfect for network programs

    View Slide

  13. http://nodejs.org/download/
    !
    nodejs.org/download
    v0.10.26
    $ node
    $ NPM install ar-drone

    View Slide

  14. var arDrone = require('ar-drone');

    var client = arDrone.createClient();


    client.takeoff();


    client

    .after(3000, function() {

    this.up(1);

    })

    .after(2000, function() {

    this.stop()

    this.clockwise(1);

    })

    .after(3000, function() {

    this.stop();

    this.land();

    });

    View Slide

  15. shama.github.com/voxel-drone

    View Slide

  16. Demo Time

    View Slide

  17. Demo Time
    xbox Controller

    View Slide

  18. Demo Time
    xbox Controller

    View Slide

  19. WARNING
    WARNING

    View Slide

  20. View Slide

  21. QR CodeR

    View Slide

  22. Dance Mat Drone

    View Slide

  23. Kinect Drone

    View Slide

  24. robot laser pong

    View Slide

  25. matador-copter

    View Slide

  26. $ telnet 192.168.1.1

    View Slide

  27. # busybox | head
    BusyBox v1.14.0 () multi-call binary
    Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
    and others. Licensed under GPLv2.
    See source distribution for full notice.
    !
    !
    # cat /proc/version
    Linux version 2.6.32.9-g1dd1a2a ([email protected])
    (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) )
    #1 PREEMPT Thu May 30 19:21:53 CEST 2013
    !
    !
    # uname -a
    Linux uclibc 2.6.32.9-g1dd1a2a #1 PREEMPT Thu May
    30 19:21:53 CEST 2013 armv7l GNU/Linux
    !
    # df -h
    Filesystem Size Used Available Use% Mounted on
    ubi1:system 26.3M 21.7M 3.3M 87% /
    tmp 57.7M 644.0K 57.1M 1% /tmp
    dev 57.7M 0 57.7M 0% /dev
    ubi0:factory 4.8M 76.0K 4.5M 2% /factory
    ubi2:update 13.2M 28.0K 12.5M 0% /update
    ubi2:data 53.5M 14.0M 36.8M 28% /data

    View Slide

  28. $ ftp -u ftp://anonymous:[email protected]/file file
    !
    $ telnet 192.168.1.1
    !
    # ls /data/video
    !
    # file
    !
    ** bug in tar unpacking **
    !
    # ls /data/video/usb

    View Slide

  29. View Slide

  30. # ls /data/video/usb
    !
    ar-drone
    !
    # cp -r /data/video/usb/ar-drone /data/video/

    View Slide

  31. https://github.com/felixge/node-cross-compiler

    View Slide

  32. # https://github.com/felixge/node-cross-compiler
    !
    $ git clone git://github.com/felixge/node-cross-compiler.git
    $ cd node-cross-compiler
    $ ./helpers/ardrone2.sh

    View Slide

  33. #!/bin/bash
    set -eu
    !
    if [ ! -e build/bin/node ]; then
    echo "-> Spinning up VM"
    vagrant up
    echo "-> Building node binary"
    vagrant ssh -c "cd cross-compiler && ./setup-vm.sh && make ardrone2"
    echo "-> Halting VM"
    vagrant halt
    echo "-> To completely remove the VM, please execute 'vagrant destroy'"
    else
    echo "-> Skipping build (node binary exists)"
    fi
    !
    echo "Would you like to install node on the drone? (Connect now) [Y/n]"
    read a
    if [[ $a == "Y" || $a == "y" || $a = "" ]]; then
    echo "-> Uploading binary"
    ftp -u ftp://anonymous:[email protected]/node build/bin/node
    echo "-> Installing"
    { echo "cd /data/video && mv ./node /bin && chmod u+x /bin/node && rm -rf node
    && exit"; sleep 1; } | telnet 192.168.1.1
    echo "-> Installation completed!"
    else
    echo "-> Build completed!"
    fi

    View Slide

  34. var arDrone = require('..');
    var http = require('http');
    !
    var client = arDrone.createClient();
    client.disableEmergency();
    !
    navData = {}
    !
    client.on('navdata', function(data){
    navData = data;
    });
    !
    var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'application/json'});
    res.end(JSON.stringify(navData));
    });
    !
    server.listen(8080, function() {
    console.log('started server on http://192.168.1.1:8080')
    });

    View Slide

  35. var arDrone = require('..');
    var http = require('http');
    !
    var client = arDrone.createClient();
    client.disableEmergency();
    !
    navData = {}
    !
    client.on('navdata', function(data){
    navData = data;
    });
    !
    var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'application/json'});
    res.end(JSON.stringify(navData));
    });
    !
    server.listen(8080, function() {
    console.log('Serving latest png on port 8080 ...');
    client.takeoff();
    !
    client
    .after(5000, function() {
    this.clockwise(0.5);
    })
    .after(5000, function() {
    this.stop();
    })
    .after(1000, function() {
    this.stop();
    this.land();
    });
    console.log('started server on http://192.168.1.1:8080')
    });

    View Slide

  36. Demo Time

    View Slide

  37. WARNING
    WARNING

    View Slide

  38. https://gist.github.com/maxogden/4152815

    View Slide

  39. View Slide

  40. virus-copter
    github.com/substack/virus-copter

    View Slide

  41. View Slide

  42. CoderDojo

    View Slide

  43. View Slide

  44. View Slide

  45. View Slide

  46. View Slide

  47. nodecopter.com

    View Slide

  48. Thank You
    @teabass

    View Slide

  49. Thank You
    @teabass

    View Slide