Solving the robot problem• I want to build a robot• I love coding• I want pro gear   –   servos   –   motors   –   acceler...
So, this robot…• has physical devices that attach simply• is running a software framework that  – talks to those physical ...
But isn’t JavaScript a terrible language          to build robots with?• JavaScript has bad timers• Very slow and memory i...
Those guys don’t know everything• We have modern, low wattage RISC based ARM  processors• We have modern interpreters (i.e...
What do we gain by using JavaScript?• It makes a lot of high level tasks very easy• These days it can do way cool stuff• B...
Who’s crazy now?
What currently exists for JS robotics?• The original talk:    http://www.slideshare.net/nonken/robotic-javascript•   Nodec...
What do they do for us?• Nodecopter helps us talk to a proprietary  helicopter drone• Nodeserial helps us talk to the seri...
What’s the ideal architecture?
What’s the ideal architecture?•   We want a familiar interface•   Web pages are good•   Something REST-like would be ideal...
What’s the ideal architecture?• Model-Collection-Controller/Model-View-  Collection• Discrete physical devices are represe...
Step up Raspberry Pi•   Modern ARM based SOC•   Low power•   Runs Linux•   Loads of storage space•   USB 2.0•   Bonus onbo...
Add some clever USB devices• Wifi• Pololu  – serial comms using serialport• Phidget  – http/serial bridge using phigetapi
Add Node.JS and the SPD framework• Listens on local TCP/IP network• Serves up dynamic web pages• Uses Backbone API• Automa...
Robot is online
Give me that checklist• It’s got servos• It’s got motors• It’s got GPS• It’s got accelerometers• It’s got Arduino (should ...
Enough talk•   Drive the car around the stage•   Get my Google Map on•   Detect a crash•   Damn
NotesBibliography                Shout outs• Available on request      • jashkenas                            • voodootiki...
WE’RE HIRINGWWW.YAMMER.COM/JOBS      @rayui
Scaling into Meatspace: A JavaScript engineer's persepctive
Upcoming SlideShare
Loading in …5
×

Scaling into Meatspace: A JavaScript engineer's persepctive

12,448 views

Published on

A short presentation and demonstration of a robot I made at MLOC.JS 2013.

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
12,448
On SlideShare
0
From Embeds
0
Number of Embeds
4,353
Actions
Shares
0
Downloads
36
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide
  • I want to build a robotbut I hate solderingI love codingbut I hate the pain of embedded languagesI want pro gear: servos, motors, accelerometers, GPS, etc.but I don’t want to have to care about TTL, parity checks, serial cables or baud ratesI want it on the webI want it nowtomorrow is acceptable
  • JavaScript has bad timersincapable of generating high precision line signals for GPIO devicesVery slow and memory inefficient compared to close-to-the-metal languages like C/C++you’d never write a device driver in itprobably sucks for battery lifeAll the C/Java guys I know are like, "What the hell are you doing? Are you crazy?"
  • We have modern, low wattage RISC based ARM processorsWe have modern interpreters (i.e. V8) that are very good at optimising our code at run timeWriting device drivers in C/C++ is a total chore for most people and should be avoided if at all possibleWe can buy off the shelf components that can do our time critical stuff and still talk high level protocolsIt’s not the 90s! Why are we even talking about writing device drivers?
  • It makes a lot of high level tasks very easyproduce a working prototype, fastavoid boring tasks that have already been solvedall the wholesome goodness of the Internet OOBeventscan everyone say "behaviour"?These days it can do cool things likebe a serverreal time Internet using WebSocketsspeak protocols other than Internet, e.g. serialBig communityJS is the World's most popular programming language and is FTW
  • Nodecopter helps us talk to a proprietary helicopter dronethat's just talking to a robot that someone else built.Nodeserial helps us talk to the serial portthis is great because it's useful for all sorts of devices but it doesn't tell us how to talk to our devicesFirmataLovely idea but just tells us how to talk, not what to sayJohnny5 helps us control an Arduino with JSagain, great but if I want cool stuff like GPS I still have to wire it myselfstill doesn't help with our goal of fully integrating both meat and cyber spaces
  • Model-Collection-Controller/Model-View-CollectionDiscrete physical devices are represented as discrete models in memory on serverModels bound to device change eventsControllers talk to client via WebSocketsRobot's canonical state kept on server (the car itself!), allowingautonomous behaviournetwork failover handled gracefully
  • WifiPololu (serial using serialport)Phidget (http/serial bridge using phigetapi)
  • Scaling into Meatspace: A JavaScript engineer's persepctive

    1. 1. Solving the robot problem• I want to build a robot• I love coding• I want pro gear – servos – motors – accelerometers – GPS – etc• I want it on the web• I want it now
    2. 2. So, this robot…• has physical devices that attach simply• is running a software framework that – talks to those physical devices – exposes their properties to the web – responds to user input from the web in as close to real time as possible – can express a degree of autonomy – is fast to develop in
    3. 3. But isn’t JavaScript a terrible language to build robots with?• JavaScript has bad timers• Very slow and memory inefficient compared to close-to-the-metal languages like C/C++• All the C/Java guys I know are like, "What the hell are you doing? Are you crazy?"
    4. 4. Those guys don’t know everything• We have modern, low wattage RISC based ARM processors• We have modern interpreters (i.e. V8) that are very good at optimising our code at run time• Writing device drivers in C/C++ is a total chore for most people• We can buy off the shelf components that can do our time critical• It’s not the 90s!
    5. 5. What do we gain by using JavaScript?• It makes a lot of high level tasks very easy• These days it can do way cool stuff• Big community FTW
    6. 6. Who’s crazy now?
    7. 7. What currently exists for JS robotics?• The original talk: http://www.slideshare.net/nonken/robotic-javascript• Nodecopter (nodecopter.com)• Nodeserial (@voodootikigod)• Firmata (Julian Gautier)• Johnny 5 (Rick Waldron)
    8. 8. What do they do for us?• Nodecopter helps us talk to a proprietary helicopter drone• Nodeserial helps us talk to the serial port• Firmata helps us talk with an Arduino• Johnny5 helps us control that Arduino with JS
    9. 9. What’s the ideal architecture?
    10. 10. What’s the ideal architecture?• We want a familiar interface• Web pages are good• Something REST-like would be ideal• Express helps• BackboneIO (Backbone over WebSockets)• State machine representation of physical devices• Adding a new physical device should be as simple as plugging it in
    11. 11. What’s the ideal architecture?• Model-Collection-Controller/Model-View- Collection• Discrete physical devices are represented as discrete models in memory on server• Models bound to device change events• Controllers talk to client via WebSockets• Robots canonical state kept on server, allows autonomous behaviour
    12. 12. Step up Raspberry Pi• Modern ARM based SOC• Low power• Runs Linux• Loads of storage space• USB 2.0• Bonus onboard graphics processor
    13. 13. Add some clever USB devices• Wifi• Pololu – serial comms using serialport• Phidget – http/serial bridge using phigetapi
    14. 14. Add Node.JS and the SPD framework• Listens on local TCP/IP network• Serves up dynamic web pages• Uses Backbone API• Automagically builds models on client• Changes in remote hardware bound directly to client-side events• Looks to all the world exactly like a web site• We don’t even have to care about transport
    15. 15. Robot is online
    16. 16. Give me that checklist• It’s got servos• It’s got motors• It’s got GPS• It’s got accelerometers• It’s got Arduino (should you really need non-USB based sensor arrays)• It communicates with the web in real timeIt’s going to get a lot more• Real time streaming HD video• Kinect vision• Firmata?
    17. 17. Enough talk• Drive the car around the stage• Get my Google Map on• Detect a crash• Damn
    18. 18. NotesBibliography Shout outs• Available on request • jashkenas • voodootikigod • RIAEvangelist • visionmedia
    19. 19. WE’RE HIRINGWWW.YAMMER.COM/JOBS @rayui

    ×