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

Nodecopter Pivotal

Nodecopter Pivotal

Andrew Nesbitt

July 29, 2014
Tweet

More Decks by Andrew Nesbitt

Other Decks in Technology

Transcript

  1. 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.
  2. 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();
 });
  3. # 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 (stephane@stephane-pc) (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
  4. $ 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
  5. #!/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
  6. 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') });
  7. 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') });