Commit b16a9a20 authored by Svetlana's avatar Svetlana
Browse files

Single-lane driving controller implementation.

parent 8ef40f25
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
...@@ -41,6 +42,11 @@ ...@@ -41,6 +42,11 @@
<artifactId>embedded-montiarc-math-middleware-generator</artifactId> <artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-deeplearning</artifactId>
<version>0.2.1-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-emadl-generator</artifactId> <artifactId>embedded-montiarc-emadl-generator</artifactId>
......
...@@ -2,6 +2,7 @@ package de.monticore.lang.monticar.torcs_dl; ...@@ -2,6 +2,7 @@ package de.monticore.lang.monticar.torcs_dl;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol; import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.RosToEmamTagSchema; import de.monticore.lang.embeddedmontiarc.tagging.RosToEmamTagSchema;
import de.monticore.lang.monticar.emadl.generator.AbstractSymtab;
import de.monticore.lang.monticar.generator.middleware.MiddlewareGenerator; import de.monticore.lang.monticar.generator.middleware.MiddlewareGenerator;
import de.monticore.lang.monticar.generator.middleware.impls.RosCppGenImpl; import de.monticore.lang.monticar.generator.middleware.impls.RosCppGenImpl;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper; import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
...@@ -23,7 +24,7 @@ public class Generator { ...@@ -23,7 +24,7 @@ public class Generator {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Starting code generation..."); System.out.println("Starting code generation...");
TaggingResolver taggingResolver = de.monticore.lang.monticar.emadl.generator.AbstractSymtab.createSymTabAndTaggingResolver(MODELS_PATH); TaggingResolver taggingResolver = AbstractSymtab.createSymTabAndTaggingResolver(MODELS_PATH);
RosToEmamTagSchema.registerTagTypes(taggingResolver); RosToEmamTagSchema.registerTagTypes(taggingResolver);
try { try {
......
...@@ -2,12 +2,26 @@ package dp.subcomponents; ...@@ -2,12 +2,26 @@ package dp.subcomponents;
component Drivercontroller { component Drivercontroller {
ports ports
in Q(0:1)^{13,1,1} affordanceIn, in Q(0:1)^{1,1,13} affordanceIn,
out Q(0:1)^{3,1,1} commandsOut; out Q(0:1)^{3,1,1} commandsOut;
implementation Math { implementation Math {
commandsOut(1,1,1)=0.5; // steering Q Constant = 1;
commandsOut(2,1,1)=0.8; // acceleration Q angle = affordanceIn(0,0,0);
Q roadWidth = affordanceIn(0,0,1) + affordanceIn(0,0,4);
Q laneWidth = affordanceIn(0,0,2) + affordanceIn(0,0,3);
Q distToLaneCenter = abs(laneWidth/2 - affordanceIn(0,0,2));
// Steering
commandsOut(2,1,1) = Constant * (angle-distToLaneCenter/roadWidth); // steering
// Acceleration
Q vMax = 72;
Q vC = 1;
Q vD = 0;
Q desiredSpeed = vMax * (exp(-(vC/vMax) * affordanceIn(0,0,6) - vD));
commandsOut(1,1,1) = desiredSpeed/vMax; // acceleration
commandsOut(3,1,1)=0.0; // brake commandsOut(3,1,1)=0.0; // brake
} }
} }
\ No newline at end of file
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