[![Build Status](https://travis-ci.org/MontiSim/RMIModelServer.svg?branch=master)](https://travis-ci.org/MontiSim/RMIModelServer) [![Maintainability](https://api.codeclimate.com/v1/badges/55c8774bfd4d37534691/maintainability)](https://codeclimate.com/github/MontiSim/RMIModelServer/maintainability) # RMIModelServer 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. 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. * 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 ``` to start it with custom port: ``` $ ./run.sh 5000 ``` ## External models ### Windows 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. ### 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 ``` 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. ## Docker 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: 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. If there is a new version of rmi-model-server, the `RMI_VERSION` in the Dockerfile needs to be updated accordingly. 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`. 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 ``` Or, for example with port 5000: ``` $ docker run --name=rmi-server -p 5000:10101 --rm rmi-server ```