$30 off During Our Annual Pro Sale. View Details »

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 : /.

Felix Geisendörfer

November 21, 2012
Tweet

More Decks by Felix Geisendörfer

Other Decks in Programming

Transcript

  1. felixge
    NodeCopter
    Flying robots over a 10.000 mile
    distance with JavaScript
    Felix Geisendörfer

    View Slide

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

    View Slide

  3. @felixge
    felixge
    npm modules
    Felix Geisendörfer

    View Slide

  4. @felixge
    felixge
    NodeCopter

    View Slide

  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)

    View Slide

  6. View Slide

  7. View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. @felixge
    felixge
    1 day

    View Slide

  13. @felixge
    felixge
    1 day
    • Computer vision

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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

    View Slide

  19. @felixge
    felixge
    Upcoming Events
    • San Francisco, Dec 1st, 2012
    • Florida, May 30, 2013
    • + Summer of Drones

    View Slide

  20. felixge
    Summer of Drones
    June 2013

    View Slide

  21. @felixge
    felixge
    Summer of Drones

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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

    View Slide

  27. @felixge
    felixge
    Summer of Drones

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  33. View Slide

  34. felixge
    http://nodecopter.com/

    View Slide

  35. felixge
    This Talk

    View Slide

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

    View Slide

  37. felixge

    View Slide

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

    View Slide

  39. felixge

    View Slide

  40. felixge
    “NodeCopter” terror cell
    under investigation.
    Drone strike causes several injuries at
    Sidney JavaScript meetup.

    View Slide

  41. felixge
    Drone Self-Defense

    View Slide

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

    View Slide

  43. felixge
    Tip 2:
    Nerf Gun

    View Slide

  44. felixge
    just kidding

    View Slide

  45. @felixge
    felixge
    Parrot AR Drone 2.0

    View Slide

  46. @felixge
    felixge
    The Specs

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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)

    View Slide

  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)

    View Slide

  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)

    View Slide

  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

    View Slide

  54. @felixge
    felixge
    The Specs

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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)

    View Slide

  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

    View Slide

  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

    View Slide

  61. @felixge
    felixge
    Normal Setup
    Parrot AR
    Drone 2.0
    Smartphone
    or
    Laptop
    WiFi

    View Slide

  62. felixge
    WiFi Range is ~50m

    View Slide

  63. felixge
    Berlin -> Australia

    View Slide

  64. @felixge
    felixge

    View Slide

  65. felixge
    ~10.000 miles
    (~16.000 km)

    View Slide

  66. felixge
    We need to extend
    range by 320.000x

    View Slide

  67. felixge
    “No problem, we’ll
    just set up an ssh
    tunnel, should take
    ~30 minutes”
    --me

    View Slide

  68. felixge
    30 minutes - yeah right

    View Slide

  69. felixge
    ~8 hours

    View Slide

  70. @felixge
    felixge
    The Idea
    Parrot AR
    Drone 2.0
    @SydJS
    Laptop
    @SydJS
    WiFi @SydJS Router
    Ethernet
    Router
    @Berlin
    Laptop
    @Berlin
    THE
    INTERNET
    WiFi

    View Slide

  71. @felixge
    felixge
    Reverse SSH Tunnel
    ssh -NT \
    -R 2023:192.168.1.1:23 \
    [email protected]
    • Connect to my laptop in Berlin ([email protected])
    • 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)

    View Slide

  72. felixge
    Works great for TCP

    View Slide

  73. felixge
    Does not work with UDP

    View Slide

  74. felixge
    netcat to the rescue!

    View Slide

  75. @felixge
    felixge
    netcat udp forwarding
    # @sydjs
    ssh -NT \
    -R 6556:localhost:6556 \
    [email protected] &
    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

    View Slide

  76. felixge
    No luck : (

    View Slide

  77. felixge
    Node.js to the rescue

    View Slide

  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

    View Slide

  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

    View Slide

  80. @felixge
    felixge
    Problem
    • UDP guarantees atomic messages
    • TCP does not (one message may be split into multiple parts, or merged
    with others)

    View Slide

  81. @felixge
    felixge
    Simple Protocol
    • 4 Bytes: Message Length
    • 2 Bytes: Source UDP Port
    • 2 Bytes: Destination UDP Port
    • : Message

    View Slide

  82. felixge

    what could go wrong?

    View Slide

  83. felixge

    View Slide

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

    View Slide

  85. felixge
    So little JS!

    View Slide

  86. felixge
    Thanks!

    View Slide

  87. felixge
    Questions?
    Felix Geisendörfer

    View Slide