Commit ddfe472c authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

New element model for Parking team



Issue-Ref: 3733
Signed-off-by: Hernan Ponce de Leon's avatarHernan Ponce de Leon <ponce@fortiss.org>
parent fe5f7d9b
......@@ -128,7 +128,10 @@
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.v2v.V2VOuput">
</modelElementClass>
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.parking.ParkingInput">
</modelElementClass>
</editPartFactory>
</extension>
<extension
......@@ -394,6 +397,11 @@
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.camera.CameraRoverID"/>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.platform.raspberry.ui.handler.ParkingInputHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.parking.ParkingInput"/>
</modelElementHandler>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
......
......@@ -41,6 +41,7 @@ import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstr
import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingInput;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeStrong;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeWeak;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumblepadReceiverBase;
......@@ -89,7 +90,7 @@ public class RaspberryPiEditPartFactory implements IEditPartFactory {
model instanceof CameraCurveRadius ||
model instanceof ControlCenterUpstreamOutput ||
model instanceof ControlCenterDownstreamInput || model instanceof V2VInput ||
model instanceof V2VOuput) {
model instanceof V2VOuput || model instanceof ParkingInput) {
return new StickyPlatformConnectorUnitEditPart((PlatformConnectorUnit)model);
}
return null;
......
/*-------------------------------------------------------------------------+
| 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.ui.handler;
import org.fortiss.af3.platform.raspberry.model.RaspberryPiReceiverBase;
/** Model element handler for parking model elements. */
public class ParkingInputHandler extends IconModelElementHandlerBase<RaspberryPiReceiverBase> {
/** Constructor. */
public ParkingInputHandler() {
super("icons/unknown.png");
}
}
......@@ -52,6 +52,7 @@ import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFacto
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLeftStickY;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createMotorControlInput;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createMotorControlOutput;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createParkingInput;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRightStickX;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRightStickY;
import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonA;
......@@ -131,6 +132,7 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickX_Position;
import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingInput;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonA;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonB;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonHome;
......@@ -190,6 +192,8 @@ public class ProtoypeProvider extends PrototypeProviderBase {
protected final static String CONTROL_CENTER = "Control Center";
/** Category for control center elements. */
protected final static String V2V_COM = "V2V Communication";
/** Category for parking elements. */
protected final static String PARKING_SERVER = "Parking Server";
/** {@inheritDoc} */
@Override
......@@ -204,6 +208,7 @@ public class ProtoypeProvider extends PrototypeProviderBase {
registerPrototypeCategory(prototypeCategory, CAMERA_SERVER);
registerPrototypeCategory(prototypeCategory, CONTROL_CENTER);
registerPrototypeCategory(prototypeCategory, V2V_COM);
registerPrototypeCategory(prototypeCategory, PARKING_SERVER);
CanBus bus = RaspberryModelElementFactory.createCanBus();
setNodeBounds(bus,
......@@ -232,6 +237,17 @@ public class ProtoypeProvider extends PrototypeProviderBase {
registerGamepadElements();
registerControlCenterElements();
registerV2VComElements();
registerParkingElements();
}
/**
*
*/
private void registerParkingElements() {
ParkingInput pInput = createParkingInput();
setNodePosition(pInput, 0, 0);
setConnectorPosition(pInput, 0, 0);
registerPrototype(pInput.getName(), pInput, PARKING_SERVER);
}
/**
......
......@@ -25,6 +25,7 @@ Export-Package: org.fortiss.af3.platform.raspberry.generator.framework,
org.fortiss.af3.platform.raspberry.model.motorcontrol,
org.fortiss.af3.platform.raspberry.model.motorcontrol.impl,
org.fortiss.af3.platform.raspberry.model.motorcontrol.util,
org.fortiss.af3.platform.raspberry.model.parking,
org.fortiss.af3.platform.raspberry.model.rumblepad,
org.fortiss.af3.platform.raspberry.model.rumblepad.impl,
org.fortiss.af3.platform.raspberry.model.rumblepad.util,
......
......@@ -141,4 +141,8 @@
<eClassifiers xsi:type="ecore:EClass" name="V2VLeaderUIDOutput" eSuperTypes="#//v2v/V2VOuput"/>
<eClassifiers xsi:type="ecore:EClass" name="V2VHandshakeInput" eSuperTypes="#//v2v/V2VInput"/>
</eSubpackages>
<eSubpackages name="parking" nsURI="http://www.fortiss.org/af3/platform/raspberry/parking"
nsPrefix="org-fortiss-af3-platform-raspberry-parking">
<eClassifiers xsi:type="ecore:EClass" name="ParkingInput" eSuperTypes="#//RaspberryPiReceiverBase"/>
</eSubpackages>
</ecore:EPackage>
......@@ -139,5 +139,9 @@
<genClasses ecoreClass="raspberry.ecore#//v2v/V2VLeaderUIDOutput"/>
<genClasses ecoreClass="raspberry.ecore#//v2v/V2VHandshakeInput"/>
</nestedGenPackages>
<nestedGenPackages prefix="Parking" basePackage="org.fortiss.af3.platform.raspberry.model"
disposableProviderFactory="true" ecorePackage="raspberry.ecore#//parking">
<genClasses ecoreClass="raspberry.ecore#//parking/ParkingInput"/>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
......@@ -51,6 +51,14 @@
genModel="model/raspberry.genmodel"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated raspberry -->
<package
uri="http://www.fortiss.org/af3/platform/raspberry/parking"
class="org.fortiss.af3.platform.raspberry.model.parking.ParkingPackage"
genModel="model/raspberry.genmodel"/>
</extension>
<extension
point="org.fortiss.tooling.kernel.modelElementCompositor">
<modelElementCompositor
......@@ -1278,5 +1286,19 @@
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.parking.ParkingInputTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.parking.ParkingInput">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.extension.parking.ParkingInputGeneratorExtension">
</objectClass>
</target>
</transformationProvider>
</extension>
</plugin>
......@@ -53,6 +53,7 @@ import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstr
import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingInput;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeStrong;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumbleMagnitudeWeak;
import org.fortiss.af3.platform.raspberry.model.rumblepad.RumblepadReceiverBase;
......@@ -95,7 +96,7 @@ public class RaspberryPiCompositor
CameraDetectionStateRight.class, CameraRoverRecognized.class, CameraRoverID.class,
CameraRoverDistance.class, CameraCurveDetected.class, CameraCurveRadius.class,
ControlCenterDownstreamInput.class, ControlCenterUpstreamOutput.class,
V2VInput.class, V2VOuput.class);
V2VInput.class, V2VOuput.class, ParkingInput.class);
if(container != null) {
final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class);
return instanceOfAny && instanceOfAny2;
......
CameraConnectedGeneratorExtension.java 8120718dd4e4858a0650346124bc20ec91cf1fb4 RED
CameraCurveDetectedGeneratorExtension.java 59ec8f4d48506dca51461b4af815cf1332ddabb2 RED
CameraCurveRadiusGeneratorExtension.java 7fe21256262219f12f23fd71142238b66ae6e77a RED
CameraDetectionStateLeftGeneratorExtension.java 1e16e08fbaf5174d6c72e370a05ebe61b29563c5 RED
CameraDetectionStateRightGeneratorExtension.java 51c7a9ac1b32957ba8ff95d40cd6c47ae8658ec0 RED
CameraDistanceLeftGeneratorExtension.java 717d1b1a242ea3d3b770d82713d8bf6b7ebdf938 RED
CameraDistanceRightGeneratorExtension.java 240fab2e83c0879be35def0347f260f6e98d7310 RED
CameraGeneratorExtensionBase.java a540169c67136514d0c24b24053259bb8845c861 RED
CameraLastUpdateGeneratorExtension.java 256cc4883dab48247a5a094f16268a75e06f2042 RED
CameraRoverDistanceGeneratorExtension.java d77c275bd2b74ed0cba3e00c33ed5738ccc2db47 RED
CameraRoverIDGeneratorExtension.java f03bf8ebe9ae77ebcd42d5c8534437171a7532b2 YELLOW
CameraRoverRecognizedGeneratorExtension.java 99fa682f7b5fbbab22d56c00c6219d5d03a6ac7f RED
CameraYawAngleGeneratorExtension.java 39f3c74554f64224a68caf3d763a4a892048d97c YELLOW
/*-------------------------------------------------------------------------+
| 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.extension.parking;
import static java.util.Arrays.asList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.platform.raspberry.generator.extension.library.PiHALLibraryGeneratorExtensionBase;
import org.fortiss.af3.platform.raspberry.generator.framework.IReadableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
/**
* Base class for all executables of the parking.
*
* @author ponce
*/
abstract class ParkingGeneratorExtensionBase<T extends EObject>
extends PiHALLibraryGeneratorExtensionBase<T> implements IReadableGeneratorExtension {
/** Constructor. */
public ParkingGeneratorExtensionBase(T modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public final String getSingletonVariableDeclarationCode() {
return null;
}
/** {@inheritDoc} */
@Override
public final String getSingletonAuxiliaryFunctions() {
return null;
}
/** {@inheritDoc} */
@Override
public final String getSingletonInitializationCode() {
if(modelElement.eContainer() instanceof RaspberryPi) {
RaspberryPi raspi = (RaspberryPi)modelElement.eContainer();
StringBuilder sb = new StringBuilder();
sb.append("parking_client_initialize(\"");
sb.append(raspi.getCameraServerAddress()).append("\", \"");
sb.append(raspi.getCameraServerPort()).append("\");\n\n");
return sb.toString();
}
return "FIXME(\"eContainer() of model element " + modelElement + " is not a RasPi\"";
}
/** {@inheritDoc} */
@Override
public final String getSingletonTerminationCode() {
return null;
}
/** {@inheritDoc} */
@Override
public final String getSingletonIdentifier() {
// use header file as singleton identifier
return "parking_client.h";
}
/** {@inheritDoc} */
@Override
public final List<String> getHeaderFileNames() {
return asList("parking_client.h");
}
/** {@inheritDoc} */
@Override
public final String getReadCode(InputPort logicalSignal, String targetVariable) {
return targetVariable + " = " + getParkingValueFunction() + ";\n";
}
/** {@inheritDoc} */
@Override
public final String getNoValReadCode(InputPort logicalSignal) {
return null;
}
/**
* Returns the function from parking_client.h, which is used by the
* {@link #getReadCode(InputPort, String)} method to generate the code.
*/
protected abstract String getParkingValueFunction();
}
/*-------------------------------------------------------------------------+
| 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.extension.parking;
import org.fortiss.af3.platform.raspberry.model.camera.CameraConnected;
/** Generator extension for {@link CameraConnected}. */
public class ParkingInputGeneratorExtension extends ParkingGeneratorExtensionBase<CameraConnected> {
/** Constructor. */
public ParkingInputGeneratorExtension(CameraConnected modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
protected String getParkingValueFunction() {
return "parking_client_is_connected()";
}
}
CameraConnectedTransformation.java bdd4f5cf9eca7bbf79867d8b1aca4977c801f659 YELLOW
CameraCurveDetectedTransformation.java 18eb10db754ec83355f1f8e9539c8e855e2084e0 RED
CameraCurveRadiusTransformation.java fd8fc03c6cdda4dfb7c637a35e2a30d734047412 RED
CameraDetectionStateLeftTransformation.java 2d318b61628f5bb7f585b6fa5ff1206ce9476765 YELLOW
CameraDetectionStateRightTransformation.java cc1cc18abbfc329714d84bcebb474ba0a566fc2a YELLOW
CameraDistanceLeftTransformation.java bea69e54961ee6866686b2842b57ce96115590aa YELLOW
CameraDistanceRightTransformation.java 09d3325b40777235e96e17faa95cfdd8edde675b YELLOW
CameraLastUpdateTransformation.java f9ebb2ff9edf13f245600ae3bd3fc6efbbad327b YELLOW
CameraRoverDistanceTransformation.java 7a5ec2617270222a65172cc7244adc7f8773b3fb RED
CameraRoverIDTransformation.java df63fdf01ed4c2381f8fb18cfb32ac2ea75ff977 RED
CameraRoverRecognizedTransformation.java 7ddd67427e7050390efb1db3451681627ac4c245 RED
CameraYawAngleTransformation.java 09d1552da1d8767152a2800997dee1e088ef9439 RED
/*-------------------------------------------------------------------------+
| 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.parking;
import org.fortiss.af3.platform.raspberry.generator.extension.parking.ParkingInputGeneratorExtension;
import org.fortiss.af3.platform.raspberry.generator.framework.RasPiGeneratorTransformationBase;
import org.fortiss.af3.platform.raspberry.model.camera.CameraConnected;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingInput;
/** Transformation for {@link CameraConnected}. */
public class ParkingInputTransformation extends RasPiGeneratorTransformationBase {
/** Constructor. */
public ParkingInputTransformation() {
super(ParkingInput.class, ParkingInputGeneratorExtension.class);
}
}
......@@ -68,6 +68,8 @@ import org.fortiss.af3.platform.raspberry.model.gamepad.Right_StickY_Position;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput;
import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorcontrolFactory;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingFactory;
import org.fortiss.af3.platform.raspberry.model.parking.ParkingInput;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonA;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonB;
import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonHome;
......@@ -845,4 +847,12 @@ public class RaspberryModelElementFactory {
createConnectorLayout(input);
return input;
}
/** Creates a {@link ParkingInput}. */
public static ParkingInput createParkingInput() {
ParkingInput input = ParkingFactory.eINSTANCE.createParkingInput();
input.setName("ParkingInput");
createConnectorLayout(input);
return input;
}
}
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