SlideShare a Scribd company logo
http://robo4j.io
Robo4J
@robo4j
Robotics on Java Simplified
Robo4J
Marcus Hirt, Oracle
Miroslav Wengner, MAN Truck & Bus AG
http://robo4j.io
Robo4J
@robo4j
Robo4J
• Easy to use framework for quickly getting started writing Java
for hardware
• Pure Java framework
• Uses Pi4J for GPIO access
• Core components independently usable
http://robo4j.io
Robo4J
@robo4j
robo4j-hw-pi
Robo4J Overview
robo4j-math
robo4j-core
robo4j-hw-lego
My Robot
robo4j-units-pi
robo4j-units-lego
robo4j-http
http://robo4j.io
Robo4J
@robo4j
Robo4J Hardware Modules
• Simple to use Java abstractions for hardware
• Can be used stand alone, does not depend on anything
robo4j-hw-*
http://robo4j.io
Robo4J
@robo4j
Hardware Example
public class HelloLcd {
public static void main(String[] args) throws Exception {
AdafruitLcd lcd = LcdFactory.createLCD();
lcd.setBacklight(Color.TEAL);
lcd.setText("Hello World!n-----Robo4J-----");
}
}
Adafruit LCD
http://robo4j.io
Robo4J
@robo4j
Robo4J Core
• Defines the core abstractions
• A RoboBuilder builds the RoboContext which is basically a ”robot”
• A RoboContext contains RoboReferences to RoboUnits, which are agents to
which messages can be sent
• Annotations on RoboUnits can change on which queue messages are sent
• Provides network services (autodiscovery, remote messaging)
• Is plain old Java
robo4j-core
http://robo4j.io
Robo4J
@robo4j
Robo4J Hardware Specific Units
• Pre-packaged, configurable units
• Easy to use
• Typically configured using XML (or programmatically)
robo4j-units-*
http://robo4j.io
Robo4J
@robo4j
Robo4J Threading
http://robo4j.io
Robo4J
@robo4j
Robo4J Threading
2
2
10
http://robo4j.io
Robo4J
@robo4j
Typical Project
1. Add the units for your hardware to your configuration
2. Add your own units for controlling behaviour
3. Add a class with a main method where you initialize it all
through a RoboBuilder
4. Run the main method
http://robo4j.io
Robo4J
@robo4j
Example
public class LcdExampleDeclarativeMain {
public static void main(String[] args) throws RoboBuilderException, IOException {
RoboBuilder builder = new RoboBuilder().add(getResource("robo4j.xml"));
RoboContext ctx = builder.build();
ctx.start();
ctx.getReference("lcd").sendMessage(
new LcdMessage("Robo4J: Welcome!nPress Up/Down!"));
System.out.println("Press enter to quit!");
System.in.read();
ctx.shutdown();
}
…
}
http://robo4j.io
Robo4J
@robo4j
robo4j.xml
<robo4j>
<roboUnit id="lcd">
<class>com.robo4j.units.rpi.lcd.AdafruitLcdUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x20</value>
</config>
</roboUnit>
<roboUnit id="buttons">
<class>com.robo4j.units.rpi.lcd.AdafruitButtonUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int”>0x20</value>
<value name="target" type="String">controller</value>
</config>
</roboUnit>
<roboUnit id="controller">
<class>com.robo4j.rpi.lcd.example.controller.LcdExampleController</class>
<config name="com.robo4j.root">
<value name="target" type="String">lcd</value>
</config>
</roboUnit>
</robo4j>
http://robo4j.io
Robo4J
@robo4j
Controller
@CriticalSectionTrait
public class LcdExampleController extends RoboUnit<AdafruitButtonEnum> {
…
public void onMessage(AdafruitButtonEnum message) {
if (!isDemoRunning()) {
processAdafruitMessage(message);
} else {
SimpleLoggingUtil.print(getClass(), "Skipping " + message + " due to test already running!");
}
}
public void onInitialization(Configuration configuration) throws ConfigurationException {
target = configuration.getString("target", null);
if (target == null) {
throw ConfigurationException.createMissingConfigNameException("target");
}
}
…
http://robo4j.io
Robo4J
@robo4j
Controller, continued
…
private void processAdafruitMessage(AdafruitButtonEnum myMessage) {
switch (myMessage) {
case DOWN:
moveToNextDemo();
break;
case UP:
moveToPreviousDemo();
break;
case SELECT:
runDemo();
break;
default:
sendLcdMessage(getContext(), String.format("Button %snis not in use...", myMessage));
}
}
}
http://robo4j.io
Robo4J
@robo4j
Adafruit LCD Demo
http://robo4j.io
Robo4J
@robo4j
Example – Robotic Arm
http://robo4j.io
Robo4J
@robo4j
Robotic Arm Demo
http://robo4j.io
Robo4J
@robo4j
Robo4J Networking
• Autodiscovery / Heartbeats / Native package format
• Messaging / Remote Contexts
http://robo4j.io
Robo4J
@robo4j
Autodiscovery Enablement
<robo4j>
<roboSystem>
<config name="com.robo4j.root">
<value name="poolSizeScheduler" type="int">2</value>
…
<config name="com.robo4j.messageServer">
<value name="port" type="int">0</value>
</config>
<config name="com.robo4j.discovery">
<value name="multicastAddress" type="String">238.12.15.254</value>
<value name="port" type="int">0x0FFE</value>
<value name="heartBeatInterval" type="int">250</value>
<value name="enabled" type="boolean">true</value>
<config name="com.robo4j.discovery.metadata">
<value name="name" type="String">Button Activator</value>
<value name="description" type="String">Little remote controlled button</value>
</config>
</config>
</config>
</roboSystem>
</robo4j>
http://robo4j.io
Robo4J
@robo4j
Remote Messaging
String id = "myid";
LookupService lookupService =
LookupServiceProvider.getDefaultLookupService();
RoboContext context = lookupService.getContext(id);
RoboReference<String> reference = context.getReference(id);
reference.sendMessage("Hello!");
http://robo4j.io
Robo4J
@robo4j
Lookup by Metadata
Stream<RoboContextDescriptor> matchingDescriptors =
lookupService.getDiscoveredContexts().values().stream().
filter((ctx) -> isRoboticOverlord(ctx));
…
private static boolean isRoboticOverlord(RoboContextDescriptor context) {
return context.getMetadata().containsKey("isRoboticOverlord");
}
http://robo4j.io
Robo4J
@robo4j
Button Presser Demo
with Autodiscovery
http://robo4j.io
Robo4J
@robo4j
Robo4J Http Communication
• Want to communicate messages to the units over http
• Simply add HttpServerUnit or HttpClientUnit
• Communication is implemented using Java NIO
• Messages by default sent as Json
• Translate from/to Json and the message type accepted by the unit
• Define your codecs: @HttpProducer, @HttpDecoder, @HttpEncoder
http://robo4j.io
Robo4J
@robo4j
Robo4J REST
• Default get operation is listing all registered units with their states
• Default post operation for a unit is to send a message to it
• There must be a registered http codec for converting from Json to
the message type for the message to be received
HTTP GET: http://<ROBO4J_IP>:<ROBO4J_PORT>
HTTP POST: http://<ROBO4J_IP>:<ROBO4J_PORT>/units/<unit id>
http://robo4j.io
Robo4J
@robo4j
Robo4J Example Get
HTTP GET : http://127.0.0.1:8025
uid: 142d7167-7a43-477e-8dfd-75fdd711b6da,
response: [
{
id:"controller",
com.robo4j.LifecycleState:"STARTED“
},
{
id:"httpServer",
com.robo4j.LifecycleState:"STOPPED"
},
...
]
http://robo4j.io
Robo4J
@robo4j
Robo4J Example Post
Example: http://localhost:8025/units/controller
BODY:
{“message”: “push“}
Returns HTTP code 202, if message was deserialized properly and
put on the bus. Returns 404 if unit is not found. Returns 501 if, for
example, no codec is present for the type required by the unit.
http://robo4j.io
Robo4J
@robo4j
Video Streaming Demo Configuration
<robo4j>
<roboUnit id="httpClient">
<class>com.robo4j.socket.http.units.HttpClientUnit</class>
<config name="com.robo4j.root">
<value name="address" type="String">SERVER_IP</value>
<value name="port" type="int">SERVER_PORT</value>
<value name="mode" type="boolean">true</value>
<value name="targetUnits" type="String">{"imageController":"POST"}</value>
</config>
</roboUnit>
<roboUnit id="imageController">
<class>com.robo4j.units.rpi.camera.RaspistillUnit</class>
<config name="com.robo4j.root">
<value name="targetOut" type="String">httpClient</value>
<value name="client" type="String">SERVER_IP</value>
<value name="clientPort" type="String">SERVER_PORT</value>
<value name="clientUri" type="String”>/<SERVER_ENDPOINT></value>
<value name="width" type="String">320</value>
<value name="height" type="String">240</value>
<value name="timelapse" type="String">100</value>
</config>
</roboUnit>
</robo4j>
• Two Robo4J Systems
• Robo4J on JavaFx
http://robo4j.io
Robo4J
@robo4j
Video and Image Streaming Demo
with Autodiscovery
http://robo4j.io
Robo4J
@robo4j
Robo4J and Lego
Robo4J supports LejOS 9.x on Java 8 and above
Hardware abstractions in robo4j-hw-lego
Units in robo4j-units-lego
Robo4J allows you to mix Lego functionality with other hardware
Turn On the robot named “Number42”
http://robo4j.io
Robo4J
@robo4j
Lego Robot Number42 is alive
<robo4j>
<roboUnit id="http">
<class>com.robo4j.socket.http.units.HttpServerUnit</class>
<config name="com.robo4j.root">
<value name="port" type="int">8025</value>
<value name="target" type="String">controller</value>
<value name="packages" type="String">com.robo4j.lego.j1kids.example.codec</value>
<value name="targetUnits" type="String">{"controller":"GET"}</value>
</config>
</roboUnit>
<roboUnit id="buttons">
<class>com.robo4j.units.lego.BrickButtonsUnit</class>
<config name="com.robo4j.root">
<value name="target" type="String">controller</value>
<value name="button_right" type="String">left</value>
<value name="button_left" type="String">right</value>
<value name="button_up" type="String">down</value>
<value name="button_down" type="String">up</value>
<value name="button_enter" type="String">enter</value>
</config>
</roboUnit>
<roboUnit id="lcd">
<class>com.robo4j.units.lego.LcdUnit</class>
<config name="com.robo4j.root">
</config>
</roboUnit>
<roboUnit id="controller">
<class>com.robo4j.lego.j1kids.example.controller.PlatformController</class>
<config name="com.robo4j.root">
<value name="target" type="String">platform</value>
</config>
</roboUnit>
<roboUnit id="weaponController">
<class>com.robo4j.lego.j1kids.example.controller.WeaponController</class>
<config name="com.robo4j.root">
<value name="target" type="String">weapon</value>
</config>
</roboUnit>
<roboUnit id="touchUnit">
<class>com.robo4j.units.lego.TouchUnit</class>
<config name="com.robo4j.root">
<value name="target" type="String">weaponController</value>
</config>
</roboUnit>
<roboUnit id="weapon">
<class>com.robo4j.units.lego.SingleMotorUnit</class>
<config name="com.robo4j.root">
</config>
</roboUnit>
<roboUnit id="platform">
<class>com.robo4j.units.lego.SimpleTankUnit</class>
<config name="com.robo4j.root">
<value name="leftMotorPort" type="String">B</value>
<value name="leftMotorType" type="Character">N</value>
<value name="rightMotorPort" type="String">C</value>
<value name="rightMotorType" type="Character">N</value>
</config>
</roboUnit>
</robo4j>
http://robo4j.io
Robo4J
@robo4j
Lego Demo
http://robo4j.io
Robo4J
@robo4j
Coff-E
• Robotic platform (Wall-E on Java)
• 3D printed + Makeblock + Pololu + Adafruit hardware
http://robo4j.io
Robo4J
@robo4j
http://robo4j.io
Robo4J
@robo4j
Coff-E at JavaOne 2016
The embedded video on this page was removed due to presentation size restrictions.
We’ve uploaded the embedded video on youtube here:
https://www.youtube.com/watch?v=cNLlPGiBzqg
http://robo4j.io
Robo4J
@robo4j
Configuration
<robo4j>
<roboUnit id="lcd">
<class>com.robo4j.units.rpi.lcd.AdafruitLcdUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x20</value>
</config>
</roboUnit>
<roboUnit id="buttons">
<class>com.robo4j.units.rpi.lcd.AdafruitButtonUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x20</value>
<value name="target" type="String">controller</value>
</config>
</roboUnit>
<robo4j>
<roboUnit id="motion">
<class>com.robo4j.units.rpi.roboclaw.RoboClawRCTankUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x40</value>
<value name="leftChannel" type="int">6</value>
<value name="rightChannel" type="int">7</value>
</config>
</roboUnit>
</robo4j>
<roboUnit id="laserscanner.servo">
<class>com.robo4j.units.rpi.pwm.PCA9685ServoUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x40</value>
<value name="channel" type="int">0</value>
<value name="trim" type="float">7</value>
<value name="shutdownValue" type="float">0</value>
</config>
</roboUnit>
<roboUnit id="laserscanner.tilt">
<class>com.robo4j.units.rpi.pwm.PCA9685ServoUnit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x40</value>
<value name="channel" type="int">1</value>
<value name="trim" type="float">-40</value>
<value name="inverted" type="boolean">true</value>
<value name="shutdownValue" type="float">0</value>
</config>
</roboUnit>
<roboUnit id="scanner">
<class>com.robo4j.units.rpi.lidarlite.LaserScanner</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x62</value>
<value name="servo" type="String">laserscanner.servo</value>
<value name="servoRange" type="float">45.0</value>
<value name="angularSpeed" type="float">100.0</value>
<value name="minAquisitionTime" type="float">2.5</value>
<value name="trim" type="float">5.5</value>
</config>
</roboUnit>
<roboUnit id="gyro">
<class>com.robo4j.units.rpi.gyro.GyroL3GD20Unit</class>
<config name="com.robo4j.root">
<value name="bus" type="int">1</value>
<value name="address" type="int">0x6b</value>
<value name="sensitivity" type="String">DPS_245</value>
<value name="enableHighPass" type="boolean">true</value>
<value name="period" type="int">10</value>
</config>
</roboUnit>
<roboUnit id="tank">
<class>com.robo4j.coffe.controllers.TankController</class>
<config name="com.robo4j.root">
<value name="useTracks" type="boolean">false</value>
<value name="maxSpeed" type="float">0.4</value>
</config>
</roboUnit>
<roboUnit id="scanprocessor">
<class>com.robo4j.coffe.units.ScanProcessor</class>
</roboUnit>
<roboUnit id="missioncontroller">
<class>com.robo4j.coffe.controllers.MissionController</class>
<config name="com.robo4j.root">
<value name="lcd" type="String">lcd</value>
<value name="tank" type="String">tank</value>
<value name="scanner" type="String">scanner</value>
<value name="scanProcessor" type="String">scanprocessor</value>
<value name="modeOfOperation" type="String">fastest_path</value>
</config>
</roboUnit>
.
. (GPS, magnetometer etc.)
.
</robo4j>
http://robo4j.io
Robo4J
@robo4j
Build Your Own Coff-E
• See Thingiverse for more information:
https://www.thingiverse.com/thing:1730244
• See the robo4j-coffe repo for code
http://robo4j.io
Robo4J
@robo4j
Tools Demo
JDK Mission Control Plug-in (JFR, LIDAR Scan Visualization)
Magnetometer Calibration Utility (MagViz)
http://robo4j.io
Robo4J
@robo4j
Summary
• Robots are fun
• Java and Robo4J lets you build them quickly
• We have just started
(had a bit of a break the past year getting/tending to
babies/toddlers)…
• …but hopefully this helps someone
• Please give us feedback!
Also build a robot. You will not regret it! :)
http://robo4j.io
Robo4J
@robo4j
For More Info
Robo4J Homepage: http://www.robo4j.io
Robo4J on Twitter: @robo4j
Marcus on Twitter: @hirt
Miro on Twitter: @miragemiko

