29
29
< a href ="#Waste-Service "> Waste Service</ a >
30
30
< div class ="sidenavSubSection ">
31
31
< a href ="#Waste-Service-Logical-Architecture "> Waste Service< br /> Logical Architecture</ a >
32
+ < a href ="#wasteservice-WasteService "> WasteService</ a >
33
+ < a href ="#wasteservice-Utils "> Utils</ a >
32
34
< a href ="#Planner-BCR "> PlannerBCR</ a >
33
- < a href ="#Waste-Service-Actors "> Actors</ a >
35
+ < a href ="#Waste-Service-QAK-Actors "> QAK Actors</ a >
36
+ < a href ="#WEnv "> Virtual Environment< br /> (WEnv)</ a >
34
37
</ div >
38
+ < a href ="#Deployment "> Deployment</ a >
39
+ < a href ="#WasteService-Demo "> WasteService Demo</ a >
35
40
</ div >
36
41
< a href ="test_plans.html "> Test Plans</ a >
37
42
< a href ="conclusions.html "> Conclusions</ a >
@@ -115,7 +120,7 @@ <h4>Class Diagram</h4>
115
120
116
121
< h2 id ="Echo-Waste-Server "> Sprint 1.1: Echo Waste Server</ h2 >
117
122
< ksi > Echo Waste Server</ ksi > (< a href ="../../Sprint1_Project/sprint1_echo_waste_server/ "> sprint1_echo_waste_server</ a > )
118
- is a mobile/desktop application that simulates a dummy WasteService and acts like an echo server:
123
+ is a mobile/desktop application that simulates a dummy WasteService and acts like an "enhanced" echo server:
119
124
it accepts TCP connections and reply to < code > store_requests</ code > with < code > load_accepted</ code > / < code > load_rejected</ code > ,
120
125
updating the capacity of containers and logging messages.
121
126
< br /> < br />
@@ -181,20 +186,45 @@ <h4>Class Diagrams</h4>
181
186
182
187
< h2 id ="Waste-Service "> Sprint 1.3: Waste Service</ h2 >
183
188
< ksi > Waste Service</ ksi > (< a href ="../../Sprint1_Project/sprint1_waste_service/ "> sprint1_waste_service</ a > )
184
-
185
-
186
- To simulate the behaviour of the DDR robot, we can use the Virtual Environment (WEnv) provided by our software house,
187
-
188
-
189
- spiegare basic robot (docker images), pathexecutor, planner
190
- < highlight2 > QAK model: spiegare gli attori</ highlight2 >
189
+ is the heart of the project. It's the main element of the core-business but also the main element of the whole
190
+ distributed system: it receives requests from smart devices and handles the interactions with other components,
191
+ such as (in the current Sprint) the TransportTrolley.
191
192
192
193
< h3 id ="Waste-Service-Logical-Architecture "> Waste Service Logical Architecture</ h3 >
193
194
< img width ="100% " src ="../../Sprint1_Project/sprint1_waste_service/project_logical_architecture_waste_service.png "/>
194
195
QAK model: < a href ="../../Sprint1_Project/sprint1_waste_service/src/waste_service.qak "> waste_service.qak</ a >
195
196
197
+ < h3 id ="wasteservice-WasteService "> WasteService</ h3 >
198
+ < ksi > wasteservice.WasteService</ ksi > is a Kotlin class used to store information about the service:
199
+ it contains 3 maps of type < code > EnumMap<WasteType, Double></ code > that represent an amount of KG
200
+ for each WasteType of the service:
201
+ < ul >
202
+ < li >
203
+ < ks > < code > preStorage</ code > </ ks > - is updated as soon as the TransportTrolley starts processing a deposit request.
204
+ This way we can instantly reply with a negative answer (loadRejected) if a certain amount of waste cannot be stored
205
+ </ li >
206
+ < li >
207
+ < ks > < code > storage</ code > </ ks > - is updated when the deposit is completed (it represents
208
+ the actual current state of the containers).
209
+ </ li >
210
+ < li >
211
+ < ks > < code > storageCapacity</ code > </ ks > - is the max amount of waste that each container can store.
212
+ </ li >
213
+ </ ul >
214
+ Aswell as the maps, the class contains methods to get and update the values of the containers, which are used
215
+ by the QAK actor of the WasteService.
216
+
217
+ < h3 id ="wasteservice-Utils "> Utils</ h3 >
218
+ < ksi > wasteservice.Utils</ ksi > is a Kotlin object that contains utility methods, for example to parse and validate the waste types,
219
+ or to simulate an action:
220
+ < ul >
221
+ < li > < ks > < code > simulateAction(Double)</ code > </ ks > takes an amount of waste and simulate an action,
222
+ for example the pickup or deposit, by waiting for an amount of time which is proportional to it.
223
+ </ li >
224
+ </ ul >
225
+
196
226
< h3 id ="Planner-BCR "> PlannerBCR</ h3 >
197
- PlannerBCR is an < i > extension</ i > of the Planner22Util Kotlin object, provided by our software house.
227
+ < ksi > PlannerBCR</ ksi > is an < i > extension</ i > of the Planner22Util Kotlin object, provided by our software house.
198
228
We added the < b > support for the map configuration</ b > , by exposing some new static methods:
199
229
< ul >
200
230
< li >
@@ -233,7 +263,7 @@ <h3 id="Planner-BCR">PlannerBCR</h3>
233
263
implementation files('../unibolibs/map_editor_bcr.jar')
234
264
</ pre >
235
265
236
- < h3 id ="Waste-Service-Actors "> Actors</ h3 >
266
+ < h3 id ="Waste-Service-QAK- Actors "> QAK Actors</ h3 >
237
267
< table class ="dictionary ">
238
268
< tr >
239
269
< th > Actor</ th >
@@ -263,7 +293,8 @@ <h3 id="Waste-Service-Actors">Actors</h3>
263
293
< td > Ctx_TransportTrolley</ td >
264
294
< td >
265
295
Receive the deposit requests from the WasteService and performs them:
266
-
296
+ to < b > simulate</ b > the actual pickup and dump of the waste, we delay the execution
297
+ of an amount which is < b > proportional to the load weight</ b > .
267
298
</ td >
268
299
</ tr >
269
300
< tr >
@@ -285,11 +316,105 @@ <h3 id="Waste-Service-Actors">Actors</h3>
285
316
</ tr >
286
317
</ table >
287
318
319
+ < h3 id ="WEnv "> Virtual Environment (WEnv)</ h3 >
320
+ Our software house provided the software to virtually simulate the robot inside the room, in the form
321
+ of a < a href ="../../../unibo.basicrobot22/virtualRobotOnly4.0.yaml "> docker image</ a > .
322
+ < br />
323
+ To run it simply enter the following command, after moving to its directory (< a href ="https://www.docker.com/ "> docker</ a > needed):
324
+ < pre >
325
+ docker-compose -f .\virtualRobotOnly4.0.yaml up
326
+ </ pre >
327
+ NB: we use the image with only the virtual robot, because our basic robot (which is needed for the simulation to work,
328
+ is a QAK actor).
329
+ < br /> < br />
330
+ < a href ="../../../commons/docker/dockerNotes.html "> BCR Docker Notes</ a >
331
+
288
332
< h2 id ="Deployment "> Deployment</ h2 >
289
- Where to download the software.
333
+ As a result of the project phase, we produced a series of applications, which
334
+ can be downloaded from the repository on GitHub:
335
+ < ul >
336
+ < li > SmartDevice Simulator: APK.</ li >
337
+ < li > Echo Waste Server: APK or Desktop versions.</ li >
338
+ < li > Map Editor BCR: self-containing JAR (requires Java 11).</ li >
339
+ < li > WasteService: IntelliJ project.</ li >
340
+ </ ul >
341
+ In order to being able to run the main of the contexts separately, we created 3 different
342
+ gradle tasks:
343
+ < pre style ="white-space: pre; ">
344
+ task(runCtx_WasteService, dependsOn: 'classes', type: JavaExec) {
345
+ mainClass = 'it.unibo.ctx_wasteservice.MainCtx_wasteserviceKt'
346
+ classpath = sourceSets.main.runtimeClasspath
347
+ }
348
+
349
+ task(runCtx_TransportTrolley, dependsOn: 'classes', type: JavaExec) {
350
+ mainClass = 'it.unibo.ctx_transporttrolley.MainCtx_transporttrolleyKt'
351
+ classpath = sourceSets.main.runtimeClasspath
352
+ }
353
+
354
+ task(runCtx_Robot, dependsOn: 'classes', type: JavaExec) {
355
+ mainClass = 'it.unibo.ctx_robot.MainCtx_robotKt'
356
+ classpath = sourceSets.main.runtimeClasspath
357
+ }
358
+ </ pre >
359
+ Those tasks allow us to run each context using a specific gradle demon, with the following commands:
360
+ < ul >
361
+ < li >
362
+ Run the < ks > Robot</ ks > context:
363
+ < pre >
364
+ ./gradlew runCtx_Robot
365
+ </ pre >
366
+ </ li >
367
+ < li >
368
+ Run the < ks > TransportTrolley</ ks > context:
369
+ < pre >
370
+ ./gradlew runCtx_TransportTrolley
371
+ </ pre >
372
+ </ li >
373
+ < li >
374
+ Run the < ks > WasteService</ ks > context:
375
+ < pre >
376
+ ./gradlew runCtx_WasteService
377
+ </ pre >
378
+ </ li >
379
+ </ ul >
290
380
291
381
< h2 id ="WasteService-Demo "> WasteService Demo</ h2 >
292
- < highlight2 > script per avviare la demo, con parametri, spiegare il setup e cosa fa la demo.</ highlight2 >
382
+ In order to run demo components we need:
383
+ < ul >
384
+ < li > Java 11 or more recent</ li >
385
+ < li > Gradle 7.4.1 or more recent</ li >
386
+ < li > Docker</ li >
387
+ < li > Flutter</ li >
388
+ </ ul >
389
+
390
+ The directory < a href ="../../Sprint1_Project/scripts/ "> scripts/</ a > contains batch scripts to run the sprint1 demo on Windows:
391
+ < ol >
392
+ < li >
393
+ < a href ="../../Sprint1_Project/scripts/run_VirtualRobot.bat "> run_VirtualRobot.bat</ a > - runs the docker image of the WEnv, and opens a new
394
+ chrome window to show the robot.
395
+ </ li >
396
+ < li >
397
+ < a href ="../../Sprint1_Project/scripts/run_AndroidEmulator.bat "> run_AndroidEmulator.bat</ a > - starts a Google Pixel_3a_API_30_x86 emulator
398
+ (Android).
399
+ </ li >
400
+ < li >
401
+ < a href ="../../Sprint1_Project/scripts/run_WasteService.bat "> run_WasteService.bat</ a > - starts 3 gradle demons, one for each context of
402
+ the WasteService.
403
+ </ li >
404
+ < li >
405
+ < a href ="../../Sprint1_Project/scripts/run_SmartDevice.bat "> run_SmartDevice.bat</ a > - runs an integration demo test for the SmartDevice
406
+ that succeeds if it was able to connect to the WasteService, receive the types, and receive a reply to the store request.
407
+ It can take 4 or 0 arguments (the order matters):
408
+ < ol >
409
+ < li > < code > IP</ code > - the IP address of the host the SmartDevice will try to connect (WasteService).</ li >
410
+ < li > < code > Port</ code > - the port on which the service of the WasteService runs.</ li >
411
+ < li > < code > WasteType</ code > - the type of waste we want to use during the test.</ li >
412
+ < li > < code > WasteWeight</ code > - the amount of waste we want to dumo during the test.</ li >
413
+ </ ol >
414
+ </ li >
415
+ </ ol >
416
+
417
+
293
418
< h4 > Setup Remote Communications</ h4 >
294
419
< div class ="remark ">
295
420
< b > Port Forwarding</ b >
0 commit comments