Flying robots over a 10.000 mile distance with JavaScript.

Flying robots over a 10.000 mile distance with JavaScript.

Talk given remotely for the Sydney JS Usergroup. Unfortunately my screen recording didn't work out : /.

23968f0ca75b13463d2db5343e5c2096?s=128

Felix Geisendörfer

November 21, 2012
Tweet

Transcript

  1. felixge NodeCopter Flying robots over a 10.000 mile distance with

    JavaScript Felix Geisendörfer
  2. @felixge felixge Background 2005 - 2008 2008 - now 2009

    - now Felix Geisendörfer
  3. @felixge felixge npm modules Felix Geisendörfer

  4. @felixge felixge NodeCopter

  5. @felixge felixge What is NodeCopter? • Started as a one-time

    event in Berlin on Oct 5th, 2012 • 60 programmers to program 25 AR Drones for a full day • Amazing venue, old swimming hall with 13m ceilings • Non-profit / cheap tickets (25 EUR)
  6. None
  7. None
  8. None
  9. None
  10. None
  11. None
  12. @felixge felixge 1 day

  13. @felixge felixge 1 day • Computer vision

  14. @felixge felixge 1 day • Computer vision • Voice recognition

  15. @felixge felixge 1 day • Computer vision • Voice recognition

    • Gesture recognition
  16. @felixge felixge 1 day • Computer vision • Voice recognition

    • Gesture recognition • Hardware controls
  17. @felixge felixge 1 day • Computer vision • Voice recognition

    • Gesture recognition • Hardware controls • and more
  18. @felixge felixge Previous Events • Berlin, Oct 5th, 2012 •

    Dublin, Oct 20th, 2012 • San Francisco, Oct 31st, 2012 • Seattle, Nov 8th - 9th, 2012 • Brighton, Nov 10th, 2012
  19. @felixge felixge Upcoming Events • San Francisco, Dec 1st, 2012

    • Florida, May 30, 2013 • + Summer of Drones
  20. felixge Summer of Drones June 2013

  21. @felixge felixge Summer of Drones

  22. @felixge felixge Summer of Drones • 4 weeks in June

    2013
  23. @felixge felixge Summer of Drones • 4 weeks in June

    2013
  24. @felixge felixge Summer of Drones • 4 weeks in June

    2013 • 10+ NodeCopter events, and 20+ MiniNodeCopter events
  25. @felixge felixge Summer of Drones • 4 weeks in June

    2013 • 10+ NodeCopter events, and 20+ MiniNodeCopter events
  26. @felixge felixge Summer of Drones • 4 weeks in June

    2013 • 10+ NodeCopter events, and 20+ MiniNodeCopter events • North America, Europe, South America and Asia
  27. @felixge felixge Summer of Drones

  28. @felixge felixge Summer of Drones • Drone games / competitions

  29. @felixge felixge Summer of Drones • Drone games / competitions

  30. @felixge felixge Summer of Drones • Drone games / competitions

    • Half autonomous / half human controlled
  31. @felixge felixge Summer of Drones • Drone games / competitions

    • Half autonomous / half human controlled
  32. @felixge felixge Summer of Drones • Drone games / competitions

    • Half autonomous / half human controlled • Spectators for the tournaments
  33. None
  34. felixge http://nodecopter.com/

  35. felixge This Talk

  36. felixge Flying robots over a 10.000 mile distance with JavaScript

  37. felixge <alternative title>

  38. felixge Somebody in Berlin presses a button. Nothing happens.

  39. felixge <alternative title>

  40. felixge “NodeCopter” terror cell under investigation. Drone strike causes several

    injuries at Sidney JavaScript meetup.
  41. felixge Drone Self-Defense

  42. felixge Tip 1: Flip drone up-side down

  43. felixge Tip 2: Nerf Gun

  44. felixge just kidding

  45. @felixge felixge Parrot AR Drone 2.0

  46. @felixge felixge The Specs

  47. @felixge felixge The Specs • WiFi (b/g/n) Router

  48. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor
  49. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor • 125 MB DDR2 Memory
  50. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor • 125 MB DDR2 Memory • Linux 2.6.32 you can telnet into it (Busybox)
  51. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor • 125 MB DDR2 Memory • Linux 2.6.32 you can telnet into it (Busybox) • 720p front facing camera (30 FPS)
  52. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor • 125 MB DDR2 Memory • Linux 2.6.32 you can telnet into it (Busybox) • 720p front facing camera (30 FPS) • 240p vertical camera (60 FPS)
  53. @felixge felixge The Specs • WiFi (b/g/n) Router • 1

    GHz 32Bit ARM Cortex A8 processor • 125 MB DDR2 Memory • Linux 2.6.32 you can telnet into it (Busybox) • 720p front facing camera (30 FPS) • 240p vertical camera (60 FPS) • USB 2.0 connector
  54. @felixge felixge The Specs

  55. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

  56. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

    • 3 axis accelerometer (+-50mg precision)
  57. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

    • 3 axis accelerometer (+-50mg precision) • 3 axis magnetometer (6° precision)
  58. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

    • 3 axis accelerometer (+-50mg precision) • 3 axis magnetometer (6° precision) • Pressure sensor (+-10 Pa precision)
  59. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

    • 3 axis accelerometer (+-50mg precision) • 3 axis magnetometer (6° precision) • Pressure sensor (+-10 Pa precision) • Ultrasound sensors
  60. @felixge felixge The Specs • 3 axis gyroscope (2000°/second precision)

    • 3 axis accelerometer (+-50mg precision) • 3 axis magnetometer (6° precision) • Pressure sensor (+-10 Pa precision) • Ultrasound sensors • Fully reparable - all components can be ordered
  61. @felixge felixge Normal Setup Parrot AR Drone 2.0 Smartphone or

    Laptop WiFi
  62. felixge WiFi Range is ~50m

  63. felixge Berlin -> Australia

  64. @felixge felixge

  65. felixge ~10.000 miles (~16.000 km)

  66. felixge We need to extend range by 320.000x

  67. felixge “No problem, we’ll just set up an ssh tunnel,

    should take ~30 minutes” --me
  68. felixge 30 minutes - yeah right

  69. felixge ~8 hours

  70. @felixge felixge The Idea Parrot AR Drone 2.0 @SydJS Laptop

    @SydJS WiFi @SydJS Router Ethernet Router @Berlin Laptop @Berlin THE INTERNET WiFi
  71. @felixge felixge Reverse SSH Tunnel ssh -NT \ -R 2023:192.168.1.1:23

    \ sydjs@91.64.83.193 • Connect to my laptop in Berlin (sydjs@91.64.83.193) • Forward port 2023 on my laptop to port 23 at 192.168.1.1 (the AR Drone) • -N (do not execute a cmd) -T (disable pseudo-tty)
  72. felixge Works great for TCP

  73. felixge Does not work with UDP

  74. felixge netcat to the rescue!

  75. @felixge felixge netcat udp forwarding # @sydjs ssh -NT \

    -R 6556:localhost:6556 \ sydjs@91.64.83.193 & mkfifo navdata.fifo nc -l localhost 6556 < navdata.fifo \ | nc -u 192.168.1.1 5556 > navdata.fifo # @berlin mkfifo navdata.fifo nc -l -u localhost 5556 < navdata.fifo \ | nc localhost 65556 > navdata.fifo
  76. felixge No luck : (

  77. felixge Node.js to the rescue

  78. @felixge felixge In Sidney • SSH Reverse tunnel for telnet

    and video (ports 23 and 5555) • SSH Reverse tunnel for udp (port 2024) • node.js TCP server on port 2024 listening for incoming connection from Berlin • Incoming tcp data = udp messages • Forwards messages received on tcp server via udp to drone • Also forwards udp messages from drone back to berlin via tcp
  79. @felixge felixge In Berlin • node.js UDP server listening on

    port 5554 (navdata) and 5556 (control) • node.js TCP connection to port 2024 on localhost which is hooked up to port 2024 in sidney • Incoming UDP messages are send to Sidney via TCP • Data received via TCP from Sidney is resend as UDP locally
  80. @felixge felixge Problem • UDP guarantees atomic messages • TCP

    does not (one message may be split into multiple parts, or merged with others)
  81. @felixge felixge Simple Protocol • 4 Bytes: Message Length •

    2 Bytes: Source UDP Port • 2 Bytes: Destination UDP Port • <Message Length>: Message
  82. felixge <demo time> what could go wrong?

  83. felixge </demo time>

  84. felixge https://github.com/felixge/nodecopter-ssh-tunnel https://github.com/felixge/ar-drone https://github.com/bkw/node-dronestream

  85. felixge So little JS!

  86. felixge Thanks!

  87. felixge Questions? Felix Geisendörfer