More Related Content

What's hot

JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011Charles Nutter
 
Making Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVMMaking Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVM
Rafael Winterhalter
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracerrahulrevo
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
Charles Nutter
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
Christopher Frohoff
 
Burp Plugin Development for Java n00bs - 44CON 2012
Burp Plugin Development for Java n00bs - 44CON 2012Burp Plugin Development for Java n00bs - 44CON 2012
Burp Plugin Development for Java n00bs - 44CON 2012
44CON
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
Sylvain Wallez
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
jeresig
 
An introduction to JVM performance
An introduction to JVM performanceAn introduction to JVM performance
An introduction to JVM performance
Rafael Winterhalter
 
OCCI Specification Walkthrough
OCCI Specification WalkthroughOCCI Specification Walkthrough
OCCI Specification Walkthrough
befreax
 
Job Managment Portlet
Job Managment PortletJob Managment Portlet
Job Managment Portlet
riround
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
Matt Butcher
 
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Anton Arhipov
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
JiandSon
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
Rafael Winterhalter
 
Live Updating Swift Code
Live Updating Swift CodeLive Updating Swift Code
Live Updating Swift Code
Bartosz Polaczyk
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
Salesforce Engineering
 
Cloud Plugfest OCCI, pyssf and OpenStack
Cloud Plugfest OCCI, pyssf and OpenStackCloud Plugfest OCCI, pyssf and OpenStack
Cloud Plugfest OCCI, pyssf and OpenStackAndy Edmonds
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 

