SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Learn how to get your Groovy on with Lego
Mindstorms!
Created by /Ryan Vanderwerf @RyanVanderwerf - ReachForce
0
+
+
= FUN!
About Me
Chief Architect/Director @ ReachForce - we make B2 marketing data
better www.reachforce.com
Father of 2 girls under 10
Co-Chair Austin Groovy and Grails User Group
Co-Author of Effective Gradle Implementation Video Series on Packt
I like to modify all the things (cars, home automation, phones,
gadgets)
Into lots of Devops/Linux stuff and AWS
What we will cover
What is the EV3?
What is leJOS?
Layout and components of leJOS
Programming Model
How build components of leJOS with Gradle
Overview of leJOS APIs
Build and deploy a demo leJOS Groovy App
More advanced topics - Sensors and Events
WebRover 1 - Build, Run, and Play!
What is EV3?
EV3 is the latest generation LEGO Mindstorm Platform
TI ARM9 Core CPU (Runs ARMv5 instruction set)
64MB RAM
16gb internal flash
microSD slot
bluetooth wireless
usb port
New generation of 'smarter sensors' (single sensors replace many nxt
ones)
One big difference vs Raspberry Pi is it is a ARM11 with ARMv7
instruction set with hardfp(w/jdk!)
Latest leJOS includes Raspberry PI support called 'Brick Pi'
What is leJOS?
leJOS is a Java-based implementation that started on the Lego
Mindstorms RCX platform that runs on arm based processors. leJOS was
forked oringally from the 'TinyVM' project in 2000.
Available in 3 flavors: RCX, NXJ, and EV3 that are all still maintained
What is LeJOS?
Replacement firmware for building Lego Robots in Java
PC Tools for flashing Lego Brick
PC Apps to communicate to your robot from your PC via bluetooth,
Wifi, USB
Creates a running jar package to deploy on your robot for execution
Why no Groovy before now?
Groovy was too slow before @CompileStatic (Soft FP)
More limited audience
Many Java people still not educated on Groovy(but this has grown!)
leJOS didn't provide an easy way to run Groovy(core commiters
indifferent to Groovy)
Layouts and components of
leJOS
OS Image - boot/busybox
DBusJava - JNI classes for hardware
EV3 Classes - Abstraction Java Classes
EV3 Menu - long running process launches apps, remote connections
Other components
OS Image
Runs minimal OS and kernel - only subset of basic shell options and
commands available(busybox)
shell is 'ash' nowhere near feature comparable to bash
ps command only has 1 parameter 'w' for wide
leJOS interacts with it by starting up a java app called 'EV3Menu'
There isn't really enough RAM to run more than 1 VM besides what
leJOS uses (hello oom killer!)
DBusJava
JNI Layer that interacts with physical hardware
This is the glue to makes JVM classes work
Generally you don't need to do anything with it unless you are adding
unsupported hardware
see the README file under DBusJava/src for how to add modules
(outside scope of us here)
Feel free to use the artifact on my Bintray account, compile your own
with the scripts, or use your own artifact server
EV3Classes
Supporting Java classes for leJOS
This is all the Java implementation classes for the system
This is a monolithic code base/lib at this point all projects depend on
this to work
I've created some custom classes inside here to allow the Webrover to
work (later)
Divided into 4 sections - Hardware, Internal, Robotics and Utility
Hardware - Java representation of the lego hardware items
EV3Classes
Hardware
Support for Tetrix metal robots
Supports motors from EV3, NXT, RCX, Mindsensors Glidewheel-M,
regulated and unregulated
Supports GPS with this device
Ports - these are there the low level devices sensors are connected to
(Mostly I2C/UART)
Sensors - supports over 40 different kinds of sensors from Lego,
Dextor, HiTechnic and Mindsensors
LocalEV3 is the singleton class to get access to things (show example
in code)
Basic hardware objects on EV3 brick itself are in lejos.hardware base
pkg (Audio, LCD, buttons and keys)
http://www.dexterindustries.com/dGPS.html
EV3Classes
Internal
Handles bluetooth pairing with DBusJava
Internal EV3 implementation classes not part of public API
Low level linux hardware access classes (NIO)
If you use the classes they are subject to change without and kind of
deprecation or notice
EV3Classes
Remote
Mainly uses RMI
RemoteEV3 is main classes to access remotely (give it IP address)
Accessing hardware remotely pretty much as a 1:1 relation with
'Remote' in front of classs
Wifi support most stable
Bluetooth is working, but not considered as stable as Wifi (instructions
differ per platform)
When accessing ports, you must pass in the the proper 1 or 2 letter
names (S[1-9] or letter A-F on motor ports
Let's look at some code usage!RemoteEV3
EV3Classes
Robotics
The fun stuff! Doing something with all of these classes, sensors and
motors
filters - filters for sample providers such as SumFilter which takes the
sum of samples over time, or MedianFilter
geometry - geometric shape support using float co-ordinates
localization - BeaconPoseProvider, CompassPoseProvider,
MCLPoseProvider, OdometryPostProvider
mapping - adds support for maps- Main class is EV3NavigationModel
which takes Pilot, Navigator, PoseProvider, RangeScanner,
FeatureFinder
EV3Classes
Robotics - continued
navigation - classes for physically navigating the robot around -
DifferentialPilot, SteeringPilot, OmniPilot
object detection - Feature detector, Fusor detector, RangeFeature, and
TouchFeature
pathfinding - most of these use a map to determine a path for the
robot to take (Dijkstra, Random, Shortest, Node)
subsumption - Arbitrator and Behavior(Events)
EV3Classes
Utilities
general utility classes - things like Timers, property mgt, delays,
debugs
EV3Menu
This project keeps the JVM running, provides RMI services, WAP setup, UI
on the front of the EV3 Brick
Samples -> runs in separate jvm maps to /home/root/lejos/samples
(Runs fine with @CompileStatic)
Programs -> runs in separate jvm maps to /home/lejos/programs
(Runs fine with @CompileStatic)
Tools -> runs in same jvm maps to /home/root/lejos/tools (Runs
Groovy fastest w/MOP)
Programming Model
Behavior Programming
Why? Creates less spaghetti code of if-then-else statements
Uses threads to keep multiple things going on to allow different
'behaviors' to react
Interface uses only 3 methods - action, suppress, and takeControl
Uses to main Interfaces - Behavior and Artibrator
Programming Model
Behavior Programming
Programming Model
Behavior Programming - continued
Arbitrator takes over from your 3 behavior classes after they are
complete
Arbitrator regulates when behaviors become active
Enter and escape will stop unless returnwheninactive is set upon
creation
Takes an array of behaviors
Programming Model
Behavior Programming - continued
Simple to use, only method is start() - higher level behaviors suppress
lower ones
The array of behaviors passed in, index order determines priority of
arbitrator to control behaviors
Recommended design pattern - define boolean flag 'suppressed' for
each behavior, set variable to true by supress method, test in each
action method. first thing in action method is to set this to false
Action must be coded for prompt exit from method
Programming Model
Behavior Programming - suppression
Programming Model
Let's show our example EV3BumperCarGroovy!
Advanced - Sensors and Events
Sensors
Educational 'core' kit: Ultrasonic, Color, Gyroscopic, and 2x Touch
Retail kit: Infrared, Color, 1x Touch
Full difference part-by-part between the kits
All measurements are in
LeJOS uses a cartesian coordinate system
here
SI-units
Advanced - Sensors and Events
- Filters
Filters
Filters are used to alter a sample or alter the flow of samples
Filters take a sample from a SampleProvider, modify it and then pass
it on as a sample
They are sample providers themselves
Angles follow the right hand rule: This means that a counter clockwise
rotation of a robot is measured as a positive rotation by the sensors
on it
On sensors that support multiple axes, like some gyroscopes and
accelerometers, the axis order in a sample is always X,Y,Z
Advanced - Sensors and Events
- Filter Sample
//getaportinstance
Portport=LocalEV3.get().getPort("S2");
//GetaninstanceoftheUltrasonicEV3sensor
SensorModessensor=newEV3UltrasonicSensor(port);
//getaninstanceofthissensorinmeasurementmode
SampleProviderdistance=sensor.getModeName("Distance");
//stackafilteronthesensorthatgivestherunningaverageofthelast5samples
SampleProvideraverage=newMeanFilter(distance,5);
//initialiseanarrayoffloatsforfetchingsamples
float[]sample=newfloat[average.sampleSize()];
//fetchasample
average.fetchSample(sample,0);
Advanced - Sensors and Events
- Threads
Filters
Threads are spawned to facilitate:
listeners
regulated motors
bluetooth
timers
navigation classes (Like NavPathController)
On threads that don't need to terminate when program is done use
setDaemon(true)
Advanced - Sensors and Events
- Threads
Threads - example from startup menu
classIndicatorsextendsThread{
privatebooleanio=false;
publicvoidioActive(){
io=true;
}
publicvoidrun(){
String[]ioProgress={". ",". "," ."};
intioIndex=0;
booleanrewrite=false;
while(true){
try{
if(io){
StartUpText.g.drawString(" ",76,0);
ioIndex=(ioIndex+1)%ioProgress.length;
StartUpText.g.drawString(ioProgress[ioIndex],78,0);
io=false;
rewrite=true;
}elseif(rewrite){
LCD.drawString(" ",13,0);
//invertwhenpowerisoff
//startupthecode
Indicatorsind=newIndicators();
ind.setDaemon(true);
ind.start();
Advanced - Sensors and Events
Listeners & Events
The listener thread supports Button Listeners & Sensor Port Listeners
Button listeners are used to detect when a button is pressed,
whatever your program is doing at the time
To listen for a press of a specific button, you register as listener for
that button
publicclassListenForButtons{
publicstaticvoidmain(String[]args)throwsException{
Button.ENTER.addButtonListener(newButtonListener(){
publicvoidbuttonPressed(Buttonb){
LCD.drawString("ENTERpressed",0,0);
}
publicvoidbuttonReleased(Buttonb){
LCD.clear();
}
});
Button.ESCAPE.waitForPressAndRelease();
}
}
WebRover1
Based off WebRover1 Project for NXT for International Space Apps
Challenge 2013
Original version for NXT - had to rewrite a lot of it and switch to RMI for it
to work with EV3
Allows you to simulate a remote rover type of device you could drive
from far away like Mars or across the globe
WebRover1 - EV3
What is all if comprised of?
Special RMIDifferentialPilot Class in the EV3Classes project
Grails Application
IP Camera App on Android or iOS via Wifi(Off the shelf)
Javascript page with keybinding to actually input driving robot
WebRover1 - EV3
RMIDifferentialPilot
RMI Enabled version of DifferentialPilot
Pilot contains methods to control robot movements: travel forward or
backward in a straight line or a circular path or rotate to a new
direction
Will only work with two independently controlled motors to steer
differentially, so it can rotate within its own footprint
Let's go over the code!
WebRover1 - EV3
Grails Application
2 Services, 2 Controllers, 1 GSP page
4 classes handle the robotics, brick abstraction, and remote comms
Camera - using 'IP Webcam' free edition on Android
Configure IP address of Camera and EV3 in Config.groovy before
starting app
Use the grails start/stop command interface to shut down app nicely,
or you will have to keep rebooting the ev3
WebRover1 - EV3
Grails Application - Code Overview
Camera Service - takes pictures and updates page to help you drive
Robot Service - take input from GSP page to send commands to direct
robott
EV3Brick - abstraction class for robot, holds refs to motors
EV3Robot - sets up comms and sensors references
BasicRobot - bring Pilot, motors, and sensors together via RMI
Let's look at the code and set yours up!
More Information
leJOS Wiki: http://sourceforge.net/p/lejos/wiki/Home/
leJOS Forums: http://www.lejos.org/forum/
leJOS SD Card creation repo:
https://sourceforge.net/p/lejos/ev3sdcard/ci/master/tree/
leJOS EV3 Code Repo:
https://sourceforge.net/p/lejos/ev3/ci/master/tree/
Ryan's Fork w/Gradle support:
https://sourceforge.net/u/ryanv78665/lejos/ci/master/tree/
Gitub repo for WebRover1 EV3:
https://github.com/rvanderwerf/webrover1
More Information - Buying
parts
You can buy random parts by the pound off ebay like this:
http://goo.gl/xfkvtP (cheapest!)
Lego Store (Many things often out of stock, poor supply chain?)
Brickowl.com - reseller part search used and new
Bricklink.com: http://www.bricklink.com/
Amazon - specific parts are available there sometimes cheaper but
less selection
THE END
I hope you have enjoyed the session!
Free free to contact me on twitter or google+ @RyanVanderwerf or
email rvanderwerf@gmail.com

Weitere Àhnliche Inhalte

Andere mochten auch

Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016
Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016
Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016Ryan Vanderwerf
 
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0b
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0bIntroduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0b
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0bDonal Cuack
 
Ev3 teachers guia
Ev3 teachers guiaEv3 teachers guia
Ev3 teachers guiaWebMD
 
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)Takehiko YOSHIDA
 
01 introduce to lego ev3 20140917
01 introduce to lego ev3 2014091701 introduce to lego ev3 20140917
01 introduce to lego ev3 20140917Jason Yang
 
Introduction to Lego EV3
Introduction to Lego EV3Introduction to Lego EV3
Introduction to Lego EV3Andrew Nelson
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopStephen Chin
 
Lego Mindstrom EV3
Lego Mindstrom EV3Lego Mindstrom EV3
Lego Mindstrom EV3Ragu Nathan
 

Andere mochten auch (11)

Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016
Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016
Getting Groovy with Lego MindStorms EV3 - GR8Conf US 2016
 
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0b
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0bIntroduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0b
Introduction to-robotics-tablet-es-b08f2764ee6a5a74cbc89a545fa24b0b
 
Robasics
RobasicsRobasics
Robasics
 
Ev3 teachers guia
Ev3 teachers guiaEv3 teachers guia
Ev3 teachers guia
 
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)
Open the door of embedded systems to IoT! mruby on LEGO Mindstorms (R)
 
01 introduce to lego ev3 20140917
01 introduce to lego ev3 2014091701 introduce to lego ev3 20140917
01 introduce to lego ev3 20140917
 
Proyecto Elephant Lego Mindstorm Maestro21
Proyecto Elephant Lego Mindstorm Maestro21Proyecto Elephant Lego Mindstorm Maestro21
Proyecto Elephant Lego Mindstorm Maestro21
 
Introduction to Lego EV3
Introduction to Lego EV3Introduction to Lego EV3
Introduction to Lego EV3
 
Introduction to Robots
Introduction to RobotsIntroduction to Robots
Introduction to Robots
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
 
Lego Mindstrom EV3
Lego Mindstrom EV3Lego Mindstrom EV3
Lego Mindstrom EV3
 

Ähnlich wie All your legos are belong to Us Gr8Conf.EU 2015

JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017Jan Jongboom
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksThomas Fuchs
 
Sybsc cs sem 3 core java
Sybsc cs sem 3 core javaSybsc cs sem 3 core java
Sybsc cs sem 3 core javaWE-IT TUTORIALS
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneDeepu S Nath
 
Development With eRCP
Development With eRCPDevelopment With eRCP
Development With eRCPGorkem Ercan
 
Intelligent Embedded Systems (Robotics)
Intelligent Embedded Systems (Robotics)Intelligent Embedded Systems (Robotics)
Intelligent Embedded Systems (Robotics)Adeyemi Fowe
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016Trayan Iliev
 
UniK - a unikernel compiler and runtime
UniK - a unikernel compiler and runtimeUniK - a unikernel compiler and runtime
UniK - a unikernel compiler and runtimeLee Calcote
 
Dev Environments: The Next Generation
Dev Environments: The Next GenerationDev Environments: The Next Generation
Dev Environments: The Next GenerationTravis Thieman
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCFAKHRUN NISHA
 
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)smancke
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)Netcetera
 
Project SpaceLock - Architecture & Design
Project SpaceLock - Architecture & DesignProject SpaceLock - Architecture & Design
Project SpaceLock - Architecture & DesignAbhishek Mishra
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks ComparisonDeepu S Nath
 
Building Your Robot using AWS Robomaker
Building Your Robot using AWS RobomakerBuilding Your Robot using AWS Robomaker
Building Your Robot using AWS RobomakerAlex Barbosa Coqueiro
 

Ähnlich wie All your legos are belong to Us Gr8Conf.EU 2015 (20)

JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-Frameworks
 
Understanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual MachineUnderstanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual Machine
 
Sybsc cs sem 3 core java
Sybsc cs sem 3 core javaSybsc cs sem 3 core java
Sybsc cs sem 3 core java
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
 
Core Android
Core AndroidCore Android
Core Android
 
Development With eRCP
Development With eRCPDevelopment With eRCP
Development With eRCP
 
Intelligent Embedded Systems (Robotics)
Intelligent Embedded Systems (Robotics)Intelligent Embedded Systems (Robotics)
Intelligent Embedded Systems (Robotics)
 
Final Project
Final ProjectFinal Project
Final Project
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016
 
UniK - a unikernel compiler and runtime
UniK - a unikernel compiler and runtimeUniK - a unikernel compiler and runtime
UniK - a unikernel compiler and runtime
 
Dev Environments: The Next Generation
Dev Environments: The Next GenerationDev Environments: The Next Generation
Dev Environments: The Next Generation
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
 
6202942
62029426202942
6202942
 
Project SpaceLock - Architecture & Design
Project SpaceLock - Architecture & DesignProject SpaceLock - Architecture & Design
Project SpaceLock - Architecture & Design
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Building Your Robot using AWS Robomaker
Building Your Robot using AWS RobomakerBuilding Your Robot using AWS Robomaker
Building Your Robot using AWS Robomaker
 

Mehr von Ryan Vanderwerf

Alexa, Tell Me I'm Groovy - GR8Conf US 2017 Edition
Alexa, Tell Me I'm Groovy - GR8Conf US 2017 EditionAlexa, Tell Me I'm Groovy - GR8Conf US 2017 Edition
Alexa, Tell Me I'm Groovy - GR8Conf US 2017 EditionRyan Vanderwerf
 
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...Ryan Vanderwerf
 
Deploying Scaling and Running Grails on AWS and VPC
Deploying Scaling and Running Grails on AWS and VPCDeploying Scaling and Running Grails on AWS and VPC
Deploying Scaling and Running Grails on AWS and VPCRyan Vanderwerf
 
Getting Groovy with Google Home - GR8Conf EU 2017
Getting Groovy with Google Home  - GR8Conf EU 2017Getting Groovy with Google Home  - GR8Conf EU 2017
Getting Groovy with Google Home - GR8Conf EU 2017Ryan Vanderwerf
 
Alexa Tell Me I'm Groovy Greach 2017
Alexa Tell Me I'm Groovy Greach 2017Alexa Tell Me I'm Groovy Greach 2017
Alexa Tell Me I'm Groovy Greach 2017Ryan Vanderwerf
 
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016Ryan Vanderwerf
 
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPC
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPCSpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPC
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPCRyan Vanderwerf
 
Allyourlegosarebelongtous
AllyourlegosarebelongtousAllyourlegosarebelongtous
AllyourlegosarebelongtousRyan Vanderwerf
 
All Your LegoS Are Belong to Us
All Your LegoS Are Belong to UsAll Your LegoS Are Belong to Us
All Your LegoS Are Belong to UsRyan Vanderwerf
 

Mehr von Ryan Vanderwerf (9)

Alexa, Tell Me I'm Groovy - GR8Conf US 2017 Edition
Alexa, Tell Me I'm Groovy - GR8Conf US 2017 EditionAlexa, Tell Me I'm Groovy - GR8Conf US 2017 Edition
Alexa, Tell Me I'm Groovy - GR8Conf US 2017 Edition
 
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...
Slides from Ryan Vanderwerf and Lee Fox's Getting Groovy With Google Home fro...
 
Deploying Scaling and Running Grails on AWS and VPC
Deploying Scaling and Running Grails on AWS and VPCDeploying Scaling and Running Grails on AWS and VPC
Deploying Scaling and Running Grails on AWS and VPC
 
Getting Groovy with Google Home - GR8Conf EU 2017
Getting Groovy with Google Home  - GR8Conf EU 2017Getting Groovy with Google Home  - GR8Conf EU 2017
Getting Groovy with Google Home - GR8Conf EU 2017
 
Alexa Tell Me I'm Groovy Greach 2017
Alexa Tell Me I'm Groovy Greach 2017Alexa Tell Me I'm Groovy Greach 2017
Alexa Tell Me I'm Groovy Greach 2017
 
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016
Amazon Alexa Workshop - Grpovy and Grails GR8Conf US 2016
 
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPC
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPCSpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPC
SpringOne2GX 2015: Deploying, Scaling, and Rnning Grails on AWS VPC
 
Allyourlegosarebelongtous
AllyourlegosarebelongtousAllyourlegosarebelongtous
Allyourlegosarebelongtous
 
All Your LegoS Are Belong to Us
All Your LegoS Are Belong to UsAll Your LegoS Are Belong to Us
All Your LegoS Are Belong to Us
 

KĂŒrzlich hochgeladen

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂anilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...gurkirankumar98700
 
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...soniya singh
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

KĂŒrzlich hochgeladen (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS LiveVip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
(Genuine) Escort Service Lucknow | Starting â‚č,5K To @25k with A/C đŸ§‘đŸœâ€â€ïžâ€đŸ§‘đŸ» 89...
 
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi âžĄïž 8264348440 💋📞 Independent Escort S...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

All your legos are belong to Us Gr8Conf.EU 2015

  • 1. Learn how to get your Groovy on with Lego Mindstorms! Created by /Ryan Vanderwerf @RyanVanderwerf - ReachForce 0
  • 3. About Me Chief Architect/Director @ ReachForce - we make B2 marketing data better www.reachforce.com Father of 2 girls under 10 Co-Chair Austin Groovy and Grails User Group Co-Author of Effective Gradle Implementation Video Series on Packt I like to modify all the things (cars, home automation, phones, gadgets) Into lots of Devops/Linux stuff and AWS
  • 4. What we will cover What is the EV3? What is leJOS? Layout and components of leJOS Programming Model How build components of leJOS with Gradle Overview of leJOS APIs Build and deploy a demo leJOS Groovy App More advanced topics - Sensors and Events WebRover 1 - Build, Run, and Play!
  • 5. What is EV3? EV3 is the latest generation LEGO Mindstorm Platform TI ARM9 Core CPU (Runs ARMv5 instruction set) 64MB RAM 16gb internal flash microSD slot bluetooth wireless usb port New generation of 'smarter sensors' (single sensors replace many nxt ones) One big difference vs Raspberry Pi is it is a ARM11 with ARMv7 instruction set with hardfp(w/jdk!) Latest leJOS includes Raspberry PI support called 'Brick Pi'
  • 6. What is leJOS? leJOS is a Java-based implementation that started on the Lego Mindstorms RCX platform that runs on arm based processors. leJOS was forked oringally from the 'TinyVM' project in 2000. Available in 3 flavors: RCX, NXJ, and EV3 that are all still maintained
  • 7. What is LeJOS? Replacement firmware for building Lego Robots in Java PC Tools for flashing Lego Brick PC Apps to communicate to your robot from your PC via bluetooth, Wifi, USB Creates a running jar package to deploy on your robot for execution
  • 8. Why no Groovy before now? Groovy was too slow before @CompileStatic (Soft FP) More limited audience Many Java people still not educated on Groovy(but this has grown!) leJOS didn't provide an easy way to run Groovy(core commiters indifferent to Groovy)
  • 9. Layouts and components of leJOS OS Image - boot/busybox DBusJava - JNI classes for hardware EV3 Classes - Abstraction Java Classes EV3 Menu - long running process launches apps, remote connections Other components
  • 10. OS Image Runs minimal OS and kernel - only subset of basic shell options and commands available(busybox) shell is 'ash' nowhere near feature comparable to bash ps command only has 1 parameter 'w' for wide leJOS interacts with it by starting up a java app called 'EV3Menu' There isn't really enough RAM to run more than 1 VM besides what leJOS uses (hello oom killer!)
  • 11. DBusJava JNI Layer that interacts with physical hardware This is the glue to makes JVM classes work Generally you don't need to do anything with it unless you are adding unsupported hardware see the README file under DBusJava/src for how to add modules (outside scope of us here) Feel free to use the artifact on my Bintray account, compile your own with the scripts, or use your own artifact server
  • 12. EV3Classes Supporting Java classes for leJOS This is all the Java implementation classes for the system This is a monolithic code base/lib at this point all projects depend on this to work I've created some custom classes inside here to allow the Webrover to work (later) Divided into 4 sections - Hardware, Internal, Robotics and Utility Hardware - Java representation of the lego hardware items
  • 13. EV3Classes Hardware Support for Tetrix metal robots Supports motors from EV3, NXT, RCX, Mindsensors Glidewheel-M, regulated and unregulated Supports GPS with this device Ports - these are there the low level devices sensors are connected to (Mostly I2C/UART) Sensors - supports over 40 different kinds of sensors from Lego, Dextor, HiTechnic and Mindsensors LocalEV3 is the singleton class to get access to things (show example in code) Basic hardware objects on EV3 brick itself are in lejos.hardware base pkg (Audio, LCD, buttons and keys) http://www.dexterindustries.com/dGPS.html
  • 14. EV3Classes Internal Handles bluetooth pairing with DBusJava Internal EV3 implementation classes not part of public API Low level linux hardware access classes (NIO) If you use the classes they are subject to change without and kind of deprecation or notice
  • 15. EV3Classes Remote Mainly uses RMI RemoteEV3 is main classes to access remotely (give it IP address) Accessing hardware remotely pretty much as a 1:1 relation with 'Remote' in front of classs Wifi support most stable Bluetooth is working, but not considered as stable as Wifi (instructions differ per platform) When accessing ports, you must pass in the the proper 1 or 2 letter names (S[1-9] or letter A-F on motor ports Let's look at some code usage!RemoteEV3
  • 16. EV3Classes Robotics The fun stuff! Doing something with all of these classes, sensors and motors filters - filters for sample providers such as SumFilter which takes the sum of samples over time, or MedianFilter geometry - geometric shape support using float co-ordinates localization - BeaconPoseProvider, CompassPoseProvider, MCLPoseProvider, OdometryPostProvider mapping - adds support for maps- Main class is EV3NavigationModel which takes Pilot, Navigator, PoseProvider, RangeScanner, FeatureFinder
  • 17. EV3Classes Robotics - continued navigation - classes for physically navigating the robot around - DifferentialPilot, SteeringPilot, OmniPilot object detection - Feature detector, Fusor detector, RangeFeature, and TouchFeature pathfinding - most of these use a map to determine a path for the robot to take (Dijkstra, Random, Shortest, Node) subsumption - Arbitrator and Behavior(Events)
  • 18. EV3Classes Utilities general utility classes - things like Timers, property mgt, delays, debugs
  • 19. EV3Menu This project keeps the JVM running, provides RMI services, WAP setup, UI on the front of the EV3 Brick Samples -> runs in separate jvm maps to /home/root/lejos/samples (Runs fine with @CompileStatic) Programs -> runs in separate jvm maps to /home/lejos/programs (Runs fine with @CompileStatic) Tools -> runs in same jvm maps to /home/root/lejos/tools (Runs Groovy fastest w/MOP)
  • 20. Programming Model Behavior Programming Why? Creates less spaghetti code of if-then-else statements Uses threads to keep multiple things going on to allow different 'behaviors' to react Interface uses only 3 methods - action, suppress, and takeControl Uses to main Interfaces - Behavior and Artibrator
  • 22. Programming Model Behavior Programming - continued Arbitrator takes over from your 3 behavior classes after they are complete Arbitrator regulates when behaviors become active Enter and escape will stop unless returnwheninactive is set upon creation Takes an array of behaviors
  • 23. Programming Model Behavior Programming - continued Simple to use, only method is start() - higher level behaviors suppress lower ones The array of behaviors passed in, index order determines priority of arbitrator to control behaviors Recommended design pattern - define boolean flag 'suppressed' for each behavior, set variable to true by supress method, test in each action method. first thing in action method is to set this to false Action must be coded for prompt exit from method
  • 25. Programming Model Let's show our example EV3BumperCarGroovy!
  • 26. Advanced - Sensors and Events Sensors Educational 'core' kit: Ultrasonic, Color, Gyroscopic, and 2x Touch Retail kit: Infrared, Color, 1x Touch Full difference part-by-part between the kits All measurements are in LeJOS uses a cartesian coordinate system here SI-units
  • 27. Advanced - Sensors and Events - Filters Filters Filters are used to alter a sample or alter the flow of samples Filters take a sample from a SampleProvider, modify it and then pass it on as a sample They are sample providers themselves Angles follow the right hand rule: This means that a counter clockwise rotation of a robot is measured as a positive rotation by the sensors on it On sensors that support multiple axes, like some gyroscopes and accelerometers, the axis order in a sample is always X,Y,Z
  • 28. Advanced - Sensors and Events - Filter Sample //getaportinstance Portport=LocalEV3.get().getPort("S2"); //GetaninstanceoftheUltrasonicEV3sensor SensorModessensor=newEV3UltrasonicSensor(port); //getaninstanceofthissensorinmeasurementmode SampleProviderdistance=sensor.getModeName("Distance"); //stackafilteronthesensorthatgivestherunningaverageofthelast5samples SampleProvideraverage=newMeanFilter(distance,5); //initialiseanarrayoffloatsforfetchingsamples float[]sample=newfloat[average.sampleSize()]; //fetchasample average.fetchSample(sample,0);
  • 29. Advanced - Sensors and Events - Threads Filters Threads are spawned to facilitate: listeners regulated motors bluetooth timers navigation classes (Like NavPathController) On threads that don't need to terminate when program is done use setDaemon(true)
  • 30. Advanced - Sensors and Events - Threads Threads - example from startup menu classIndicatorsextendsThread{ privatebooleanio=false; publicvoidioActive(){ io=true; } publicvoidrun(){ String[]ioProgress={". ",". "," ."}; intioIndex=0; booleanrewrite=false; while(true){ try{ if(io){ StartUpText.g.drawString(" ",76,0); ioIndex=(ioIndex+1)%ioProgress.length; StartUpText.g.drawString(ioProgress[ioIndex],78,0); io=false; rewrite=true; }elseif(rewrite){ LCD.drawString(" ",13,0); //invertwhenpowerisoff //startupthecode Indicatorsind=newIndicators(); ind.setDaemon(true); ind.start();
  • 31. Advanced - Sensors and Events Listeners & Events The listener thread supports Button Listeners & Sensor Port Listeners Button listeners are used to detect when a button is pressed, whatever your program is doing at the time To listen for a press of a specific button, you register as listener for that button publicclassListenForButtons{ publicstaticvoidmain(String[]args)throwsException{ Button.ENTER.addButtonListener(newButtonListener(){ publicvoidbuttonPressed(Buttonb){ LCD.drawString("ENTERpressed",0,0); } publicvoidbuttonReleased(Buttonb){ LCD.clear(); } }); Button.ESCAPE.waitForPressAndRelease(); } }
  • 32. WebRover1 Based off WebRover1 Project for NXT for International Space Apps Challenge 2013 Original version for NXT - had to rewrite a lot of it and switch to RMI for it to work with EV3 Allows you to simulate a remote rover type of device you could drive from far away like Mars or across the globe
  • 33. WebRover1 - EV3 What is all if comprised of? Special RMIDifferentialPilot Class in the EV3Classes project Grails Application IP Camera App on Android or iOS via Wifi(Off the shelf) Javascript page with keybinding to actually input driving robot
  • 34. WebRover1 - EV3 RMIDifferentialPilot RMI Enabled version of DifferentialPilot Pilot contains methods to control robot movements: travel forward or backward in a straight line or a circular path or rotate to a new direction Will only work with two independently controlled motors to steer differentially, so it can rotate within its own footprint Let's go over the code!
  • 35. WebRover1 - EV3 Grails Application 2 Services, 2 Controllers, 1 GSP page 4 classes handle the robotics, brick abstraction, and remote comms Camera - using 'IP Webcam' free edition on Android Configure IP address of Camera and EV3 in Config.groovy before starting app Use the grails start/stop command interface to shut down app nicely, or you will have to keep rebooting the ev3
  • 36. WebRover1 - EV3 Grails Application - Code Overview Camera Service - takes pictures and updates page to help you drive Robot Service - take input from GSP page to send commands to direct robott EV3Brick - abstraction class for robot, holds refs to motors EV3Robot - sets up comms and sensors references BasicRobot - bring Pilot, motors, and sensors together via RMI Let's look at the code and set yours up!
  • 37. More Information leJOS Wiki: http://sourceforge.net/p/lejos/wiki/Home/ leJOS Forums: http://www.lejos.org/forum/ leJOS SD Card creation repo: https://sourceforge.net/p/lejos/ev3sdcard/ci/master/tree/ leJOS EV3 Code Repo: https://sourceforge.net/p/lejos/ev3/ci/master/tree/ Ryan's Fork w/Gradle support: https://sourceforge.net/u/ryanv78665/lejos/ci/master/tree/ Gitub repo for WebRover1 EV3: https://github.com/rvanderwerf/webrover1
  • 38. More Information - Buying parts You can buy random parts by the pound off ebay like this: http://goo.gl/xfkvtP (cheapest!) Lego Store (Many things often out of stock, poor supply chain?) Brickowl.com - reseller part search used and new Bricklink.com: http://www.bricklink.com/ Amazon - specific parts are available there sometimes cheaper but less selection
  • 39. THE END I hope you have enjoyed the session! Free free to contact me on twitter or google+ @RyanVanderwerf or email rvanderwerf@gmail.com