Skip to content
Snippets Groups Projects
Commit b4727043 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Several bugfixes for issue reported by the regression tester.

parent 03b8509f
No related branches found
No related tags found
No related merge requests found
Showing
with 299 additions and 13 deletions
......@@ -188,6 +188,45 @@
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.brick.AngularVelocityXSensorTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.extension.brick.AngularVelocityXSensorGeneratorExtension">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.brick.AngularVelocityYSensorTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.extension.brick.AngularVelocityYSensorGeneratorExtension">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.brick.AngularVelocityZSensorTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.extension.brick.AngularVelocityZSensorGeneratorExtension">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.motorcontrol.MotorControlInputTransformation">
<source>
......
......@@ -16,6 +16,7 @@
package org.fortiss.af3.platform.raspberry.generator.extension;
import static org.fortiss.af3.component.generator.c.ComponentProgramToCSourcePackageTransformation.getPortNoValIdentifier;
import static org.fortiss.af3.component.generator.component.ComponentFunctionIdentifierUtils.getInitializeFunctionName;
import static org.fortiss.af3.component.generator.component.PortVariableUtils.getPortIdentifier;
import static org.fortiss.af3.platform.raspberry.generator.templates.RasPiCTemplates.getSingleUnitMainCFile;
......@@ -380,6 +381,7 @@ class SingleUnitMainGenerator {
StringBuilder sb = new StringBuilder();
Set<String> singletonInitDone = new HashSet<>();
Set<String> sharedInitDone = new HashSet<>();
// initialize hardware
for(PlatformConnectorUnit pcu : platformConnector2ExecutableBase.keySet()) {
ExecutableBase<?> exec = platformConnector2ExecutableBase.get(pcu);
if(exec instanceof ISingletonGeneratorExtension) {
......@@ -405,7 +407,13 @@ class SingleUnitMainGenerator {
String code = initExec.getInstanceInitializationCode();
sb.append(code != null ? code : "");
}
// TODO: initialize logical code
}
// initialize logical component architecture
for(Pair<ExecutionUnit, Component> pair : deployedComponents) {
if(pair.getFirst() == executionUnit) {
String initFunction = getInitializeFunctionName(pair.getSecond());
sb.append(initFunction + "();\n");
}
}
return sb.toString();
}
......
AccelerationSensorGeneratorExtensionBase.java a499afe0c0bc7a073f5ed1674a6297387f00aabe YELLOW
AccelerationXSensorGeneratorExtension.java 56641462aff97b3d2ba7cc2e059ed902b3fbb8f9 YELLOW
AccelerationYSensorGeneratorExtension.java 222e5bf4c486b8231ee19b97aadeafed035aa7c7 YELLOW
AccelerationZSensorGeneratorExtension.java 14ae73d242d9e919c79dc4ce7f456b4359553227 YELLOW
AccelerationSensorGeneratorExtensionBase.java f4628cc8cdc65ddeb7f1a114dd061122bab00700 YELLOW
AccelerationXSensorGeneratorExtension.java 397561fbff97f02113cd66f9385a94d8dbc2e2d7 YELLOW
AccelerationYSensorGeneratorExtension.java e4f0d2af76e1cc83d1d6c2dd146a3a4464bb64bf YELLOW
AccelerationZSensorGeneratorExtension.java 1653b0761e74abd9f4688d2ddcb5a7e2acdbe061 YELLOW
ActuatorDigitsGeneratorExtension.java ae9ce7a8543694a47c28af91efa1678751cde432 YELLOW
AngularVelocityXSensorGeneratorExtension.java 542d7ee9631d7a4c8c762e9bf7465d335675757c YELLOW
AngularVelocityYSensorGeneratorExtension.java d155549d56da3cdfb67ecebdec65959bbbfebec9 YELLOW
AngularVelocityZSensorGeneratorExtension.java 25e8498a88d7acd8d4fa8e323f5f7f1701a3c171 YELLOW
BrickGeneratorExtensionBase.java 36cad3503e58775fb400509dde40f1f243e8db7a YELLOW
InstanceBrickGeneratorExtensionBase.java 571bdb29a3b2289232764286043e05f5ee8ee837 YELLOW
LEDButtonBActuatorGeneratorExtension.java d63faa3841e5105adec981d21d64efbc4894f526 RED
......
......@@ -118,11 +118,14 @@ abstract class AccelerationSensorGeneratorExtensionBase<T extends UIDUnit> exten
return sb.toString();
}
/** Returns the accelerometer sensor read code for the given variable. */
protected String getReadCode(String var, InputPort logicalSignal, String targetVariable) {
/**
* Returns the accelerometer sensor read code for the given variable and last callback variable.
*/
protected String getReadCode(String var, String cb_var, InputPort logicalSignal,
String targetVariable) {
String shared = getSharedInstancePostfix();
StringBuilder sb = new StringBuilder();
sb.append("if (((time_util_get_current_micros() - acc_last_cb_time_" + shared +
sb.append("if (((time_util_get_current_micros() - " + cb_var + shared +
") / (1.0 * SECONDS_IN_MICROS)) < 1.0) {\n");
String portNoValIdentifier = getPortNoValIdentifier(getPortIdentifier(logicalSignal));
sb.append(portNoValIdentifier + " = false;\n");
......
......@@ -35,7 +35,7 @@ public class AccelerationXSensorGeneratorExtension extends
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("acceleration_X_", logicalSignal, targetVariable);
return getReadCode("acceleration_X_", "acc_last_cb_time_", logicalSignal, targetVariable);
}
/** {@inheritDoc} */
......
......@@ -35,7 +35,7 @@ public class AccelerationYSensorGeneratorExtension extends
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("acceleration_Y_", logicalSignal, targetVariable);
return getReadCode("acceleration_Y_", "acc_last_cb_time_", logicalSignal, targetVariable);
}
/** {@inheritDoc} */
......
......@@ -35,7 +35,7 @@ public class AccelerationZSensorGeneratorExtension extends
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("acceleration_Z_", logicalSignal, targetVariable);
return getReadCode("acceleration_Z_", "acc_last_cb_time_", logicalSignal, targetVariable);
}
/** {@inheritDoc} */
......
/*-------------------------------------------------------------------------+
| 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.brick;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IReadableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
/**
* Generator extension for {@link AngularVelocityXSensor}s.
*
* @author hoelzl
*/
public class AngularVelocityXSensorGeneratorExtension extends
AccelerationSensorGeneratorExtensionBase<AngularVelocityXSensor> implements
IReadableGeneratorExtension {
/** Constructor. */
public AngularVelocityXSensorGeneratorExtension(AngularVelocityXSensor modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("angularVelocity_X_", "angV_last_cb_time_", logicalSignal,
targetVariable);
}
/** {@inheritDoc} */
@Override
public String getNoValReadCode(InputPort logicalSignal) {
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.generator.extension.brick;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IReadableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor;
/**
* Generator extension for {@link AngularVelocityYSensor}s.
*
* @author hoelzl
*/
public class AngularVelocityYSensorGeneratorExtension extends
AccelerationSensorGeneratorExtensionBase<AngularVelocityYSensor> implements
IReadableGeneratorExtension {
/** Constructor. */
public AngularVelocityYSensorGeneratorExtension(AngularVelocityYSensor modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("angularVelocity_Y_", "angV_last_cb_time_", logicalSignal,
targetVariable);
}
/** {@inheritDoc} */
@Override
public String getNoValReadCode(InputPort logicalSignal) {
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.generator.extension.brick;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IReadableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor;
/**
* Generator extension for {@link AngularVelocityZSensor}s.
*
* @author hoelzl
*/
public class AngularVelocityZSensorGeneratorExtension extends
AccelerationSensorGeneratorExtensionBase<AngularVelocityZSensor> implements
IReadableGeneratorExtension {
/** Constructor. */
public AngularVelocityZSensorGeneratorExtension(AngularVelocityZSensor modelElement) {
super(modelElement);
}
/** {@inheritDoc} */
@Override
public String getReadCode(InputPort logicalSignal, String targetVariable) {
return getReadCode("angularVelocity_Z_", "angV_last_cb_time_", logicalSignal,
targetVariable);
}
/** {@inheritDoc} */
@Override
public String getNoValReadCode(InputPort logicalSignal) {
return null;
}
}
......@@ -23,6 +23,6 @@ Right_StickYGeneratorExtension.java aa1065190dd041f21abc3e8498e902d55d0735dc YEL
RumbleMagnitudeGeneratorExtensionBase.java 7fb196ca870a07da99968a9257d8760e2ba39eaf RED
RumbleMagnitudeStrongGeneratorExtension.java 62e21ccc18fa1d8575de433668decd95af742fe9 RED
RumbleMagnitudeWeakGeneratorExtension.java 1dabbf3802aee823da5f0230662bcd24ea81d931 RED
RumblepadGeneratorExtensionBase.java 0111558165a54522a52025cd9bed15f2a26845a7 YELLOW
RumblepadGeneratorExtensionBase.java f937fb7d99e62a5ee0a2a92c826b825ec62f312f YELLOW
SimpleRumbleFeatureGeneratorExtension.java 83f43f60a69da3223ce3be8ab7f9b0049a74cf0d RED
StickGeneratorExtensionBase.java 7e368fae81424aebece79a0c9c88748fa7a97c1a YELLOW
......@@ -48,9 +48,13 @@ abstract class RumblepadGeneratorExtensionBase<T extends EObject> extends
public final String getSingletonInitializationCode() {
String postfixedVar = "rumblepad_config_" + getSingletonPostfix();
StringBuilder sb = new StringBuilder();
sb.append("while(access(\"/dev/input/event0\", F_OK) == -1) {\n");
sb.append("sleep(1);\n");
sb.append("printf(\"Could not access gamepad device. Trying again in 1s.\\n\");\n");
sb.append("}\n");
sb.append("// initialize the rumblepad configuration\n");
sb.append(postfixedVar + " = malloc(sizeof(rumblepad_configuration_t));\n");
sb.append(postfixedVar + "->device_id = \"/dev/input/js0\";\n");
sb.append(postfixedVar + "->device_id = \"/dev/input/event0\";\n");
sb.append(postfixedVar + "->waiting_sleep_in_micros = 50;\n");
sb.append(postfixedVar + "->axis_callback = NULL;\n");
sb.append(postfixedVar + "->button_callback = NULL;\n");
......
......@@ -2,6 +2,9 @@ AccelerationXSensorTransformation.java c89963f856ff04c5a3a24cba5e2bbaa171d93ee5
AccelerationYSensorTransformation.java 9632bfb5a70cc805db21f8a8f6be7430069f0138 YELLOW
AccelerationZSensorTransformation.java 30582a28456a8f9cbc0aad14016353c13cec8627 YELLOW
ActuatorDigitsTransformation.java 7b7b0fb3f185cd05ae4f45766366bc2e6c2e872a YELLOW
AngularVelocityXSensorTransformation.java 9e214fb1217906f700f8096e40aec2fcaa23c0bd YELLOW
AngularVelocityYSensorTransformation.java 9fac1020dd01bc56fee093f2eb8ae44b423e4348 YELLOW
AngularVelocityZSensorTransformation.java 3a5a06388bbbb8aeecd688b5cdd650321a18622d YELLOW
LEDButtonBActuatorTransformation.java 5d1821cb7b952132c2d22ab6e38306cafd276f2d YELLOW
LEDButtonGActuatorTransformation.java 78be0fdb2fa5921ddb29cbd8f2ae7c17b2a60f81 YELLOW
LEDButtonRActuatorTransformation.java 38a10a58049ffd687129a1336b58da6fc6a6928c 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.transform.brick;
import org.fortiss.af3.platform.raspberry.generator.extension.brick.AngularVelocityXSensorGeneratorExtension;
import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
/** Transformation for {@link AngularVelocityXSensor}. */
public class AngularVelocityXSensorTransformation extends RasPiGeneratorTransformationBase {
/** Constructor. */
public AngularVelocityXSensorTransformation() {
super(AngularVelocityXSensor.class, AngularVelocityXSensorGeneratorExtension.class);
}
}
/*-------------------------------------------------------------------------+
| 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.extension.brick.AngularVelocityYSensorGeneratorExtension;
import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor;
/** Transformation for {@link AngularVelocityYSensor}. */
public class AngularVelocityYSensorTransformation extends RasPiGeneratorTransformationBase {
/** Constructor. */
public AngularVelocityYSensorTransformation() {
super(AngularVelocityYSensor.class, AngularVelocityYSensorGeneratorExtension.class);
}
}
/*-------------------------------------------------------------------------+
| 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.extension.brick.AngularVelocityZSensorGeneratorExtension;
import org.fortiss.af3.platform.raspberry.generator.transform.RasPiGeneratorTransformationBase;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor;
/** Transformation for {@link AngularVelocityXSensor}. */
public class AngularVelocityZSensorTransformation extends RasPiGeneratorTransformationBase {
/** Constructor. */
public AngularVelocityZSensorTransformation() {
super(AngularVelocityZSensor.class, AngularVelocityZSensorGeneratorExtension.class);
}
}
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