Nov 21, 2015Nov 23, 2014 Sofia var title = “JS Robotics”; var info = { author: “Stamo Petkov”, description: “JavaScript in real world!”, company: “Information Services Plc.”, email: “stamo.petkov@gmail.com”, blog: “www.stamopetkov.eu” };
Nov 21, 2015 agenda(); • What do I mean by Robotics? • Why JS Robotics? • Firmata • Breaking out of the computer • Give me Johnny Five • Cylon power • Lets put the family together or how to play without pissing off your wife Stamo Petkov JS Robotics
Nov 21, 2015 What do I mean by Robotics? What do you think robotics is? What do you imagine when you here Robotics?
Nov 21, 2015Stamo Petkov JS Robotics
Nov 21, 2015Stamo Petkov JS Robotics
Nov 21, 2015Stamo Petkov JS Robotics
Nov 21, 2015 The word “Robotics” • Rossum’s Universal Robots, 1921, Karel Čapek o Labori / from latin “labor” o Roboti / from Old Church Slavonic “rabota” • The Liar, 1942, Isaak Asimov o Robotics – by analog with “Mathematics” and “Physics” • Robotics – definition, Meriam Webster o technology dealing with the design, construction, and operation of robots in automation Stamo Petkov JS Robotics
Nov 21, 2015 Why JS Robotics? Really?! Who needs explanation why JavaScript is super cool?
Nov 21, 2015 Why JS Robotics? • JavaScript is easy to learn yet powerful programming language • Every web developer knows enough JavaScript to start building robots immediately • You can develop and run it on any platform. No special tools or additional payments required • Rich frameworks that encapsulate the hard part of robot programming • Very large community with hundreds of examples and demo projects • Cheap hardware* Stamo Petkov JS Robotics
Nov 21, 2015 Firmata
Nov 21, 2015 Firmata • Firmata is a protocol for communicating with microcontrollers from software on a computer (or smartphone/tablet, etc). • The intention of this protocol is allow as much of the microcontroller to be controlled as possible from the host computer. • The data communication format uses MIDI messages. • Commands bytes are 8 bits and data bytes are 7 bits. • Sysex-based commands are used for an extended command set. Stamo Petkov JS Robotics
Nov 21, 2015 Firmata SysEx • Midi System Exclusive (Sysex) messages can be any length and are therefore used most prominently throughout the Firmata protocol. • The idea for SysEx is to have a second command space using the first byte after the SysEx start byte. • The key difference is that data can be of any size, rather than just one or two bytes for standard MIDI messages. • Generic SysEx Message Stamo Petkov JS Robotics 0 START_SYSEX (0xF0) (MIDI System Exclusive) 1 sysex command (0x00-0x7F) 7-bit bytes of arbitrary data N END_SYSEX (0xF7) (MIDI End of SysEx - EOX)
Nov 21, 2015 Firmata Implementations • Firmata library for Arduino and Arduino-compatible devices o There are two main models of usage of Firmata • Use various methods provided by the Firmata library to selectively send and receive data between the Arduino device and the software running on the host computer • load a general purpose sketch called StandardFirmata (or one of the variants such as StandardFirmataPlus or StandardFirmataEthernet depending on your needs) on the Arduino board and then use the host computer exclusively to interact with the Arduino board • Firmata for Sparks (now Particle) o Prototyping tools for the Internet of Things Stamo Petkov JS Robotics
Nov 21, 2015 Firmata client libraries • Several Firmata client libraries have been implemented in a variety of popular programming languages: o Procesing - funnel o Python – pyduino, python-firmata, pyFirmata, pyMata o Perl – perl-firmata, rx-firmata o ruby – rufinol, funnel o clojure – clodiuno, clj-firmata o JavaScript – beakout, johny-five o java – Javarduino, firmata4j o .NET – firmatanet, Arduino o Flash/AS3 – as3glue, funnel o PHP – carica-fermata, phpmake_firmata o Haskell - hArduino o iOS - iosfirmata o Dart - firmata o Max/MSP - maxuino Stamo Petkov JS Robotics
Nov 21, 2015 Breaking out of the computer
Nov 21, 2015 Breakout • Simple platform to enable designers to prototype functional web-based interfaces to the physical world • Arduino platform and the Firmata protocol are leveraged to enable users to access physical input and output purely from JavaScript • You can also use Breakout with PhoneGap to create applications that use native device sensors and actuators (accelerometer, compass, vibration motor, etc.) and native multimedia features along with external sensors and actuators such as servo motors, motion detectors, etc. • simple WebSocket and HTTP server that bridges an I/O board (such as Arduino) to a web browser Stamo Petkov JS Robotics
Nov 21, 2015Stamo Petkov JS Robotics Breakout
Nov 21, 2015Stamo Petkov JS Robotics Hello Breakout world var IOBoard = BO.IOBoard; var BOLed = BO.io.LED; var arduino = new IOBoard("localhost", 8887); var led = new BOLed(arduino, arduino.getDigitalPin(11)); $('#btnLeft').on('click', function(evt){ led.on(); }); $('#btnRight').on('click', function(evt){ led.off(); });
Nov 21, 2015 Give me Johnny Five
Nov 21, 2015 Johnny five • Open Source, Firmata Protocol based, IoT and Robotics programming framework • Programs can be written for Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more • Johnny-Five program can run o In an on-board Linux environment o On a host machine tethered (via Serial USB or Ethernet) to a client o On a host machine communicating over Wifi to the client o On a host machine communicating over Bluetooth to the client Stamo Petkov JS Robotics
Nov 21, 2015 Johnny five flexible design • Communicates with different platforms through IO Plugins. An IO Plugin is any class whose instances implement a Firmata compatible interface • board-io o An extendable implementation of Johnny Five's IO Plugins o Implements all required and optional methods, along with the required constants - MODE, HIGH, LOW, etc. • TODO: Define pluggable transports, for example: replacing node-serialport with socket.io-serialport and similar Stamo Petkov JS Robotics
Nov 21, 2015 Hello Johnny five! var five = require("johnny-five"); var board = new five.Board(); board.on("ready", function() { var led = new five.Led(13); led.blink(500); }); Stamo Petkov JS Robotics
Nov 21, 2015 Cylon power JavaScript Robotics, By Your Command
Nov 21, 2015 Cylon.js • Based on Node.js and Firmata • Cylon.js provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time • Cylon.js has an extensible system for connecting to hardware devices. It supports 36 different platforms and many General Purpose Input/Output (GPIO) and Inter- Integrated Circuit (I2C) devices • Cylon uses the Gort toolkit, so you can access important features from the command line Stamo Petkov JS Robotics
Nov 21, 2015 Cylon.js platforms and devices • ARDrone, Arduino, Arduino YUN, Audio, Beaglebone Black, Bebop, BLE, Crazyflie, Digispark, Imp, Intel Galileo, Intel Edison, Intel IoT, Analytics, Joystick, Keyboard, Leap Motion, M2X, MiP, MQTT, Nest, Neurosky, Ollie, OpenCV, Particle, Pebble, Philips Hue, Pinoccio, PowerUp, Rapiro, Raspberry Pi, Salesforce, Skynet, Speech, Sphero, Tessel, WICED Sense • General Purpose Input/Output (GPIO) devices o Analog Sensor, Button, Continuous Servo, Direct Pin, IR Range Finder, LED, Makey Button, Maxbotix, Motor, Relay, RGB LED, Servo • Inter-Integrated Circuit (I2C) devices o BlinkM, BMP180, HMC6352 Compass, LCD, LIDAR-Lite, LSM9DS0G, LSM9DS0XM, MPL115A2, MPU6050, PCA9685 Stamo Petkov JS Robotics
Nov 21, 2015 Cylon.js APIs • Cylon.js uses a simple plug-in system for API modules • HTTP API o interact with your robots remotely o By default, an unconfigured API instance will listen on https://127.0.0.1:3000, using a self-signed cert and with no authentication. • MQTT o extremely lightweight publish/subscribe messaging transport o machine-to-machine connectivity protocol • SocketIO API o remotely interact with your robots in real-time Stamo Petkov JS Robotics
Nov 21, 2015 Hello Cylon.js! var Cylon = require('cylon'); Cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } }, devices: { led: { driver: 'led', pin: 13 }, button: { driver: 'button', pin: 2 } }, work: function(my) { my.button.on('push', function() { my.led.toggle() }); } }).start(); Stamo Petkov JS Robotics
Nov 21, 2015 Lets put the family together or how to play without pissing off your wife Lego to the rescue
Nov 21, 2015 Lego Mindstorms • It is LEGO. So children will be excited to take part in your games • Lego technic based, so you can combine with any technic set Stamo Petkov JS Robotics
Nov 21, 2015 Lego Mindstorms • Programmable Brick to control and power your robot • Many sensors and motors very easy to assemble, no need of additional electronic parts • Can connect through USB, Bluetooth and Wi-Fi • Programs can be uploaded to the brick or executed on host computer • Can be programmed with easy to use software just by dragging and dropping programming blocks • Can be programmed with all .NET languages, including WinJs • Very soon Johnny-Five programs will be able to run directly on an EV3 brick! Stamo Petkov JS Robotics
Nov 21, 2015Stamo Petkov JS Robotics
Nov 21, 2015 Thanks to our Sponsors: General Sponsor: Gold Sponsors: Media Partners: Technological Partners: Hosting Partner:

