The Robot under dictate of the LegoMindStorm Java Concurrency API
-
Upload
miroslav-kopecky -
Category
Presentations & Public Speaking
-
view
257 -
download
1
description
Transcript of The Robot under dictate of the LegoMindStorm Java Concurrency API
![Page 1: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/1.jpg)
LET’S SHIFT THETHE WORLD
Miroslav Kopecky
23rd October 2014
![Page 2: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/2.jpg)
MOTIVATION: I HAVE A DREAM
Karel Capek ROBOT
Miroslav Kopecky Prague, 23rd October 2014
© Martin Luther King
CZECH WORD
![Page 3: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/3.jpg)
BEGINNING: HOW IT LOOKED LIKE?
Miroslav Kopecky Prague, 23rd October 2014
![Page 4: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/4.jpg)
DREAM EVOLUTION
Miroslav Kopecky Prague, 23rd October 2014
DREAM REDEFINITION
![Page 5: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/5.jpg)
LET’S CREATE/FIND PROBLEMSand try to provide some set of solutions
Miroslav Kopecky Prague, 23rd October 2014
The Robot under dictate of the LegoMindStorm Java Concurrency API
![Page 6: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/6.jpg)
DO YOU KNOW THE MEANING?
Miroslav Kopecky Prague, 23rd October 2014
![Page 7: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/7.jpg)
AGENDA:• ROBOT INITIATION SEQUENCE INJAVA SPACE
• PRODUCER / CONSUMER PROBLEM • SYNCHRONIZED (demo) • CONCURRENCY API FEATURE (demo) • CONNECT ALL UNITS TOGETHER (demo)
• ROBOT GOES ONLINE (demo)
Miroslav Kopecky Prague, 23rd October 2014
![Page 8: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/8.jpg)
ROBOT INITIATION SEQUENCE
Miroslav Kopecky Prague, 23rd October 2014
LegoMindStorm Java Concurrency APINetwork Communication
Install LeJOS 8.1maven B tool
Compile Libraries (ev3classes)Connect The Brick
(WiFi, Bluetooth,UBS)
![Page 9: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/9.jpg)
EVEN SMALL DREAM IS COMPLEX
Miroslav Kopecky Prague, 23rd October 2014
![Page 10: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/10.jpg)
EVEN SMALL DREAM IS COMPLEX
Miroslav Kopecky Prague, 23rd October 2014
RMI
brick = new RemoteEV3(EV3BRICK_IP); brick.setDefault();
…STILL ONE LegoBRICK…
ProdCons
![Page 11: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/11.jpg)
THE ARE some RULEZ again
Miroslav Kopecky Prague, 23rd October 2014
1. brick.createRegulatedMotor(“A", "M".charAt(0));
2. Port portTouchSensor = brick.getPort("S1"); return new EV3TouchSensor(portTouchSensor);
possible monitor lock
return raw data
3. Mixture of 1 and 2 => IR Sensor (HEAD)
![Page 12: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/12.jpg)
PRODUCER CONSUMER STORY:
Miroslav Kopecky Prague, 23rd October 2014
BUS - Shared DataStructure
ORDERS PRODUCERS
CONSUMERS ~ BRIDGES
![Page 13: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/13.jpg)
SYNCRONIZED (demo 1, 2, 3) - early age
Miroslav Kopecky Prague, 23rd October 2014
public EventStorage(){ maxSize = 4; storage = new LinkedList<>(); motorRight = LegoBrickMoveEnginesProvider.
getInstance().getMotorRight(); motorLeft = LegoBrickMoveEnginesProvider.
getInstance().getMotorLeft(); }
feature:: couldn’t extend the lock beyond boundaries
![Page 14: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/14.jpg)
SYNCHRONIZED 1: THREAD CREATION
Miroslav Kopecky Prague, 23rd October 2014
DEMO
…more threads flying around…
![Page 15: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/15.jpg)
SYNCHRONIZED 2: EXECUTORs
Miroslav Kopecky Prague, 23rd October 2014
DEMO
… creation and execution…
![Page 16: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/16.jpg)
SYNCHRONIZED 3: LegoExecutor
Miroslav Kopecky Prague, 23rd October 2014
DEMO
… statistics…
![Page 17: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/17.jpg)
JAVA CONCURENCY API (demo)
Miroslav Kopecky Prague, 23rd October 2014
couple of synchronisation Utilities: Semaphore, CountDownLatch, CyclicBarrier
Exchanger<List<Integer>> exchanger = new Exchanger<>();
executor.submit( new BrickConsumer( consumerBuffer, exchanger)); executor.shutdown();
![Page 18: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/18.jpg)
EXCHANGER : exchanger.exchange(buffer)
Miroslav Kopecky Prague, 23rd October 2014
DEMO
![Page 19: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/19.jpg)
CONNECT ALL UNITS TOGETHER (demo)
Miroslav Kopecky Prague, 23rd October 2014
concurrency and parallelism in the action
1. sensors + engine (front hand) executor.submit(new MoveSimulationSeparate());
2. movement engine (robot platform) executor.submit(new MovementUnit());
![Page 20: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/20.jpg)
CONNECT ALL UNITS TOGETHER
Miroslav Kopecky Prague, 23rd October 2014
FRONT HAND SYSTEM
PLATFORM
![Page 21: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/21.jpg)
CONNECT ALL UNITS TOGETHER
Miroslav Kopecky Prague, 23rd October 2014
DEMO
… more treads with statistics…
![Page 22: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/22.jpg)
ROBOT GOES ONLINE (demo)
Miroslav Kopecky Prague, 23rd October 2014
not to Hollywood (yet) ~ like Frankie => RELAX
1. Spring 4.1 1. JSP + TILES with AngularJS
2. NETTY -> RaspberryPi 3. LegoROBOT
LegoCommandPriorityQueue<E>
![Page 23: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/23.jpg)
ROBOTS GOES ONLINE
Miroslav Kopecky Prague, 23rd October 2014
DEMO… promising Feature<?>…
![Page 24: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/24.jpg)
QUESTIONS & ANSWERS
I CAN ONLY PLAY THE SOUND!
Miroslav Kopecky Prague, 23rd October 2014
Audio brickAudio = brick.getAudio(); brickAudio.systemSound(?);
![Page 25: The Robot under dictate of the LegoMindStorm Java Concurrency API](https://reader033.fdocuments.in/reader033/viewer/2022052622/559433901a28aba11a8b45ea/html5/thumbnails/25.jpg)
THANKs!
Miroslav Kopecky Prague, 23rd October 2014