README.md 3.66 KB
Newer Older
Petyo's avatar
Petyo committed
1
[![Build Status](https://travis-ci.org/MontiSim/RMIModelServer.svg?branch=master)](https://travis-ci.org/MontiSim/RMIModelServer)
Evgeny Kusmenko's avatar
Evgeny Kusmenko committed
2
[![Maintainability](https://api.codeclimate.com/v1/badges/55c8774bfd4d37534691/maintainability)](https://codeclimate.com/github/MontiSim/RMIModelServer/maintainability)
Petyo's avatar
Petyo committed
3

Petyo's avatar
Petyo committed
4
# RMIModelServer
Petyo's avatar
Petyo committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

RMIServer allowing remote access to vehicle models developed in different languages and integrated with Java.

## Requirements

In order the project to be built locally, the following software is required:

    Windows 64 bit
    Apache Maven
    Java Development Kit, Version 8+
    (optional) Git

To clone this github repository, one can use the following commands

      cd MontiSim
      git clone https://github.com/MontiSim/RMIModelServer.git
      
__NOTE:__ _MontiSim_ is the directory, in which MontiSim-belonging projects should be clonned. It has to be manually created.

## Running the RMI server

To run the server one can has to run the corresponding script file from the __scripts__ directory in _RMIModelServer_ project.

28
By default, the RMI server will start with port 10101, you can change this if you need to. For example if you want to start multiple RMI server on different ports.
Petyo's avatar
Petyo committed
29

30
31
32
33
34
35
36
37
38
39
* For Windows users, edit the variable PORT and DLL in `run.bat` before you execute it.
* For Linux users, edit the variable DLL in `run.sh`, then execute the script with: 
```
$ ./run.sh [port] 
``` 

for example, to start RMI server with default port(10101):
```
$ ./run.sh
```
Petyo's avatar
Petyo committed
40

41
42
43
44
45
46
47
to start it with custom port:
```
$ ./run.sh 5000
```

## External models
### Windows
Petyo's avatar
Petyo committed
48
49
50
51
52
53
54
55
56
57
58
59
To use an external vehicle model, one has to clone the corresponding repository. For the _Autopilot emam_ vehicle model, located in [Autopilot emam repository](https://github.com/MontiSim/EMAM-showcase), the following commands have to be executed:

                    cd MontiSim
                    git clone https://github.com/MontiSim/EMAM-showcase.git
                    cd ./EMAM-showcase
                    mvn clean install
                    
                    cd EMAM-showcase/scripts
                    main.bat
                    
The last command `main.bat` will compile the model and run it in a server container to test it.

60
61
62
63
64
65
66
67
68
69
### Linux
First you need to edit the JAVA_HOME variable in scripts/linux/variables.sh
Then generate the cpp code:
```$xslt
$ ./generate.sh
```
Then compile the AutopilotAdapter.dll:
```$xslt
$ ./compile.sh
```
Petyo's avatar
Petyo committed
70
71

The scripts in `script` directory are already adjusted to use _Autopilot_ model. If a new model has to be integrated to the RMI Model server, an implementation of _VehicleModel_ has to be created and adjusted with the _ModelManager_. Additionally, all dependencies of the new model have to be declared in the _library_ or _class-path_ of the RMI Model server.
ham's avatar
ham committed
72
73
74

## Docker

75
76
77
78
79
80
81
Here is another possibility to run the RMI server without compiling the AutopilotAdapter.dll yourself.

First we build the docker image with 
```
$ ./docker/build.sh
```
This script only does 2 things:
ham's avatar
ham committed
82
83
84
85

1. Copy the latest rmi-model-server build into ./docker/ in order to prepare the build.
2. Then use ./docker/Dockerfile to build the rmi-model-server docker image.

86
If there is a new version of rmi-model-server, the `RMI_VERSION` in the Dockerfile needs to be updated accordingly. 
ham's avatar
ham committed
87

ham's avatar
typo    
ham committed
88
If you need to update the `AutopilotAdapter.dll`, it has to be recompiled under a linux 64-bit environment by using scripts in `scripts/linux` of repo `EMAM-showcase`.
89
90
91
92
93
94

After the docker image is built. Run following command to start the RMI server with port 10101:

```
$ docker run --name=rmi-server -p 10101:10101 --rm rmi-server
```
ham's avatar
ham committed
95

96
Or, for example with port 5000:
ham's avatar
ham committed
97
```
98
$ docker run --name=rmi-server -p 5000:10101 --rm rmi-server
ham's avatar
ham committed
99
100
```