What's hot (20)

JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
 
Making Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVMMaking Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVM
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracer
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
 
Burp Plugin Development for Java n00bs - 44CON 2012
Burp Plugin Development for Java n00bs - 44CON 2012Burp Plugin Development for Java n00bs - 44CON 2012
Burp Plugin Development for Java n00bs - 44CON 2012
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
 
An introduction to JVM performance
An introduction to JVM performanceAn introduction to JVM performance
An introduction to JVM performance
 
OCCI Specification Walkthrough
OCCI Specification WalkthroughOCCI Specification Walkthrough
OCCI Specification Walkthrough
 
Dart Workshop
Dart WorkshopDart Workshop
Dart Workshop
 
Job Managment Portlet
Job Managment PortletJob Managment Portlet
Job Managment Portlet
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
 
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
 
Live Updating Swift Code
Live Updating Swift CodeLive Updating Swift Code
Live Updating Swift Code
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
 
Cloud Plugfest OCCI, pyssf and OpenStack
Cloud Plugfest OCCI, pyssf and OpenStackCloud Plugfest OCCI, pyssf and OpenStack
Cloud Plugfest OCCI, pyssf and OpenStack
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 

Similar to Robotics on Java Simplified

From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J
Miro Wengner
 
5.node js
5.node js5.node js
5.node js
Geunhyung Kim
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
Gonzalo Ayuso
 
{{more}} Kibana4
{{more}} Kibana4{{more}} Kibana4
{{more}} Kibana4
琛琳 饶
 
A slightly advanced introduction to node.js
A slightly advanced introduction to node.jsA slightly advanced introduction to node.js
A slightly advanced introduction to node.js
Sudar Muthu
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
sickill
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
Yiguang Hu
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Anna Klepacka
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails example
Railwaymen
 
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilitiesVorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilitiesDefconRussia
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6Nobuo Danjou
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
Chun-Yu Wang
 
SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup Group
Ernest Jumbe
 
Windows Server 2008 for Developers - Part 2
Windows Server 2008 for Developers - Part 2Windows Server 2008 for Developers - Part 2
Windows Server 2008 for Developers - Part 2
ukdpe
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
ciklum_ods
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
Michel Schildmeijer
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
Antony Abramchenko
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
DonSchado
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
Alexandre Morgaut
 

Similar to Robotics on Java Simplified (20)

From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J
 
5.node js
5.node js5.node js
5.node js
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
{{more}} Kibana4
{{more}} Kibana4{{more}} Kibana4
{{more}} Kibana4
 
A slightly advanced introduction to node.js
A slightly advanced introduction to node.jsA slightly advanced introduction to node.js
A slightly advanced introduction to node.js
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails example
 
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilitiesVorontsov, golovko   ssrf attacks and sockets. smorgasbord of vulnerabilities
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup Group
 
Windows Server 2008 for Developers - Part 2
Windows Server 2008 for Developers - Part 2Windows Server 2008 for Developers - Part 2
Windows Server 2008 for Developers - Part 2
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 

More from Marcus Hirt

Getting Started with JDK Mission Control
Getting Started with JDK Mission ControlGetting Started with JDK Mission Control
Getting Started with JDK Mission Control
Marcus Hirt
 
Diagnose Your Microservices
Diagnose Your MicroservicesDiagnose Your Microservices
Diagnose Your Microservices
Marcus Hirt
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVM
Marcus Hirt
 
Contributing to JDK Mission Control
Contributing to JDK Mission ControlContributing to JDK Mission Control
Contributing to JDK Mission Control
Marcus Hirt
 
Using Java Flight Recorder
Using Java Flight RecorderUsing Java Flight Recorder
Using Java Flight Recorder
Marcus Hirt
 
Java Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep DiveJava Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep Dive
Marcus Hirt
 
Production Time Profiling Out of the Box
Production Time Profiling Out of the BoxProduction Time Profiling Out of the Box
Production Time Profiling Out of the Box
Marcus Hirt
 

More from Marcus Hirt (7)

Getting Started with JDK Mission Control
Getting Started with JDK Mission ControlGetting Started with JDK Mission Control
Getting Started with JDK Mission Control
 
Diagnose Your Microservices
Diagnose Your MicroservicesDiagnose Your Microservices
Diagnose Your Microservices
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVM
 
Contributing to JDK Mission Control
Contributing to JDK Mission ControlContributing to JDK Mission Control
Contributing to JDK Mission Control
 
Using Java Flight Recorder
Using Java Flight RecorderUsing Java Flight Recorder
Using Java Flight Recorder
 
Java Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep DiveJava Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep Dive
 
Production Time Profiling Out of the Box
Production Time Profiling Out of the BoxProduction Time Profiling Out of the Box
Production Time Profiling Out of the Box
 

Recently uploaded

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 

Recently uploaded (20)

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 

