Js robotics
-
Upload
stamo-petkov -
Category
Technology
-
view
510 -
download
0
Transcript of Js robotics
Nov 21, 2015
Nov 23, 2014Sofia
var title = “JS Robotics”;
var info = {author: “Stamo Petkov”,description: “JavaScript in real
world!”, company: “Information Services Plc.”,
email: “[email protected]”,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, 2015
Stamo Petkov JS Robotics
Nov 21, 2015
Stamo Petkov JS Robotics
Nov 21, 2015
Stamo Petkov JS Robotics
Nov 21, 2015
The word “Robotics”
• Rossum’s Universal Robots, 1921, Karel Čapeko Labori / from latin “labor” o Roboti / from Old Church Slavonic “rabota”
• The Liar, 1942, Isaak Asimovo Robotics – by analog with “Mathematics” and “Physics”
• Robotics – definition, Meriam Webstero 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 deviceso 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 - funnelo Python – pyduino, python-firmata, pyFirmata, pyMatao Perl – perl-firmata, rx-firmata o ruby – rufinol, funnelo clojure – clodiuno, clj-firmatao JavaScript – beakout, johny-fiveo java – Javarduino, firmata4jo .NET – firmatanet, Arduinoo Flash/AS3 – as3glue, funnelo PHP – carica-fermata, phpmake_firmatao Haskell - hArduinoo iOS - iosfirmatao Dart - firmatao 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, 2015
Stamo Petkov JS Robotics
Breakout
Nov 21, 2015
Stamo Petkov JS Robotics
Hello Breakout worldvar 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 runo In an on-board Linux environmento On a host machine tethered (via Serial USB or Ethernet) to a
cliento On a host machine communicating over Wifi to the cliento 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-ioo An extendable implementation of Johnny Five's IO Pluginso 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 powerJavaScript 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) deviceso 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 remotelyo By default, an unconfigured API instance will
listen on https://127.0.0.1:3000, using a self-signed cert and with no authentication.
• MQTTo extremely lightweight publish/subscribe messaging
transporto 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, 2015
Stamo Petkov JS Robotics
Nov 21, 2015
Thanks to our Sponsors:General Sponsor:
Gold Sponsors:
Media Partners:
Technological Partners:
Hosting Partner: