Commit 4f40be20 authored by Jean Meurice's avatar Jean Meurice

Master merge

parents 3d87db2a e32a1d5d
Pipeline #175722 failed with stage
in 1 minute and 16 seconds
# (c) https://github.com/MontiCore/monticore
#
stages:
......
# (c) https://github.com/MontiCore/monticore
script:
- git checkout ${TRAVIS_BRANCH}
......
<!-- (c) https://github.com/MontiCore/monticore -->
[![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)
......@@ -108,4 +109,4 @@ New autopilots might trigger new unsupported features:
* Unsupported system calls (enable `debug=unsupported_syscalls` flag for the autopilot emulator). These are operating system functions for which no current emulation is implemented. These have to be added and registered in the `hardware_emulator/src/os_linux/linux_calls.h / .cpp` files for Linux and in the `hardware_emulator/src/os_windows/windows_calls.h / .cpp` files for Windows.
* Unsupported instruction time value. The time table (currently `hardware_emulator/src/timetable/skylake.txt`) describing the number of CPU cycles for every instruction is manually filled. It currently only contains entries (!=0) for encountered instructions. It can be filled with elements from the `hardware_emulator/docs/instruction_time.txt` file (which contains entries from the instruction_tables.pdf file).
To make sure the autopilot emulation is correct, allocate an autopilot emulator with the `test_real` flag. When loading an autopilot with the same OS as the RMIModelServer, the emulator will compare the outputs of the emulated autopilot with the outputs of the actual autopilot program.
\ No newline at end of file
To make sure the autopilot emulation is correct, allocate an autopilot emulator with the `test_real` flag. When loading an autopilot with the same OS as the RMIModelServer, the emulator will compare the outputs of the emulated autopilot with the outputs of the actual autopilot program.
#!/bin/bash
# (c) https://github.com/MontiCore/monticore
rm rmi-model-server-*.jar
cp ../target/rmi-model-server-*-jar-with-dependencies.jar ./rmi-model-server.jar
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
set GENDIR=target\
......
@rem (c) https://github.com/MontiCore/monticore
@REM Please replace this with the path to the Autopilot(s)
set AUTOPILOT_FOLDER=autopilots
......
#!/bin/bash
# (c) https://github.com/MontiCore/monticore
# Please replace this with the path to the Autopilot(s)
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
pushd ..
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
pushd ..
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
pushd ..
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
pushd ..
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
pushd ..
......
<!-- (c) https://github.com/MontiCore/monticore -->
## install
This folder contains a sample setup of the RMIModelServer using the HardwareEmulator.
......@@ -7,4 +8,4 @@ This folder is used to perform a simple maven test including the HardwareEmulato
Autopilots can be added in the autopilots folder and loaded on the fly using HardwareEmulator configuration.
The demo folder contains examples that start the RMIModelServer with a default configuration that is added to
every allocated autopilot.
\ No newline at end of file
every allocated autopilot.
@rem (c) https://github.com/MontiCore/monticore
@echo off
call config.bat
......
#!/bin/bash
# (c) https://github.com/MontiCore/monticore
source ./config.sh
......
@rem (c) https://github.com/MontiCore/monticore
@echo off
call config.bat
......
#!/usr/bin/env bash
# (c) https://github.com/MontiCore/monticore
if [ -z "$1" ]; then
......
====
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
/* (c) https://github.com/MontiCore/monticore */
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.
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
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/>.
*******************************************************************************
====
******************************************************************************
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/>.
*******************************************************************************
<!--
******************************************************************************
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/>.
*******************************************************************************
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>montisim</groupId>
<artifactId>rmi-model-server</artifactId>
......@@ -311,4 +291,4 @@
</distributionManagement>
</project>
\ No newline at end of file
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
******************************************************************************
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/>.
*******************************************************************************
-->
<!-- (c) https://github.com/MontiCore/monticore -->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
......
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
/* (c) https://github.com/MontiCore/monticore */
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.
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
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/>.
*******************************************************************************
/**
*
* ******************************************************************************
* 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/>.
* *******************************************************************************
*/
package de.rwth.monticore.EmbeddedMontiArc.simulators.rmimodelserver;
/* (c) https://github.com/MontiCore/monticore */
package rwth.rmi.model.server;
import org.I0Itec.zkclient.ZkClient;
import de.rwth.monticore.EmbeddedMontiArc.simulators.hardware_emulator.HardwareEmulatorInterface;
......
/* (c) https://github.com/MontiCore/monticore */
package simulator.integration;
import org.junit.Test;
import org.junit.Assert;
import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
public class HardwareEmulatorTest {
@Test
public void basic_test() throws Exception {
System.out.println("Current test directory: " + System.getProperty("user.dir"));
HardwareEmulatorInterface manager = new HardwareEmulatorInterface("autopilots_folder=autopilots", "");
String querry = "get_available_autopilots\nget_available_threads";
String res = manager.query(querry);
System.out.println("EmulatorManager querry response: " + res);
String lines[] = res.split("\n");
Assert.assertEquals("Querry result line count", 2, lines.length);
String line1[] = lines[0].split("=");
Assert.assertEquals("available_autopilots two values (=)", 2, line1.length);
Assert.assertEquals("available_autopilots command", new String("available_autopilots"), line1[0]);
String line2[] = lines[1].split("=");
Assert.assertEquals("available_threads two values (=)", 2, line2.length);
Assert.assertEquals("available_threads command", new String("available_threads"), line2[0]);
String config = "autopilot=AutopilotAdapter";
config += "\nos=windows";
int id = manager.alloc_autopilot(config);
if (id < 0){
String q = manager.query( "get_error_msg" );
Assert.assertTrue("Could not allocate Emulator: " + q, id >= 0);
}
HashMap<String, Serializable> inputs = new HashMap<String, Serializable>();
inputs.put("timeIncrement", 1.0);
inputs.put("currentVelocity", 0.0);
inputs.put("x", 0.01);
inputs.put("y", 0.01);
inputs.put("compass", 0.0);
inputs.put("currentEngine", 0.0);
inputs.put("currentSteering", 0.0);
inputs.put("currentBrakes", 0.0);
inputs.put("trajectory_length", 5);
inputs.put("trajectory_x", new double[]{0.01, 0.02, 0.03, 0.04, 0.05, 0.06});
inputs.put("trajectory_y", new double[]{0.01, 0.01, 0.02, 0.02, 0.01, 0.01});
manager.update_bus(id, inputs);
//manager.start_tick(1000000);
//manager.end_tick();
HashMap<String, Serializable> outputs = manager.old_execute(id, 1000000, inputs);
String emu_querry = manager.query_autopilot(id, "get_avg_runtime");
System.out.println("Emu querry: " + emu_querry);
//HashMap<String, Serializable> outputs = manager.get_outputs(id);
Assert.assertEquals("output count", outputs.size(), 3);
for (HashMap.Entry<String, Serializable> entry : outputs.entrySet()) {
System.out.println(entry.getKey() + " = " + entry.getValue());
}
manager.free_autopilot(id);
//Try to clear up the library from the test directory
File lib = manager.get_library();
manager = null;
System.gc();
lib.delete();
}
}
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