From 635e6fc8eff3c33a08059b1d8056b21f19548b2a Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Tue, 29 May 2018 16:45:36 +0200
Subject: [PATCH] Started RasPi code generator for motor control.

Signed-off-by: Florian Hoelzl <hoelzl@fortiss.org>
---
 org.fortiss.af3.platform.raspberry/plugin.xml | 39 ++++++++
 .../executable/SingleUnitMainGenerator.java   | 28 ------
 .../generator/executable/brick/.ratings       |  1 +
 .../brick/LaserRangeSensorExecutable.java     | 94 +++++++++++++++++++
 .../executable/motorcontrol/.ratings          |  3 +
 .../MotorControlExecutableBase.java           | 57 +++++++++++
 .../MotorControlInputExecutable.java          | 31 ++++++
 .../MotorControlOutputExecutable.java         | 31 ++++++
 .../generator/transform/brick/.ratings        |  3 +-
 .../brick/LaserRangeTransformation.java       | 28 ++++++
 .../brick/UltraSonicTransformation.java       |  3 +-
 .../generator/transform/motorcontrol/.ratings |  2 +
 .../MotorControlInputTransformation.java      | 28 ++++++
 .../MotorControlOutputTransformation.java     | 28 ++++++
 14 files changed, 345 insertions(+), 31 deletions(-)
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/LaserRangeSensorExecutable.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/.ratings
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlExecutableBase.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlInputExecutable.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlOutputExecutable.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/LaserRangeTransformation.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/.ratings
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlInputTransformation.java
 create mode 100644 org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlOutputTransformation.java

diff --git a/org.fortiss.af3.platform.raspberry/plugin.xml b/org.fortiss.af3.platform.raspberry/plugin.xml
index 111dc5ca..ff7a0915 100644
--- a/org.fortiss.af3.platform.raspberry/plugin.xml
+++ b/org.fortiss.af3.platform.raspberry/plugin.xml
@@ -156,6 +156,32 @@
             </objectClass>
          </target>
       </transformationProvider>
+      <transformationProvider
+            transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.motorcontrol.MotorControlInputTransformation">
+         <source>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput">
+            </objectClass>
+         </source>
+         <target>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol.MotorControlInputExecutable">
+            </objectClass>
+         </target>
+      </transformationProvider>
+      <transformationProvider
+            transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.motorcontrol.MotorControlOutputTransformation">
+         <source>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput">
+            </objectClass>
+         </source>
+         <target>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol.MotorControlOutputExecutable">
+            </objectClass>
+         </target>
+      </transformationProvider>
       <transformationProvider
             transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.ConsoleOutputTransformation">
          <source>
@@ -182,6 +208,19 @@
             </objectClass>
          </target>
       </transformationProvider>
+      <transformationProvider
+            transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.brick.LaserRangeTransformation">
+         <source>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.model.brick.LaserRangeSensor">
+            </objectClass>
+         </source>
+         <target>
+            <objectClass
+                  objectClass="org.fortiss.af3.platform.raspberry.generator.executable.brick.LaserRangeSensorExecutable">
+            </objectClass>
+         </target>
+      </transformationProvider>
       <transformationProvider
             transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.PWMActuatorTransformation">
          <source>
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/SingleUnitMainGenerator.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/SingleUnitMainGenerator.java
index 07ff2fc3..57a8f714 100644
--- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/SingleUnitMainGenerator.java
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/SingleUnitMainGenerator.java
@@ -194,9 +194,6 @@ class SingleUnitMainGenerator {
 		return sb.toString();
 	}
 
-	// if(usePWM) {
-	// sb.append("int maestro_fd = -1;\n");
-	// }
 	// if(useDigits) {
 	// sb.append("SegmentDisplay4x7 segment_display;\n");
 	// sb.append("static void set_led_display (SegmentDisplay4x7 *segment_display, uint16_t value, bool showHex) {\n");