Js robotics

  • 1.
    Nov 21, 2015Nov23, 2014 Sofia var title = “JS Robotics”; var info = { author: “Stamo Petkov”, description: “JavaScript in real world!”, company: “Information Services Plc.”, email: “stamo.petkov@gmail.com”, blog: “www.stamopetkov.eu” };
  • 2.
    Nov 21, 2015 agenda(); •What do I mean by Robotics? • Why JS Robotics? • Firmata • Breaking out of the computer • Give me Johnny Five • Cylon power • Lets put the family together or how to play without pissing off your wife Stamo Petkov JS Robotics
  • 3.
    Nov 21, 2015 Whatdo I mean by Robotics? What do you think robotics is? What do you imagine when you here Robotics?
  • 4.
    Nov 21, 2015StamoPetkov JS Robotics
  • 5.
    Nov 21, 2015StamoPetkov JS Robotics
  • 6.
    Nov 21, 2015StamoPetkov JS Robotics
  • 7.
    Nov 21, 2015 Theword “Robotics” • Rossum’s Universal Robots, 1921, Karel Čapek o Labori / from latin “labor” o Roboti / from Old Church Slavonic “rabota” • The Liar, 1942, Isaak Asimov o Robotics – by analog with “Mathematics” and “Physics” • Robotics – definition, Meriam Webster o technology dealing with the design, construction, and operation of robots in automation Stamo Petkov JS Robotics
  • 8.
    Nov 21, 2015 WhyJS Robotics? Really?! Who needs explanation why JavaScript is super cool?
  • 9.
    Nov 21, 2015 WhyJS Robotics? • JavaScript is easy to learn yet powerful programming language • Every web developer knows enough JavaScript to start building robots immediately • You can develop and run it on any platform. No special tools or additional payments required • Rich frameworks that encapsulate the hard part of robot programming • Very large community with hundreds of examples and demo projects • Cheap hardware* Stamo Petkov JS Robotics
  • 10.
  • 11.
    Nov 21, 2015 Firmata •Firmata is a protocol for communicating with microcontrollers from software on a computer (or smartphone/tablet, etc). • The intention of this protocol is allow as much of the microcontroller to be controlled as possible from the host computer. • The data communication format uses MIDI messages. • Commands bytes are 8 bits and data bytes are 7 bits. • Sysex-based commands are used for an extended command set. Stamo Petkov JS Robotics
  • 12.
    Nov 21, 2015 FirmataSysEx • Midi System Exclusive (Sysex) messages can be any length and are therefore used most prominently throughout the Firmata protocol. • The idea for SysEx is to have a second command space using the first byte after the SysEx start byte. • The key difference is that data can be of any size, rather than just one or two bytes for standard MIDI messages. • Generic SysEx Message Stamo Petkov JS Robotics 0 START_SYSEX (0xF0) (MIDI System Exclusive) 1 sysex command (0x00-0x7F) 7-bit bytes of arbitrary data N END_SYSEX (0xF7) (MIDI End of SysEx - EOX)
  • 13.
    Nov 21, 2015 FirmataImplementations • Firmata library for Arduino and Arduino-compatible devices o There are two main models of usage of Firmata • Use various methods provided by the Firmata library to selectively send and receive data between the Arduino device and the software running on the host computer • load a general purpose sketch called StandardFirmata (or one of the variants such as StandardFirmataPlus or StandardFirmataEthernet depending on your needs) on the Arduino board and then use the host computer exclusively to interact with the Arduino board • Firmata for Sparks (now Particle) o Prototyping tools for the Internet of Things Stamo Petkov JS Robotics
  • 14.
    Nov 21, 2015 Firmataclient libraries • Several Firmata client libraries have been implemented in a variety of popular programming languages: o Procesing - funnel o Python – pyduino, python-firmata, pyFirmata, pyMata o Perl – perl-firmata, rx-firmata o ruby – rufinol, funnel o clojure – clodiuno, clj-firmata o JavaScript – beakout, johny-five o java – Javarduino, firmata4j o .NET – firmatanet, Arduino o Flash/AS3 – as3glue, funnel o PHP – carica-fermata, phpmake_firmata o Haskell - hArduino o iOS - iosfirmata o Dart - firmata o Max/MSP - maxuino Stamo Petkov JS Robotics
  • 15.
    Nov 21, 2015 Breakingout of the computer
  • 16.
    Nov 21, 2015 Breakout •Simple platform to enable designers to prototype functional web-based interfaces to the physical world • Arduino platform and the Firmata protocol are leveraged to enable users to access physical input and output purely from JavaScript • You can also use Breakout with PhoneGap to create applications that use native device sensors and actuators (accelerometer, compass, vibration motor, etc.) and native multimedia features along with external sensors and actuators such as servo motors, motion detectors, etc. • simple WebSocket and HTTP server that bridges an I/O board (such as Arduino) to a web browser Stamo Petkov JS Robotics
  • 17.
    Nov 21, 2015StamoPetkov JS Robotics Breakout
  • 18.
    Nov 21, 2015StamoPetkov JS Robotics Hello Breakout world var IOBoard = BO.IOBoard; var BOLed = BO.io.LED; var arduino = new IOBoard("localhost", 8887); var led = new BOLed(arduino, arduino.getDigitalPin(11)); $('#btnLeft').on('click', function(evt){ led.on(); }); $('#btnRight').on('click', function(evt){ led.off(); });
  • 19.
    Nov 21, 2015 Giveme Johnny Five
  • 20.
    Nov 21, 2015 Johnnyfive • Open Source, Firmata Protocol based, IoT and Robotics programming framework • Programs can be written for Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more • Johnny-Five program can run o In an on-board Linux environment o On a host machine tethered (via Serial USB or Ethernet) to a client o On a host machine communicating over Wifi to the client o On a host machine communicating over Bluetooth to the client Stamo Petkov JS Robotics
  • 21.
    Nov 21, 2015 Johnnyfive flexible design • Communicates with different platforms through IO Plugins. An IO Plugin is any class whose instances implement a Firmata compatible interface • board-io o An extendable implementation of Johnny Five's IO Plugins o Implements all required and optional methods, along with the required constants - MODE, HIGH, LOW, etc. • TODO: Define pluggable transports, for example: replacing node-serialport with socket.io-serialport and similar Stamo Petkov JS Robotics
  • 22.
    Nov 21, 2015 HelloJohnny five! var five = require("johnny-five"); var board = new five.Board(); board.on("ready", function() { var led = new five.Led(13); led.blink(500); }); Stamo Petkov JS Robotics
  • 23.
    Nov 21, 2015 Cylonpower JavaScript Robotics, By Your Command
  • 24.
    Nov 21, 2015 Cylon.js •Based on Node.js and Firmata • Cylon.js provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time • Cylon.js has an extensible system for connecting to hardware devices. It supports 36 different platforms and many General Purpose Input/Output (GPIO) and Inter- Integrated Circuit (I2C) devices • Cylon uses the Gort toolkit, so you can access important features from the command line Stamo Petkov JS Robotics
  • 25.
    Nov 21, 2015 Cylon.jsplatforms and devices • ARDrone, Arduino, Arduino YUN, Audio, Beaglebone Black, Bebop, BLE, Crazyflie, Digispark, Imp, Intel Galileo, Intel Edison, Intel IoT, Analytics, Joystick, Keyboard, Leap Motion, M2X, MiP, MQTT, Nest, Neurosky, Ollie, OpenCV, Particle, Pebble, Philips Hue, Pinoccio, PowerUp, Rapiro, Raspberry Pi, Salesforce, Skynet, Speech, Sphero, Tessel, WICED Sense • General Purpose Input/Output (GPIO) devices o Analog Sensor, Button, Continuous Servo, Direct Pin, IR Range Finder, LED, Makey Button, Maxbotix, Motor, Relay, RGB LED, Servo • Inter-Integrated Circuit (I2C) devices o BlinkM, BMP180, HMC6352 Compass, LCD, LIDAR-Lite, LSM9DS0G, LSM9DS0XM, MPL115A2, MPU6050, PCA9685 Stamo Petkov JS Robotics
  • 26.
    Nov 21, 2015 Cylon.jsAPIs • Cylon.js uses a simple plug-in system for API modules • HTTP API o interact with your robots remotely o By default, an unconfigured API instance will listen on https://127.0.0.1:3000, using a self-signed cert and with no authentication. • MQTT o extremely lightweight publish/subscribe messaging transport o machine-to-machine connectivity protocol • SocketIO API o remotely interact with your robots in real-time Stamo Petkov JS Robotics
  • 27.
    Nov 21, 2015 HelloCylon.js! var Cylon = require('cylon'); Cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } }, devices: { led: { driver: 'led', pin: 13 }, button: { driver: 'button', pin: 2 } }, work: function(my) { my.button.on('push', function() { my.led.toggle() }); } }).start(); Stamo Petkov JS Robotics
  • 28.
    Nov 21, 2015 Letsput the family together or how to play without pissing off your wife Lego to the rescue
  • 29.
    Nov 21, 2015 LegoMindstorms • It is LEGO. So children will be excited to take part in your games • Lego technic based, so you can combine with any technic set Stamo Petkov JS Robotics
  • 30.
    Nov 21, 2015 LegoMindstorms • Programmable Brick to control and power your robot • Many sensors and motors very easy to assemble, no need of additional electronic parts • Can connect through USB, Bluetooth and Wi-Fi • Programs can be uploaded to the brick or executed on host computer • Can be programmed with easy to use software just by dragging and dropping programming blocks • Can be programmed with all .NET languages, including WinJs • Very soon Johnny-Five programs will be able to run directly on an EV3 brick! Stamo Petkov JS Robotics
  • 31.
    Nov 21, 2015StamoPetkov JS Robotics
  • 32.
    Nov 21, 2015 Thanksto our Sponsors: General Sponsor: Gold Sponsors: Media Partners: Technological Partners: Hosting Partner:

Editor's Notes

  • #12 The protocol can be implemented in firmware on any microcontroller architecture as well as software on any computer software package. This protocol then was designed for the direct communication between a microcontroller and an software object on a host computer. The host software object should then provide an interface that makes sense in that environment. MIDI - Musical instrument digital interface
  • #17 The server uses webbit for the WebSocket and HTTP server connections. If you prefer, you can serve your pages from another web server (for example if you need to use php) and simply use Breakout Server to connect to the I/O board via WebSockets.
  • #25 GORT is a Command Line Toolkit for RobotOps Gort provides tools to scan for connected devices, upload firmware, and more.