diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java index 1240414a8017b08c00a604276d47a09426e0c17f..448ebb2f3099aaef5b068e9d9ce91cbe5e03b83d 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java @@ -33,6 +33,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPi; import org.fortiss.af3.platform.raspberry.model.SensorIMU; import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; +import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -81,11 +82,6 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(con, 0, 0); registerPrototype("CanConnector", con, CATEGORY_NAME); - // SensorConnector sensor = RaspberryModelElementFactory.createSensorConnector(); - // setNodePosition(sensor, 0, 0); - // setConnectorPosition(sensor, 0, 0); - // registerPrototype("GenericPI_Sensor", sensor, CATEGORY_NAME); - SensorIMU imu = RaspberryModelElementFactory.createSensorIMU(); setNodePosition(imu, 0, 0); setConnectorPosition(imu, 0, 0); @@ -101,16 +97,6 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(sls, 0, 0); registerPrototype("LaserScanner_Sensor", sls, CATEGORY_NAME); - // SensorGamepad pad = RaspberryModelElementFactory.createGamepadSensor(); - // setNodePosition(pad, 0, 0); - // setConnectorPosition(pad, 0, 0); - // registerPrototype("Gamepad_Sensor", pad, CATEGORY_NAME); - - // ActuatorConnector actuator = RaspberryModelElementFactory.createActuatorConnector(); - // setNodePosition(actuator, 0, 0); - // setConnectorPosition(actuator, 0, 0); - // registerPrototype("GenericPI_Actuator", actuator, CATEGORY_NAME); - ActuatorPWM pwm = RaspberryModelElementFactory.createActuatorPWM(); setNodePosition(pwm, 0, 0); setConnectorPosition(pwm, 0, 0); @@ -126,6 +112,11 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(gpo, 0, 0); registerPrototype("GPO", gpo, CATEGORY_NAME); + WheelEncoder wEncoder = RaspberryModelElementFactory.createWheelEncoder(); + setNodePosition(wEncoder, 0, 0); + setConnectorPosition(wEncoder, 0, 0); + registerPrototype("WheelEncoder", wEncoder, CATEGORY_NAME); + Button1 button1 = RaspberryModelElementFactory.createButton1(); setNodePosition(button1, 0, 0); setConnectorPosition(button1, 0, 0); diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 38984afbf398022761208042a7eb2df7e221e20c..7dbfc2b5fda7e3c40a28105d7b29248524532c1c 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -14,6 +14,7 @@ <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmitter"/> <eClassifiers xsi:type="ecore:EClass" name="GPI" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> <eClassifiers xsi:type="ecore:EClass" name="GPO" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericTransmitter"/> + <eClassifiers xsi:type="ecore:EClass" name="WheelEncoder" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> <eSubpackages name="gamepad" nsURI="http://www.fortiss.org/af3/platform/raspberry/gamepad" nsPrefix="org-fortiss-af3-platform-raspberry-gamepad"> <eClassifiers xsi:type="ecore:EClass" name="Button1" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//generic/GenericReceiver"/> diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel index 65e79bd8480da88f79520beca8913996cc3a15a5..156f41bfdfb5f44cb8dd69a67e717a9d72a7cb8a 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel @@ -19,6 +19,7 @@ <genClasses ecoreClass="raspberry.ecore#//ActuatorPWM"/> <genClasses ecoreClass="raspberry.ecore#//GPI"/> <genClasses ecoreClass="raspberry.ecore#//GPO"/> + <genClasses ecoreClass="raspberry.ecore#//WheelEncoder"/> <nestedGenPackages prefix="Gamepad" basePackage="org.fortiss.af3.platform.raspberry.model" disposableProviderFactory="true" ecorePackage="raspberry.ecore#//gamepad"> <genClasses ecoreClass="raspberry.ecore#//gamepad/Button1"/> diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index e4206d22844b536bc95465d683b024d5772b9f7f..397e4f326c2aa0faf9f151f6d5bd948362ef4586 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -391,6 +391,19 @@ </objectClass> </target> </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.WheelEncoderTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.WheelEncoder"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.WheelEncoderExecutable"> + </objectClass> + </target> + </transformationProvider> </extension> <extension point="org.fortiss.tooling.base.annotation"> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java index 4d7c81c26d18352d06e1686b0b96155c71538c20..7a6d8b6ec32dd6641f197dc0366610f89ed0c292 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java @@ -32,6 +32,7 @@ import org.fortiss.af3.platform.raspberry.model.SensorConnector; import org.fortiss.af3.platform.raspberry.model.SensorIMU; import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; +import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -67,7 +68,7 @@ public class RaspberryPiCompositor extends Button1.class, Button2.class, Button3.class, Button4.class, ButtonL1.class, ButtonL2.class, ButtonR1.class, ButtonR2.class, Left_StickX_Position.class, Left_StickY_Position.class, Right_StickX_Position.class, - Right_StickY_Position.class); + Right_StickY_Position.class, WheelEncoder.class); if(container != null) { final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class); return instanceOfAny && instanceOfAny2; diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java new file mode 100644 index 0000000000000000000000000000000000000000..5da6e0d0a515c476a402cb868e33039af5875b8f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/WheelEncoderExecutable.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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; + +import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; +import org.fortiss.af3.platform.raspberry.model.WheelEncoder; + +/** + * Executable for {@link SensorLaserRangeFinder}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class WheelEncoderExecutable extends GenericReceiverExecutable { + + /** Constructor. */ + public WheelEncoderExecutable(WheelEncoder modelElement) { + super(modelElement); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java new file mode 100644 index 0000000000000000000000000000000000000000..88dcfa11ac18d7acca87c62dfbc3d4b5a41df71f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/WheelEncoderTransformation.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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; + +import org.fortiss.af3.platform.raspberry.generator.executable.WheelEncoderExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; +import org.fortiss.af3.platform.raspberry.model.WheelEncoder; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link SensorLaserRangeFinder}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class WheelEncoderTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return WheelEncoder.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return WheelEncoder.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof WheelEncoder; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new WheelEncoderExecutable((WheelEncoder)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java index f5b95a534cef56ce2ea7190593ff12b72517db32..9d7c2d5f1493ab5879f03ce21766045754f50455 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java @@ -32,6 +32,7 @@ import org.fortiss.af3.platform.raspberry.model.SensorGamepad; import org.fortiss.af3.platform.raspberry.model.SensorIMU; import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; +import org.fortiss.af3.platform.raspberry.model.WheelEncoder; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -249,4 +250,12 @@ public class RaspberryModelElementFactory { return button; } + /** Creates a {@link Right_StickY_Position}. */ + public static WheelEncoder createWheelEncoder() { + WheelEncoder wEncoder = ModelFactory.eINSTANCE.createWheelEncoder(); + wEncoder.setName("WheelEncoder"); + createConnectorLayout(wEncoder); + return wEncoder; + } + }