@@ -226,14 +223,6 @@ class SingleUnitMainGenerator {
 	// // extractRGBforLEDButton(p);
 	// // }
 	// }
-	// if(useLaser) {
-	// sb.append("int16_t laser_distance;\n");
-	// sb.append("uint64_t laser_last_cb_time = 0;\n");
-	// sb.append("void laser_callback(uint16_t distance, void *data) {\n");
-	// sb.append("laser_distance = distance;\n");
-	// sb.append("laser_last_cb_time = time_util_get_current_micros();\n");
-	// sb.append("}\n\n");
-	// }
 	// if(useACC) {
 	// sb.append("float Q = 0.022;\n");
 	// sb.append("float R = 0.917;\n");
@@ -420,20 +409,6 @@ class SingleUnitMainGenerator {
 		// String port = executionUnit.getCameraServerPort();
 		// sb.append("camera_client_initialize(\"" + addr + "\", \"" + port + "\");\n");
 		// }
-		// if(useLaser) {
-		// for(Pair<PlatformConnectorUnit, Port> p : deployedPorts) {
-		// if(p.getFirst() instanceof LaserRangeSensor) {
-		// LaserRangeSensor sensor = (LaserRangeSensor)p.getFirst();
-		// sb.append("LaserRangeFinder laser;\n");
-		// sb.append("laser_range_finder_create(&laser, \"" +
-		// sensor.getUniqueBrickletID() + "\", &brick_connection);\n");
-		// sb.append("laser_range_finder_enable_laser(&laser);\n");
-		// sb.append("laser_range_finder_register_callback(&laser, LASER_RANGE_FINDER_CALLBACK_DISTANCE, (void*)laser_callback, NULL);\n");
-		// sb.append("laser_range_finder_set_distance_callback_period(&laser, 10);\n");
-		// break;
-		// }
-		// }
-		// }
 		// if(useDigits) {
 		// for(Pair<PlatformConnectorUnit, Port> p : deployedPorts) {
 		// if(p.getFirst() instanceof ActuatorDigits) {
@@ -496,9 +471,6 @@ class SingleUnitMainGenerator {
 		// sb.append("rumblepad_config->button_callback = NULL;\n");
 		// sb.append("rumblepad_initialize(rumblepad_config);\n\n");
 		// }
-		// if(useVesc) {
-		// sb.append("initUSB(\"/dev/vesc\", B115200);\n");
-		// }
 		// for(Pair<ExecutionUnit, Component> p : deployedComponents) {
 		// Component c = p.getSecond();
 		// sb.append(makeCall("init", c));
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/.ratings
index b1913551..fe0a4bef 100644
--- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/.ratings
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/.ratings
@@ -1,2 +1,3 @@
 BrickExecutableBase.java e50fae1024e2f95953ff5cb2b56eb0250918021c YELLOW
+LaserRangeSensorExecutable.java fbad5722c9864ac6c93cdc0ecf8eae3724ecaf7c YELLOW
 UltraSonicSensorExecutable.java 7e121aa85b389b04f4e30fa54d695331082cb4b6 YELLOW
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/LaserRangeSensorExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/LaserRangeSensorExecutable.java
new file mode 100644
index 00000000..a06ec721
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/brick/LaserRangeSensorExecutable.java
@@ -0,0 +1,94 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.executable.brick;
+
+import org.fortiss.af3.component.model.InputPort;
+import org.fortiss.af3.platform.language.executable.ExecutableBase;
+import org.fortiss.af3.platform.raspberry.generator.executable.framework.IInstanceInitializationExecutable;
+import org.fortiss.af3.platform.raspberry.generator.executable.framework.IReadableExecutable;
+import org.fortiss.af3.platform.raspberry.model.brick.LaserRangeSensor;
+
+/**
+ * {@link ExecutableBase} for {@link LaserRangeSensor}s.
+ * 
+ * @author hoelzl
+ */
+public class LaserRangeSensorExecutable extends BrickExecutableBase<LaserRangeSensor> implements
+		IReadableExecutable, IInstanceInitializationExecutable {
+	/** Constructor. */
+	public LaserRangeSensorExecutable(LaserRangeSensor modelElement) {
+		super(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getHeaderFileName() {
+		return "bricklet_laser_range_finder.h";
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getVariableDeclaration(String postfix, String singletonPostfix) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("static LaserRangeFinder laser_range_device_" + postfix + ";\n");
+		sb.append("static uint16_t laser_range_value_" + postfix + " = 0;\n");
+		sb.append("static uint64_t laser_range_last_cb_time_" + postfix + " = 0;\n");
+		return sb.toString();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getInstanceAuxiliaryFunctions(String postfix, String singletonPostfix) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("void laser_range_callback_" + postfix + "(uint16_t distance, void *data) {\n");
+		sb.append("laser_range_value_" + postfix + " = distance;\n");
+		sb.append("laser_range_last_cb_time_" + postfix + " = time_util_get_current_micros();\n");
+		sb.append("}\n\n");
+		return sb.toString();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getInitializationCode(String postfix, String singletonPostfix) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("// initialize " + modelElement.getName());
+		sb.append("laser_range_finder_create(&laser_range_device_" + postfix + ", \"" +
+				modelElement.getUniqueBrickletID() + "\", &" +
+				getConnectionVariable(singletonPostfix) + ");\n");
+		sb.append("laser_range_finder_enable_laser(&laser_range_device_" + postfix + ");\n");
+		sb.append("laser_range_finder_register_callback(&laser_range_device_" + postfix +
+				", LASER_RANGE_FINDER_CALLBACK_DISTANCE, (void*)laser_range_callback_" + postfix +
+				", NULL);\n");
+		sb.append("laser_range_finder_set_distance_callback_period(&laser_range_device_" + postfix +
+				", 10);\n");
+		return sb.toString();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getReadCode(String postfix, String singletonPostfix, InputPort logicalSignal,
+			String targetVariable) {
+		StringBuilder sb = new StringBuilder();
+		sb.append(targetVariable + " = " + "laser_range_value_" + postfix + ";\n");
+		return sb.toString();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String getNoValReadCode(String prefix, String singletonPrefix, InputPort logicalSignal) {
+		return null;
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/.ratings
new file mode 100644
index 00000000..1c6e2920
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/.ratings
@@ -0,0 +1,3 @@
+MotorControlExecutableBase.java 48d568df87fa1e15588b830065762ad73ff12f97 YELLOW
+MotorControlInputExecutable.java a6162b9bd9b98997f1b3cc8eb63232338e3e84a8 RED
+MotorControlOutputExecutable.java 26aef1e59d43c0370246e082a3d401a5c378fd03 RED
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlExecutableBase.java
new file mode 100644
index 00000000..48d568df
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlExecutableBase.java
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol;
+
+import org.eclipse.emf.ecore.EObject;
+import org.fortiss.af3.platform.language.executable.ExecutableBase;
+import org.fortiss.af3.platform.raspberry.generator.executable.framework.ISingletonInitializationExecutable;
+
+/**
+ * {@link ExecutableBase} base class for motor controller elements.
+ * 
+ * @author hoelzl
+ */
+abstract class MotorControlExecutableBase<T extends EObject> extends ExecutableBase<T> implements
+		ISingletonInitializationExecutable {
+	/** Constructor. */
+	public MotorControlExecutableBase(T modelElement) {
+		super(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public final String getSingletonIdentifier() {
+		return "vesc.h";
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public final String getSingletonVariableDeclarationCode(String singletonPostfix) {
+		return null;
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public final String getSingletonAuxiliaryFunctions(String singletonPostfix) {
+		return null;
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public final String getSingletonInitializationCode(String singletonPostfix) {
+		return "initUSB(\"/dev/vesc\", B115200);\n";
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlInputExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlInputExecutable.java
new file mode 100644
index 00000000..a6162b9b
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlInputExecutable.java
@@ -0,0 +1,31 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol;
+
+import org.fortiss.af3.platform.language.executable.ExecutableBase;
+import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
+
+/**
+ * {@link ExecutableBase} for {@link MotorControlInput}.
+ * 
+ * @author hoelzl
+ */
+public class MotorControlInputExecutable extends MotorControlExecutableBase<MotorControlInput> {
+	/** Constructor. */
+	public MotorControlInputExecutable(MotorControlInput modelElement) {
+		super(modelElement);
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlOutputExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlOutputExecutable.java
new file mode 100644
index 00000000..26aef1e5
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/motorcontrol/MotorControlOutputExecutable.java
@@ -0,0 +1,31 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol;
+
+import org.fortiss.af3.platform.language.executable.ExecutableBase;
+import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
+
+/**
+ * {@link ExecutableBase} for {@link MotorControlOutput}.
+ * 
+ * @author hoelzl
+ */
+public class MotorControlOutputExecutable extends ExecutableBase<MotorControlOutput> {
+	/** Constructor. */
+	public MotorControlOutputExecutable(MotorControlOutput modelElement) {
+		super(modelElement);
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/.ratings
index ca9895f2..dd1bd62e 100644
--- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/.ratings
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/.ratings
@@ -1 +1,2 @@
-UltraSonicTransformation.java d4f9f72befdd6f8d89532826f761f59e6808f120 YELLOW
+LaserRangeTransformation.java c5d874667a38c93cd1ddf393107f93295b1d990d YELLOW
+UltraSonicTransformation.java af21e82f75ca2708478b75f47acfc83e7a73b81b YELLOW
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/LaserRangeTransformation.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/LaserRangeTransformation.java
new file mode 100644
index 00000000..c5d87466
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/LaserRangeTransformation.java
@@ -0,0 +1,28 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.transform.brick;
+
+import org.fortiss.af3.platform.raspberry.generator.executable.brick.LaserRangeSensorExecutable;
+import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
+import org.fortiss.af3.platform.raspberry.model.brick.LaserRangeSensor;
+
+/** Transformation for {@link LaserRangeSensor}. */
+public class LaserRangeTransformation extends RasPiGeneratorTransformationBase {
+	/** Constructor. */
+	public LaserRangeTransformation() {
+		super(LaserRangeSensor.class, LaserRangeSensorExecutable.class);
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/UltraSonicTransformation.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/UltraSonicTransformation.java
index d4f9f72b..af21e82f 100644
--- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/UltraSonicTransformation.java
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/brick/UltraSonicTransformation.java
@@ -18,9 +18,8 @@ package org.fortiss.af3.platform.raspberry.generator.transform.brick;
 import org.fortiss.af3.platform.raspberry.generator.executable.brick.UltraSonicSensorExecutable;
 import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
 import org.fortiss.af3.platform.raspberry.model.brick.UltraSonicSensor;
-import org.fortiss.af3.platform.raspberry.model.gamepad.Button1;
 
-/** Transformation for {@link Button1}. */
+/** Transformation for {@link UltraSonicSensor}. */
 public class UltraSonicTransformation extends RasPiGeneratorTransformationBase {
 	/** Constructor. */
 	public UltraSonicTransformation() {
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/.ratings
new file mode 100644
index 00000000..8656eaab
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/.ratings
@@ -0,0 +1,2 @@
+MotorControlInputTransformation.java 402a82dd3c96b48fa6f725ff4ecf8c39d25eda78 YELLOW
+MotorControlOutputTransformation.java 9b2294adc6db155535491b7d2e57fae6c8fe0b59 YELLOW
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlInputTransformation.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlInputTransformation.java
new file mode 100644
index 00000000..402a82dd
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlInputTransformation.java
@@ -0,0 +1,28 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.transform.motorcontrol;
+
+import org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol.MotorControlInputExecutable;
+import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
+import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
+
+/** Transformation for {@link MotorControlInput}. */
+public class MotorControlInputTransformation extends RasPiGeneratorTransformationBase {
+	/** Constructor. */
+	public MotorControlInputTransformation() {
+		super(MotorControlInput.class, MotorControlInputExecutable.class);
+	}
+}
diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlOutputTransformation.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlOutputTransformation.java
new file mode 100644
index 00000000..9b2294ad
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/transform/motorcontrol/MotorControlOutputTransformation.java
@@ -0,0 +1,28 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2018 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.af3.platform.raspberry.generator.transform.motorcontrol;
+
+import org.fortiss.af3.platform.raspberry.generator.executable.motorcontrol.MotorControlOutputExecutable;
+import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
+import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
+
+/** Transformation for {@link MotorControlOutput}. */
+public class MotorControlOutputTransformation extends RasPiGeneratorTransformationBase {
+	/** Constructor. */
+	public MotorControlOutputTransformation() {
+		super(MotorControlOutput.class, MotorControlOutputExecutable.class);
+	}
+}
-- 
GitLab