Skip to content
Snippets Groups Projects
Commit 92c251c3 authored by Johannes Eder's avatar Johannes Eder
Browse files

added WheelEncoder model

parent 88b9cc92
No related branches found
No related tags found
No related merge requests found
Showing
with 132 additions and 16 deletions
......@@ -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);
......
......@@ -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"/>
......
......@@ -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"/>
......
......@@ -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">
......
......@@ -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;
......
/*--------------------------------------------------------------------------+
$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);
}
}
/*--------------------------------------------------------------------------+
$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);
}
}
......@@ -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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment