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

Rock 'em Socket.IO Bots

Ari Rizzitano
September 05, 2013

Rock 'em Socket.IO Bots

How I used Socket.IO, TBone.js, a Raspberry Pi, and an RC car to build a telepresence robot.

Ari Rizzitano

September 05, 2013
Tweet

More Decks by Ari Rizzitano

Other Decks in Programming

Transcript

  1. + +

  2. PETBOT • iPad on lightweight chassis on RC car •

    Raspberry Pi powers car’s radio transmitter • Battery pack or wall wart for Pi • Web UI & remote Socket.IO server control Pi
  3. The “Brain” • Two node servers, one remote & one

    local • Remote: serves UI, receives & sends commands • Local: relays commands as electronic signals
  4. TBone.js • T(‘model.propName’, ‘value’): set a value • T(‘model.propName’): lookup

    • T(function () { console.log(T(‘model.propName’)); }); • ^Executes when internal T-references change
  5. Remote Client • Control with arrow keys • T(‘drive’): state

    of keys pressed • T(‘keepDriving’): heartbeat to continue signaling
  6. Remote Server • T(‘drive’): current drive state • T(‘bots’): clients

    listening for commands • T(‘browsers’): clients controlling the bot(s) • T(‘botOnline’): whether a bot is connected
  7. Local Server • Connects to remote server as a client

    • Receive synced events and data • Send bot state back to remote server
  8. Working with Pi • 256MB RAM, runs Raspbian (Wheezy) •

    Build and install NPM from source • Power management can be an issue • autorun.sh for syncing changes
  9. raspi.js • Extends LocalServer • Open and close gpio pins

    • Write to pins on drive event start and end • Other board modules can work the same way
  10. TODO • Move off Heroku (and use real websockets) •

    Build and test modules for other boards • Write tests and benchmark latency • Simulation, mapping, position tracking
  11. Future Projects • Differential drive/hardware upgrades • WebRTC/Android tablet •

    LCD and webcam powered by Pi • Unified rechargeable power source • Generic components and 3D printable parts