Robotics on Java Simplified

  • 1. http://robo4j.io Robo4J @robo4j Robotics on Java Simplified Robo4J Marcus Hirt, Oracle Miroslav Wengner, MAN Truck & Bus AG
  • 2. http://robo4j.io Robo4J @robo4j Robo4J • Easy to use framework for quickly getting started writing Java for hardware • Pure Java framework • Uses Pi4J for GPIO access • Core components independently usable
  • 4. http://robo4j.io Robo4J @robo4j Robo4J Hardware Modules • Simple to use Java abstractions for hardware • Can be used stand alone, does not depend on anything robo4j-hw-*
  • 5. http://robo4j.io Robo4J @robo4j Hardware Example public class HelloLcd { public static void main(String[] args) throws Exception { AdafruitLcd lcd = LcdFactory.createLCD(); lcd.setBacklight(Color.TEAL); lcd.setText("Hello World!n-----Robo4J-----"); } } Adafruit LCD
  • 6. http://robo4j.io Robo4J @robo4j Robo4J Core • Defines the core abstractions • A RoboBuilder builds the RoboContext which is basically a ”robot” • A RoboContext contains RoboReferences to RoboUnits, which are agents to which messages can be sent • Annotations on RoboUnits can change on which queue messages are sent • Provides network services (autodiscovery, remote messaging) • Is plain old Java robo4j-core
  • 7. http://robo4j.io Robo4J @robo4j Robo4J Hardware Specific Units • Pre-packaged, configurable units • Easy to use • Typically configured using XML (or programmatically) robo4j-units-*
  • 10. http://robo4j.io Robo4J @robo4j Typical Project 1. Add the units for your hardware to your configuration 2. Add your own units for controlling behaviour 3. Add a class with a main method where you initialize it all through a RoboBuilder 4. Run the main method
  • 11. http://robo4j.io Robo4J @robo4j Example public class LcdExampleDeclarativeMain { public static void main(String[] args) throws RoboBuilderException, IOException { RoboBuilder builder = new RoboBuilder().add(getResource("robo4j.xml")); RoboContext ctx = builder.build(); ctx.start(); ctx.getReference("lcd").sendMessage( new LcdMessage("Robo4J: Welcome!nPress Up/Down!")); System.out.println("Press enter to quit!"); System.in.read(); ctx.shutdown(); } … }
  • 12. http://robo4j.io Robo4J @robo4j robo4j.xml <robo4j> <roboUnit id="lcd"> <class>com.robo4j.units.rpi.lcd.AdafruitLcdUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x20</value> </config> </roboUnit> <roboUnit id="buttons"> <class>com.robo4j.units.rpi.lcd.AdafruitButtonUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int”>0x20</value> <value name="target" type="String">controller</value> </config> </roboUnit> <roboUnit id="controller"> <class>com.robo4j.rpi.lcd.example.controller.LcdExampleController</class> <config name="com.robo4j.root"> <value name="target" type="String">lcd</value> </config> </roboUnit> </robo4j>
  • 13. http://robo4j.io Robo4J @robo4j Controller @CriticalSectionTrait public class LcdExampleController extends RoboUnit<AdafruitButtonEnum> { … public void onMessage(AdafruitButtonEnum message) { if (!isDemoRunning()) { processAdafruitMessage(message); } else { SimpleLoggingUtil.print(getClass(), "Skipping " + message + " due to test already running!"); } } public void onInitialization(Configuration configuration) throws ConfigurationException { target = configuration.getString("target", null); if (target == null) { throw ConfigurationException.createMissingConfigNameException("target"); } } …
  • 14. http://robo4j.io Robo4J @robo4j Controller, continued … private void processAdafruitMessage(AdafruitButtonEnum myMessage) { switch (myMessage) { case DOWN: moveToNextDemo(); break; case UP: moveToPreviousDemo(); break; case SELECT: runDemo(); break; default: sendLcdMessage(getContext(), String.format("Button %snis not in use...", myMessage)); } } }
  • 18. http://robo4j.io Robo4J @robo4j Robo4J Networking • Autodiscovery / Heartbeats / Native package format • Messaging / Remote Contexts
  • 19. http://robo4j.io Robo4J @robo4j Autodiscovery Enablement <robo4j> <roboSystem> <config name="com.robo4j.root"> <value name="poolSizeScheduler" type="int">2</value> … <config name="com.robo4j.messageServer"> <value name="port" type="int">0</value> </config> <config name="com.robo4j.discovery"> <value name="multicastAddress" type="String">238.12.15.254</value> <value name="port" type="int">0x0FFE</value> <value name="heartBeatInterval" type="int">250</value> <value name="enabled" type="boolean">true</value> <config name="com.robo4j.discovery.metadata"> <value name="name" type="String">Button Activator</value> <value name="description" type="String">Little remote controlled button</value> </config> </config> </config> </roboSystem> </robo4j>
  • 20. http://robo4j.io Robo4J @robo4j Remote Messaging String id = "myid"; LookupService lookupService = LookupServiceProvider.getDefaultLookupService(); RoboContext context = lookupService.getContext(id); RoboReference<String> reference = context.getReference(id); reference.sendMessage("Hello!");
  • 21. http://robo4j.io Robo4J @robo4j Lookup by Metadata Stream<RoboContextDescriptor> matchingDescriptors = lookupService.getDiscoveredContexts().values().stream(). filter((ctx) -> isRoboticOverlord(ctx)); … private static boolean isRoboticOverlord(RoboContextDescriptor context) { return context.getMetadata().containsKey("isRoboticOverlord"); }
  • 23. http://robo4j.io Robo4J @robo4j Robo4J Http Communication • Want to communicate messages to the units over http • Simply add HttpServerUnit or HttpClientUnit • Communication is implemented using Java NIO • Messages by default sent as Json • Translate from/to Json and the message type accepted by the unit • Define your codecs: @HttpProducer, @HttpDecoder, @HttpEncoder
  • 24. http://robo4j.io Robo4J @robo4j Robo4J REST • Default get operation is listing all registered units with their states • Default post operation for a unit is to send a message to it • There must be a registered http codec for converting from Json to the message type for the message to be received HTTP GET: http://<ROBO4J_IP>:<ROBO4J_PORT> HTTP POST: http://<ROBO4J_IP>:<ROBO4J_PORT>/units/<unit id>
  • 25. http://robo4j.io Robo4J @robo4j Robo4J Example Get HTTP GET : http://127.0.0.1:8025 uid: 142d7167-7a43-477e-8dfd-75fdd711b6da, response: [ { id:"controller", com.robo4j.LifecycleState:"STARTED“ }, { id:"httpServer", com.robo4j.LifecycleState:"STOPPED" }, ... ]
  • 26. http://robo4j.io Robo4J @robo4j Robo4J Example Post Example: http://localhost:8025/units/controller BODY: {“message”: “push“} Returns HTTP code 202, if message was deserialized properly and put on the bus. Returns 404 if unit is not found. Returns 501 if, for example, no codec is present for the type required by the unit.
  • 27. http://robo4j.io Robo4J @robo4j Video Streaming Demo Configuration <robo4j> <roboUnit id="httpClient"> <class>com.robo4j.socket.http.units.HttpClientUnit</class> <config name="com.robo4j.root"> <value name="address" type="String">SERVER_IP</value> <value name="port" type="int">SERVER_PORT</value> <value name="mode" type="boolean">true</value> <value name="targetUnits" type="String">{"imageController":"POST"}</value> </config> </roboUnit> <roboUnit id="imageController"> <class>com.robo4j.units.rpi.camera.RaspistillUnit</class> <config name="com.robo4j.root"> <value name="targetOut" type="String">httpClient</value> <value name="client" type="String">SERVER_IP</value> <value name="clientPort" type="String">SERVER_PORT</value> <value name="clientUri" type="String”>/<SERVER_ENDPOINT></value> <value name="width" type="String">320</value> <value name="height" type="String">240</value> <value name="timelapse" type="String">100</value> </config> </roboUnit> </robo4j> • Two Robo4J Systems • Robo4J on JavaFx
  • 28. http://robo4j.io Robo4J @robo4j Video and Image Streaming Demo with Autodiscovery
  • 29. http://robo4j.io Robo4J @robo4j Robo4J and Lego Robo4J supports LejOS 9.x on Java 8 and above Hardware abstractions in robo4j-hw-lego Units in robo4j-units-lego Robo4J allows you to mix Lego functionality with other hardware Turn On the robot named “Number42”
  • 30. http://robo4j.io Robo4J @robo4j Lego Robot Number42 is alive <robo4j> <roboUnit id="http"> <class>com.robo4j.socket.http.units.HttpServerUnit</class> <config name="com.robo4j.root"> <value name="port" type="int">8025</value> <value name="target" type="String">controller</value> <value name="packages" type="String">com.robo4j.lego.j1kids.example.codec</value> <value name="targetUnits" type="String">{"controller":"GET"}</value> </config> </roboUnit> <roboUnit id="buttons"> <class>com.robo4j.units.lego.BrickButtonsUnit</class> <config name="com.robo4j.root"> <value name="target" type="String">controller</value> <value name="button_right" type="String">left</value> <value name="button_left" type="String">right</value> <value name="button_up" type="String">down</value> <value name="button_down" type="String">up</value> <value name="button_enter" type="String">enter</value> </config> </roboUnit> <roboUnit id="lcd"> <class>com.robo4j.units.lego.LcdUnit</class> <config name="com.robo4j.root"> </config> </roboUnit> <roboUnit id="controller"> <class>com.robo4j.lego.j1kids.example.controller.PlatformController</class> <config name="com.robo4j.root"> <value name="target" type="String">platform</value> </config> </roboUnit> <roboUnit id="weaponController"> <class>com.robo4j.lego.j1kids.example.controller.WeaponController</class> <config name="com.robo4j.root"> <value name="target" type="String">weapon</value> </config> </roboUnit> <roboUnit id="touchUnit"> <class>com.robo4j.units.lego.TouchUnit</class> <config name="com.robo4j.root"> <value name="target" type="String">weaponController</value> </config> </roboUnit> <roboUnit id="weapon"> <class>com.robo4j.units.lego.SingleMotorUnit</class> <config name="com.robo4j.root"> </config> </roboUnit> <roboUnit id="platform"> <class>com.robo4j.units.lego.SimpleTankUnit</class> <config name="com.robo4j.root"> <value name="leftMotorPort" type="String">B</value> <value name="leftMotorType" type="Character">N</value> <value name="rightMotorPort" type="String">C</value> <value name="rightMotorType" type="Character">N</value> </config> </roboUnit> </robo4j>
  • 32. http://robo4j.io Robo4J @robo4j Coff-E • Robotic platform (Wall-E on Java) • 3D printed + Makeblock + Pololu + Adafruit hardware
  • 34. http://robo4j.io Robo4J @robo4j Coff-E at JavaOne 2016 The embedded video on this page was removed due to presentation size restrictions. We’ve uploaded the embedded video on youtube here: https://www.youtube.com/watch?v=cNLlPGiBzqg
  • 35. http://robo4j.io Robo4J @robo4j Configuration <robo4j> <roboUnit id="lcd"> <class>com.robo4j.units.rpi.lcd.AdafruitLcdUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x20</value> </config> </roboUnit> <roboUnit id="buttons"> <class>com.robo4j.units.rpi.lcd.AdafruitButtonUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x20</value> <value name="target" type="String">controller</value> </config> </roboUnit> <robo4j> <roboUnit id="motion"> <class>com.robo4j.units.rpi.roboclaw.RoboClawRCTankUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x40</value> <value name="leftChannel" type="int">6</value> <value name="rightChannel" type="int">7</value> </config> </roboUnit> </robo4j> <roboUnit id="laserscanner.servo"> <class>com.robo4j.units.rpi.pwm.PCA9685ServoUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x40</value> <value name="channel" type="int">0</value> <value name="trim" type="float">7</value> <value name="shutdownValue" type="float">0</value> </config> </roboUnit> <roboUnit id="laserscanner.tilt"> <class>com.robo4j.units.rpi.pwm.PCA9685ServoUnit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x40</value> <value name="channel" type="int">1</value> <value name="trim" type="float">-40</value> <value name="inverted" type="boolean">true</value> <value name="shutdownValue" type="float">0</value> </config> </roboUnit> <roboUnit id="scanner"> <class>com.robo4j.units.rpi.lidarlite.LaserScanner</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x62</value> <value name="servo" type="String">laserscanner.servo</value> <value name="servoRange" type="float">45.0</value> <value name="angularSpeed" type="float">100.0</value> <value name="minAquisitionTime" type="float">2.5</value> <value name="trim" type="float">5.5</value> </config> </roboUnit> <roboUnit id="gyro"> <class>com.robo4j.units.rpi.gyro.GyroL3GD20Unit</class> <config name="com.robo4j.root"> <value name="bus" type="int">1</value> <value name="address" type="int">0x6b</value> <value name="sensitivity" type="String">DPS_245</value> <value name="enableHighPass" type="boolean">true</value> <value name="period" type="int">10</value> </config> </roboUnit> <roboUnit id="tank"> <class>com.robo4j.coffe.controllers.TankController</class> <config name="com.robo4j.root"> <value name="useTracks" type="boolean">false</value> <value name="maxSpeed" type="float">0.4</value> </config> </roboUnit> <roboUnit id="scanprocessor"> <class>com.robo4j.coffe.units.ScanProcessor</class> </roboUnit> <roboUnit id="missioncontroller"> <class>com.robo4j.coffe.controllers.MissionController</class> <config name="com.robo4j.root"> <value name="lcd" type="String">lcd</value> <value name="tank" type="String">tank</value> <value name="scanner" type="String">scanner</value> <value name="scanProcessor" type="String">scanprocessor</value> <value name="modeOfOperation" type="String">fastest_path</value> </config> </roboUnit> . . (GPS, magnetometer etc.) . </robo4j>
  • 36. http://robo4j.io Robo4J @robo4j Build Your Own Coff-E • See Thingiverse for more information: https://www.thingiverse.com/thing:1730244 • See the robo4j-coffe repo for code
  • 37. http://robo4j.io Robo4J @robo4j Tools Demo JDK Mission Control Plug-in (JFR, LIDAR Scan Visualization) Magnetometer Calibration Utility (MagViz)
  • 38. http://robo4j.io Robo4J @robo4j Summary • Robots are fun • Java and Robo4J lets you build them quickly • We have just started (had a bit of a break the past year getting/tending to babies/toddlers)… • …but hopefully this helps someone • Please give us feedback! Also build a robot. You will not regret it! :)
  • 39. http://robo4j.io Robo4J @robo4j For More Info Robo4J Homepage: http://www.robo4j.io Robo4J on Twitter: @robo4j Marcus on Twitter: @hirt Miro on Twitter: @miragemiko