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

Commit 60f5fa39 authored by Mattis Hoppe's avatar Mattis Hoppe
Browse files

added usage for reinforcement learning

parent 5dfbd3aa
Pipeline #477057 failed with stage
in 55 seconds
{
"name": "rl_autopilot",
"map_name": "maps/aachen",
"max_duration": [10,0],
"tick_duration": [0,10000000],
"cars": [
{
"start_pos": [ -123.09, 21.64 ],
"start_orientation": -30.0,
"task": {
"goals": [
{
"type": "path",
"ltl_operator": "eventually",
"path": [ [-63.83, -171.96] ],
"range": 5
}
]
},
"components": [
{
"type": "constant_bus",
"connected_to": [
"SteeringActuator",
"BrakingActuator",
"GasActuator",
"TrueVelocitySensor",
"TruePositionSensor",
"TrueCompassSensor",
"Navigation",
"RLAutopilot"
]
},
{
"type": "actuator",
"name": "SteeringActuator",
"physical_value_name": "steering",
"change_rate": 60.0,
"sensor": { "type": "sensor" }
},
{
"type": "actuator",
"name": "BrakingActuator",
"physical_value_name": "braking",
"change_rate": 10.0,
"sensor": { "type": "sensor" }
},
{
"type": "actuator",
"name": "GasActuator",
"physical_value_name": "gas",
"sensor": { "type": "sensor" }
},
{
"type": "sensor",
"name": "TrueVelocitySensor",
"physical_value_name": "true_velocity"
},
{
"type": "sensor",
"name": "TruePositionSensor",
"physical_value_name": "true_position"
},
{
"type": "sensor",
"name": "TrueCompassSensor",
"physical_value_name": "true_compass"
},
{ "type": "navigation" },
{
"type": "rl_autopilot",
"name": "RLAutopilot",
"maxVehicleAccel": 7.460690450979396
}
]
}
]
}
......@@ -43,7 +43,7 @@
<build>
<plugins>
<plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
......@@ -59,7 +59,7 @@
<minimizeJar>true</minimizeJar>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.rwth.montisim.basic_simulator.App</mainClass>
<mainClass>de.rwth.montisim.basic_simulator.RLApp</mainClass>
</transformer>
</transformers>
<outputFile>${project.basedir}/install/${project.name}.jar</outputFile>
......@@ -69,7 +69,7 @@
</configuration>
</execution>
</executions>
</plugin>
</plugin> -->
<plugin>
......@@ -120,7 +120,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<version>1.4.0</version>
<executions>
<execution>
<goals>
......@@ -132,12 +132,37 @@
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<classpath/>
<argument>de.rwth.montisim.basic_simulator.App</argument>
</arguments>
<workingDirectory>${project.basedir}/install</workingDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>de.rwth.montisim.basic_simulator.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>${project.basedir}/install</outputDirectory>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
......
......@@ -26,12 +26,25 @@
</server>
</servers>
<mirrors>
<!--<mirrors>
<mirror>
<id>se-nexus</id>
<mirrorOf>external:*</mirrorOf>
<url>https://nexus.se.rwth-aachen.de/content/groups/public</url>
</mirror>
</mirrors>
</mirrors>-->
<repositories>
<repository>
<id>rosjava_mvn</id>
<name>Public Rosjava repository</name>
<url>https://github.com/rosjava/rosjava_mvn_repo/raw/master</url>
</repository>
<repository>
<id>jfrog</id>
<name>JFrog repository</name>
<url>https://repo.jfrog.org/artifactory/libs-releases</url>
</repository>
</repositories>
</settings>
......@@ -61,9 +61,19 @@ public class App
FileSystem fileSystem = new FileSystem(LibraryService.getWorkingDirectory());
if (args.length > 0){
String scenario_name = args[0];
System.out.println("Starting simulation with scenario: " + scenario_name);
runSimulation(scenario_name);
if(args.length > 1){
if(args[0].equals("-rl")){
//later add option -vis for vizualization
String scenario_name = args[1];
System.out.println("Starting reinforcement learning simulation with scenario: " + scenario_name);
runRLSimulation(scenario_name);
}
}
else{
String scenario_name = args[0];
System.out.println("Starting simulation with scenario: " + scenario_name);
runSimulation(scenario_name);
}
return;
}
......@@ -103,6 +113,26 @@ public class App
}
}
protected static void runRLSimulation(String path){
try {
File scenarioFile = new File(path);
SimulationConfig config = SimulationConfig.fromFile(scenarioFile);
File mapPath = new File(config.map_name + ".osm");
OsmMap map = new OsmMap(config.map_name, mapPath);
World world = new OsmToWorldLoader(map).getWorld();
Pathfinding pathfinding = new PathfindingImpl(world);
Simulator simulator = config.build(world, pathfinding, map);
//Run Simulation
RLSimulationInit simInit = new RLSimulationInit(config, world, pathfinding, map);
simInit.init();
} catch (Exception e1) {
e1.printStackTrace();
return;
}
}
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = App.class.getResource(path);
//TODO error handling ?
......
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