-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds docs for desktop robotti with rabbitmq example
- Loading branch information
1 parent
c619d84
commit 7f8b6ca
Showing
8 changed files
with
306 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Desktop Robotti with RabbitMQ | ||
|
||
## Overview | ||
|
||
This example demonstrates bidirectional communication between | ||
a mock physical twin and a digital twin of a mobile robot (Desktop Robotti). | ||
The communication is enabled by RabbitMQ Broker. | ||
|
||
![Desktop Robotti with RabbitMQ Broker and Digital Twin](system.png) | ||
|
||
## Example Structure | ||
|
||
The mock physical twin of mobile robot is created using two python scripts | ||
|
||
1. data/drobotti_rmqfmu/rmq-publisher.py | ||
1. data/drobotti_rmqfmu/consume.py | ||
|
||
The mock physical twin sends its physical location in _(x,y)_ coordinates and | ||
expects a cartesian distance $\sqrt(x^2 + y^2)$ calculated from digital twin. | ||
|
||
![Desktop Robotti DT structure](dt-structure.png) | ||
|
||
The _rmq-publisher.py_ reads the recorded _(x,y)_ physical coordinates of | ||
mobile robot. The recorded values are stored in a data file. | ||
These _(x,y)_ values are published to RabbitMQ Broker. The published | ||
_(x,y)_ values are consumed by the digital twin. | ||
|
||
The _consume.py_ subscribes to RabbitMQ Broker and waits for the calculated | ||
distance value from the digital twin. | ||
|
||
The digital twin consists of a FMI-based co-simulation, where Maestro is used | ||
as co-orchestration engine. | ||
In this case, the co-simulation is created by using two FMUs - | ||
RMQ FMU (rabbitmq-vhost.fmu) and distance FMU (distance-from-zero.fmu). | ||
The RMQ FMU receives the _(x,y)_ coordinates from _rmq-publisher.py_ and | ||
sends calculated distance value to _consume.py_. The RMQ FMU uses | ||
RabbitMQ broker for communication with the mock mobile robot, i.e., | ||
_rmq-publisher.py_ and _consume.py_. | ||
The distance FMU is responsible for calculating the distance between | ||
_(0,0)_ and _(x,y)_. The RMQ FMU and distance FMU exchange values | ||
during co-simulation. | ||
|
||
## Configuration of assets | ||
|
||
This example uses two models, one tool, one data, and two scripts to create | ||
mock physical twin. The specific assets used are: | ||
|
||
| Asset Type | Names of Assets | Visibility | Reuse in Other Examples | | ||
|:---|:---|:---|:---| | ||
| Models | distance-from-zero.fmu | Private | No | | ||
| | rmq-vhost.fmu | Private | Yes | | ||
| Tool | maestro-2.3.0-jar-with-dependencies.jar | Common | Yes | | ||
| Data | drobotti_playback_data.csv | private | No | | ||
| Mock PT | rmq-publisher.py | Private | No | | ||
| | consume.py | Private | No | | ||
|
||
This DT has many configuration files. | ||
The `coe.json` and `multimodel.json` | ||
are two DT configuration files used for executing the digital twin. | ||
|
||
The `rabbitMQ-credentials.json` provides RabbitMQ access credentials | ||
for mock PT python scripts. | ||
|
||
## Lifecycle Phases | ||
|
||
| Lifecycle Phase | Completed Tasks | | ||
| -------- | ------- | | ||
| Create | Installs Java Development Kit for Maestro tool and pip packages for python scripts | | ||
| Execute | Runs both DT and mock PT | | ||
| Clean | Clears run logs and outputs | | ||
|
||
## Run the example | ||
|
||
To run the example, change your present directory. | ||
|
||
```bash | ||
cd workspace/examples/digital_twins/drobotti_rmqfmu | ||
``` | ||
|
||
If required, change the execute permission of lifecycle scripts | ||
you need to execute, for example: | ||
|
||
```bash | ||
chmod +x lifecycle/create | ||
``` | ||
|
||
Now, run the following scripts: | ||
|
||
### Create | ||
|
||
Installs Open Java Development Kit 17 in the workspace. Also install | ||
the required python pip packages for _rmq-publisher.py_ and | ||
_consume.py_ scripts. | ||
|
||
```bash | ||
lifecycle/create | ||
``` | ||
|
||
### Execute | ||
|
||
Run the python scripts to start mock physical twin. Also run the co-simulation for | ||
the digital twin. | ||
|
||
```bash | ||
lifecycle/execute | ||
``` | ||
|
||
#### Examine the results | ||
|
||
The results can be found in the | ||
_workspace/examples/digital\_twins/drobotti\_rmqfmu directory_. | ||
|
||
### Terminate phase | ||
|
||
Terminate to clean up the debug files and co-simulation output files. | ||
|
||
```bash | ||
lifecycle/terminate | ||
``` | ||
|
||
## References | ||
|
||
More information about the case study is available in: | ||
|
||
```txt | ||
Frasheri, Mirgita, et al. "Addressing time discrepancy between digital | ||
and physical twins." Robotics and Autonomous Systems 161 (2023): 104347. | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,19 @@ yarn clean # deletes directories "build", "coverage", and "dist" | |
|
||
## :package: :ship: NPM package | ||
|
||
### Github Package Registry | ||
|
||
The Github actions workflow of | ||
[lib microservice](../../../.github/workflows/runner.yml) publishes the __runner__ | ||
into [public packages](https://github.com/orgs/INTO-CPS-Association/packages). | ||
|
||
### Verdaccio - Local Package Registry | ||
|
||
Use the instructions in | ||
[publish npm package](../../../docs/developer/npm-packages.md) for help | ||
with publishing **runner npm package**. | ||
with publishing __runner npm package__. | ||
|
||
Application of the advice given on that page for **runner** will require | ||
Application of the advice given on that page for __runner__ will require | ||
running the following commands. | ||
|
||
### Publish | ||
|
@@ -53,7 +61,7 @@ yarn publish #increments version in package.json, publishes to registry and adds | |
### Unpublish | ||
|
||
```bash | ||
npm unpublish --registry http://localhost:4873/ @dtaas/[email protected] | ||
npm unpublish --registry http://localhost:4873/ @into-cps-association/[email protected] | ||
``` | ||
|
||
## :rocket: Access the service | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,16 +26,16 @@ yarn clean # deletes directories "build", "coverage", and "dist" | |
### Github Package Registry | ||
|
||
The Github actions workflow of | ||
[lib microservice](../../.github/workflows/lib-ms.yml) publishes the libms | ||
[lib microservice](../../.github/workflows/lib-ms.yml) publishes the __libms__ | ||
into [public packages](https://github.com/orgs/INTO-CPS-Association/packages). | ||
|
||
### Verdaccio - Local Package Registry | ||
|
||
Use the instructions in | ||
[publish npm package](../../docs/developer/npm-packages.md) for help | ||
with publishing **libms npm package** in local computer. | ||
with publishing __libms npm package__ in local computer. | ||
|
||
Application of the advice given on that page for **libms** will require | ||
Application of the advice given on that page for __libms__ will require | ||
running the following commands. | ||
|
||
### Publish | ||
|
@@ -50,7 +50,7 @@ yarn publish #increments version in package.json, publishes to registry and adds | |
### Unpublish | ||
|
||
```bash | ||
npm unpublish --registry http://localhost:4873/ @dtaas/[email protected] | ||
npm unpublish --registry http://localhost:4873/ @into-cps-association/[email protected] | ||
``` | ||
|
||
## Service Endpoint | ||
|