Aufgrund einer Wartung wird GitLab am 19.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 19.10. between 8:00 and 9:00 am.

Commit 4f9caccd authored by Jean Meurice's avatar Jean Meurice
Browse files

Readme update, scripts update

parent f8f65a3d
Pipeline #115750 passed with stages
in 1 minute and 43 seconds
......@@ -3,72 +3,42 @@
# RMIModelServer
RMIServer allowing remote access to vehicle models developed in different languages and integrated with Java.
The RMIModelServer is used to remotely allocate a series of [_HardwareEmulators_](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/hardware_emulator), which can load different autopilots generated with [_EMAM2CPP_](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/EMAM2Cpp).
## 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
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.
## Compiling
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.
To just compile the `jar`, use
* 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]
```
mvn clean install -s settings.xml
To compile and copy the server to the local `install` folder, use the `scripts/compile_install` scripts.
for example, to start RMI server with default port(10101):
```
$ ./run.sh
```
__NOTE:__ New versions of the _HardwareEmulator_ must be copied into the `install` folder. This folder is used in a maven test to verify RMIModelServer/HardwareEmulator integration.
to start it with custom port:
```
$ ./run.sh 5000
```
## Running the RMI server
## 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 `install` folder contains a sample setup for running the RMIModelServer.
The RMIModelServer jar must be in the same directory as the [HardwareEmulator](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/hardware_emulator) library it will use (_HardwareEmulator.lib_ or _HardwareEmulator.so_ for Windows or Linux).
The `run` script starts an instance of the RMIModelServer. It uses the `config` script to provide a way of changing the port or the autopilot folder used. The port defaults to 10101, and can be changed to start multiple RMIModelServers.
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.
The autopilot folder is a folder path (absolute or relative to the RMIModelServer) in which the RMI server will look for autopilot programs.
These programs are the EmbeddedMontiArc models compiled with EMAM2CPP (or a project using EMAM2CPP such as [EMAM-showcase](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/EMAM-showcase) or [EMAStudio](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/utilities/EMAStudioBuilder)).
The `autopilots` folder in the `install` folder contains the sample autopilot from `EMAM-Showcase`.
## Docker
......@@ -83,10 +53,6 @@ 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:
```
......
......@@ -21,11 +21,9 @@
FROM openjdk:8
ENV RMI_JAR=rmi-model-server-1.0.1-SNAPSHOT-jar-with-dependencies.jar
WORKDIR /app
COPY AutopilotAdapter.dll /usr/lib/
COPY AutopilotAdapter.dll ./
COPY $RMI_JAR ./rmi-model-server.jar
COPY HardwareEmulator.so ./
COPY rmi-model-server.jar ./rmi-model-server.jar
CMD exec java -cp rmi-model-server.jar -Djava.rmi.server.codebase=file:rmi-model-server.jar -Djava.rmi.server.useLocalHostname=true rwth.rmi.model.server.RMIServer 10101 /usr/lib/AutopilotAdapter.dll
CMD exec java -cp rmi-model-server.jar -Djava.rmi.server.codebase=file:rmi-model-server.jar -Djava.rmi.server.useLocalHostname=true rwth.rmi.model.server.RMIServer 10101 autopilots
......@@ -21,6 +21,7 @@
#
rm rmi-model-server-*.jar
cp ../target/rmi-model-server-*.jar ./
cp ../target/rmi-model-server-*-jar-with-dependencies.jar ./rmi-model-server.jar
cp ../install/HardwareEmulator.so ./
docker build -t rmi-server .
#!/bin/bash
# Please replace this with the path to the Autopilot(s)
AUTOPILOT_FOLDER=autopilots
# Change the port if you need to
PORT=10101
\ No newline at end of file
#!/bin/bash
./config.sh
echo "Starting RMIModelServer on port $PORT with Autopilot folder: $AUTOPILOT_FOLDER"
java "-Djava.rmi.server.codebase=file:rmi-model-server.jar" "-Djava.rmi.server.hostname=127.0.0.1" -cp rmi-model-server.jar rwth.rmi.model.server.RMIServer $PORT $AUTOPILOT_FOLDER --no-zookeeper %*
pause
pushd ..
mvn clean install -s "settings.xml"
cd target
cp "rmi-model-server-*-jar-with-dependencies.jar" "../install/rmi-model-server.jar"
popd
\ No newline at end of file
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
pushd %~dp0
set AUTOPILOT_HOME=..\..\EMAM-showcase
popd
set JAVA_HOME=%AUTOPILOT_HOME%\jdk
set MINGW_HOME=%AUTOPILOT_HOME%\mingw64
set ARMADILLO_HOME=%AUTOPILOT_HOME%\armadillo-8.400.0
set AUTOPILOT_DLL_DIR=%AUTOPILOT_HOME%\dll
set PATH=%AUTOPILOT_DLL_DIR%;%JAVA_HOME%\bin;%MINGW_HOME%\bin;%ARMADILLO_HOME%\examples\lib_win64;%PATH%
@REM Please replace this with the actual ABSOLUTE PATH to AutopilotAdapter.dll on your machine
set DLL=/ABSOLUTE/PATH/TO/AutopilotAdapter.dll
@REM Change the port if you need to
set PORT=10101
java "-Djava.library.path=%PATH%" "-Djava.rmi.server.codebase=file:..\target\rmi-model-server-1.0.1.jar" "-Djava.rmi.server.hostname=127.0.0.1" -cp ..\target\rmi-model-server-1.0.1.jar rwth.rmi.model.server.RMIServer %PORT% %DLL%
pause
#
#
# ******************************************************************************
# MontiCAR Modeling Family, www.se-rwth.de
# Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
# All rights reserved.
#
# This project is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this project. If not, see <http://www.gnu.org/licenses/>.
# *******************************************************************************
#
#run rmi server and registry
if [ -z "$1" ]; then
PORT=10101
else
PORT="$1"
fi
# Please replace this with the actual ABSOLUTE PATH to AutopilotAdapter.dll on your machine
DLL=/ABSOLUTE/PATH/TO/AutopilotAdapter.dll
java -cp ../target/rmi-model-server-1.0.1-SNAPSHOT.jar\
-Djava.rmi.server.codebase=file:../target/rmi-model-server-1.0.1-SNAPSHOT.jar\
-Djava.rmi.server.hostname=127.0.0.1 rwth.rmi.model.server.RMIServer\
$PORT $DLL
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment