Bug 579884 - [Robotics, ROS2] Support Python code generation
- Bugfixes
- generated _main does not instantiate _impl constructor
- correct dependencies (e.g. main imports _impl and not vice versa, qos).
- use True/False instead of true/false for boolean values
- Constructor of _impl does not call superclass constructor
- initParameterVars: self is missing before var, value is returned, not 2nd param.
- Don't apply and use C++ profile any more => remove C++ stereotype application
from CodeSkeleton in codegen common
- Use absolute (instead of relative) path names in import
- Fix calls in test example
Change-Id: I89f818f519fba23e2a168bd57446e6a683002eaa
Signed-off-by: aradermache <ansgar.radermacher@cea.fr>
diff --git a/plugins/codegen/org.eclipse.papyrus.robotics.codegen.common/src/org/eclipse/papyrus/robotics/codegen/common/component/CodeSkeleton.xtend b/plugins/codegen/org.eclipse.papyrus.robotics.codegen.common/src/org/eclipse/papyrus/robotics/codegen/common/component/CodeSkeleton.xtend
index 66f171e..a4eeb95 100644
--- a/plugins/codegen/org.eclipse.papyrus.robotics.codegen.common/src/org/eclipse/papyrus/robotics/codegen/common/component/CodeSkeleton.xtend
+++ b/plugins/codegen/org.eclipse.papyrus.robotics.codegen.common/src/org/eclipse/papyrus/robotics/codegen/common/component/CodeSkeleton.xtend
@@ -14,23 +14,27 @@
package org.eclipse.papyrus.robotics.codegen.common.component
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.ConstInit
import org.eclipse.papyrus.robotics.profile.robotics.functions.Function
import org.eclipse.uml2.uml.Behavior
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Operation
-import org.eclipse.uml2.uml.util.UMLUtil
import static extension org.eclipse.papyrus.robotics.codegen.common.utils.ActivityUtils.*
/**
- * Create a template for the code that needs to be filled by a developer.
- *
+ * Create a template for the implementation class that needs to be filled
+ * by a developer.
*/
abstract class CodeSkeleton {
public static String POSTFIX = "_impl"
- def createSkeleton(Class component) {
+ protected Class component;
+
+ new(Class component) {
+ this.component = component;
+ }
+
+ def createSkeleton() {
val skeleton = component.nearestPackage.createOwnedClass(component.name + POSTFIX, false);
val comment = skeleton.createOwnedComment()
comment.body = '''
@@ -38,16 +42,11 @@
Copy it into the source folder as an initial base (or copy parts
of it whenever you add modify the component).
'''
- // generated code uses template - it needs to instantiate and block ...
- component.createUsage(skeleton);
// template inherits from generated component code
skeleton.createGeneralization(component);
// create a suitable constructor
- val op = skeleton.addConstrOp
- if (op !== null) {
- val constInit = UMLUtil.getStereotypeApplication(op, ConstInit)
- constInit.initialisation = '''«component.name»(options)'''
- }
+ skeleton.addConstrOp
+
for (activity : component.activities) {
for (function : activity.functions) {
if (!function.codeInModel) {
diff --git a/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/periodicpublishercompdef/periodicpublisher_impl.py b/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/periodicpublishercompdef/periodicpublisher_impl.py
index 636198b..a6d4090 100644
--- a/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/periodicpublishercompdef/periodicpublisher_impl.py
+++ b/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/periodicpublishercompdef/periodicpublisher_impl.py
@@ -6,19 +6,19 @@
# maintained by maintainer
# maintainer@somewhere.net
-from periodicpublisher import PeriodicPublisher
-
+from py_publishsubscribe_extcode.periodicpublishercompdef.periodicpublisher import PeriodicPublisher
+from simple_msgs.msg import Map
class PeriodicPublisher_impl(PeriodicPublisher):
def __init__(self, options):
- pass
+ super().__init__(options)
def fPublishing(self):
- transMap = Map
- transMap.omg.width = 16
- transMap.omg.height = 16
- transMap.omg.resolution = 0.1
+ transMap = Map()
+ transMap.ogm.width = 16
+ transMap.ogm.height = 16
+ transMap.ogm.resolution = 0.1
self.get_logger().info('Publishing map...')
- self.pMap_pMap_pubpub.publish(transMap)
+ self.pMap_pub_.publish(transMap)
diff --git a/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/subscribercompdef/subscriber_impl.py b/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/subscribercompdef/subscriber_impl.py
index 9cea029..0227699 100644
--- a/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/subscribercompdef/subscriber_impl.py
+++ b/plugins/examples/org.eclipse.papyrus.robotics.ros2.examples/testmodels/py_publishSubscribe_extcode/py_publishsubscribe_extcode/subscribercompdef/subscriber_impl.py
@@ -6,17 +6,15 @@
# maintained by maintainer
# maintainer@somewhere.net
-from subscriber import Subscriber
-
+from py_publishsubscribe_extcode.subscribercompdef.subscriber import Subscriber
class Subscriber_impl(Subscriber):
def __init__(self, options):
- pass
+ super().__init__(options)
def fListening(self, commobj):
print("Map data received")
print("width: " + str(commobj.ogm.width))
print("height: " + str(commobj.ogm.height))
print("resolution: " + str(commobj.ogm.resolution))
-
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/RosTransformations.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/RosTransformations.xtend
index 254d0b6..bb459d7 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/RosTransformations.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/RosTransformations.xtend
@@ -116,6 +116,7 @@
// assure that Common and C++ profiles is applied
EnvironmentUtils.waitForSetupJob
ApplyProfiles.applyCommonProfile(rootPkg)
+ // TODO: remove C++ profile
ApplyProfiles.applyCppProfile(rootPkg)
msgPkgCreator = new CreateMsgPackage();
if (StereotypeUtil.isApplied(rootPkg, ServiceDefinitionModel)) {
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/launch/LaunchScript.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/launch/LaunchScript.xtend
index 71eb4e2..2d7b334 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/launch/LaunchScript.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.common/src/org/eclipse/papyrus/robotics/ros2/codegen/common/launch/LaunchScript.xtend
@@ -93,7 +93,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# «ProtSection.protSection("post-launch")»
# «ProtSection.protSection»
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/ComponentTransformations.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/ComponentTransformations.xtend
index 7c6a664..131367e 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/ComponentTransformations.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/ComponentTransformations.xtend
@@ -187,7 +187,7 @@
component.createMain;
if (component.hasExternalCode) {
- new Ros2CodeSkeleton().createSkeleton(component);
+ new Ros2CodeSkeleton(component).createSkeleton();
}
// val stdString = getType(node, "ros2Library::std_msgs::String");
// node.createDependency(stdString)
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/Ros2CodeSkeleton.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/Ros2CodeSkeleton.xtend
index 7faf6e2..59f919b 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/Ros2CodeSkeleton.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.cpp/src/org/eclipse/papyrus/robotics/ros2/codegen/cpp/component/Ros2CodeSkeleton.xtend
@@ -17,14 +17,29 @@
import org.eclipse.papyrus.robotics.codegen.common.component.CodeSkeleton
import org.eclipse.uml2.uml.Class
import org.eclipse.papyrus.robotics.profile.robotics.functions.Function
+import org.eclipse.uml2.uml.util.UMLUtil
+import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.ConstInit
/**
* Create a template for the code that needs to be filled by a developer.
*
*/
class Ros2CodeSkeleton extends CodeSkeleton {
+
+ new(Class component) {
+ super(component);
+ }
+
override addConstrOp(Class skeleton) {
- return Constructor.addConstrOp(skeleton);
+ val constructorOp = Constructor.addConstrOp(skeleton);
+ if (constructorOp !== null) {
+ val constInit = UMLUtil.getStereotypeApplication(constructorOp, ConstInit)
+ // TODO - remove C++ specific code from common part
+ if (constInit !== null) {
+ constInit.initialisation = '''«component.name»(options)'''
+ }
+ }
+ return constructorOp
}
override moveFunction(Class skeleton, Function function) {
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/META-INF/MANIFEST.MF b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/META-INF/MANIFEST.MF
index 7ae7b00..27c0429 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/META-INF/MANIFEST.MF
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/META-INF/MANIFEST.MF
@@ -5,10 +5,8 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.designer.transformation.core;bundle-version="0.7.0",
org.eclipse.uml2.uml;bundle-version="4.0.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.4.0,5.0.0)",
org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,3.0.0)",
org.eclipse.core.resources,
- org.eclipse.papyrus.designer.languages.cpp.profile;bundle-version="0.7.0",
com.google.guava;bundle-version="11.0.0",
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/models/library/rclpy.notation b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/models/library/rclpy.notation
index e318899..9197c2c 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/models/library/rclpy.notation
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/models/library/rclpy.notation
@@ -556,52 +556,52 @@
<children xmi:type="notation:DecorationNode" xmi:id="_kwfYs-4dEey3buyMmxEJ_w" type="Class_FloatingNameLabel_CN">
<layoutConstraint xmi:type="notation:Location" xmi:id="_kwfYtO4dEey3buyMmxEJ_w" y="15"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYte4dEey3buyMmxEJ_w" type="Class_AttributeCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYte4dEey3buyMmxEJ_w" visible="false" type="Class_AttributeCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_kwfYtu4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_kwfYt-4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_kwfYuO4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_kwfYue4dEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYuu4dEey3buyMmxEJ_w" type="Class_OperationCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYuu4dEey3buyMmxEJ_w" visible="false" type="Class_OperationCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_kwfYu-4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_kwfYvO4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_kwfYve4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_kwfYvu4dEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYv-4dEey3buyMmxEJ_w" type="Class_NestedClassifierCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_kwfYv-4dEey3buyMmxEJ_w" visible="false" type="Class_NestedClassifierCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_kwfYwO4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_kwfYwe4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_kwfYwu4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_kwfYw-4dEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Class" href="rclpy.uml#_kwVnsO4dEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kwfYse4dEey3buyMmxEJ_w" x="34" y="23"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kwfYse4dEey3buyMmxEJ_w" x="34" y="23" width="121" height="54"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_uh-g4e4dEey3buyMmxEJ_w" type="Class_Shape">
<children xmi:type="notation:DecorationNode" xmi:id="_uh-g4-4dEey3buyMmxEJ_w" type="Class_NameLabel"/>
<children xmi:type="notation:DecorationNode" xmi:id="_uiIR4O4dEey3buyMmxEJ_w" type="Class_FloatingNameLabel">
<layoutConstraint xmi:type="notation:Location" xmi:id="_uiIR4e4dEey3buyMmxEJ_w" y="15"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR4u4dEey3buyMmxEJ_w" type="Class_AttributeCompartment">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR4u4dEey3buyMmxEJ_w" visible="false" type="Class_AttributeCompartment">
<styles xmi:type="notation:TitleStyle" xmi:id="_uiIR4-4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_uiIR5O4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_uiIR5e4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_uiIR5u4dEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR5-4dEey3buyMmxEJ_w" type="Class_OperationCompartment">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR5-4dEey3buyMmxEJ_w" visible="false" type="Class_OperationCompartment">
<styles xmi:type="notation:TitleStyle" xmi:id="_uiIR6O4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_uiIR6e4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_uiIR6u4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_uiIR6-4dEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR7O4dEey3buyMmxEJ_w" type="Class_NestedClassifierCompartment">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_uiIR7O4dEey3buyMmxEJ_w" visible="false" type="Class_NestedClassifierCompartment">
<styles xmi:type="notation:TitleStyle" xmi:id="_uiIR7e4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_uiIR7u4dEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_uiIR7-4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_uiIR8O4dEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Class" href="rclpy.uml#_uh-g4O4dEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_uh-g4u4dEey3buyMmxEJ_w" x="174" y="23" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_uh-g4u4dEey3buyMmxEJ_w" x="174" y="23" width="121" height="54"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_xeO2oO4dEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_xeO2ou4dEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -615,7 +615,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_xeO2qe4dEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_xeFFoO4dEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xeO2oe4dEey3buyMmxEJ_w" x="314" y="23" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xeO2oe4dEey3buyMmxEJ_w" x="314" y="23" width="121" height="54"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_3av4YO4dEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_3av4Yu4dEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -629,7 +629,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_3av4ae4dEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_3amHYO4dEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3av4Ye4dEey3buyMmxEJ_w" x="314" y="263" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3av4Ye4dEey3buyMmxEJ_w" x="314" y="176" width="121" height="61"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_FRaGMO4eEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_FRaGMu4eEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -643,7 +643,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRaGOe4eEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_FRQ8QO4eEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRaGMe4eEey3buyMmxEJ_w" x="34" y="143" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRaGMe4eEey3buyMmxEJ_w" x="34" y="96" width="121" height="61"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_G8-QIO4eEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_G8-QIu4eEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -657,7 +657,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_G8-QKe4eEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_G81GMO4eEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_G8-QIe4eEey3buyMmxEJ_w" x="34" y="263" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_G8-QIe4eEey3buyMmxEJ_w" x="34" y="176" width="121" height="61"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_IroKUO4eEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_IroKUu4eEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -671,7 +671,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_IroKWe4eEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_IrfAYO4eEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_IroKUe4eEey3buyMmxEJ_w" x="174" y="263" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_IroKUe4eEey3buyMmxEJ_w" x="174" y="176" width="121" height="61"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_KR6LoO4eEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_KR6Lou4eEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -685,7 +685,7 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_KR6Lqe4eEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_KRwaoO4eEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_KR6Loe4eEey3buyMmxEJ_w" x="314" y="143" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_KR6Loe4eEey3buyMmxEJ_w" x="314" y="96" width="121" height="61"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_NHTEYO4eEey3buyMmxEJ_w" type="Enumeration_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_NHTEYu4eEey3buyMmxEJ_w" type="Enumeration_NameLabel_CN"/>
@@ -699,21 +699,21 @@
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_NHTEae4eEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Enumeration" href="rclpy.uml#_NHJTYO4eEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_NHTEYe4eEey3buyMmxEJ_w" x="174" y="143" width="121"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_NHTEYe4eEey3buyMmxEJ_w" x="174" y="96" width="121" height="61"/>
</children>
<styles xmi:type="notation:TitleStyle" xmi:id="_jLw2lO4dEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_jLw2le4dEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Package" href="rclpy.uml#_jLnsoO4dEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jLw2ke4dEey3buyMmxEJ_w" x="240" y="280" width="481" height="341"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jLw2ke4dEey3buyMmxEJ_w" x="60" y="40" width="501" height="321"/>
</children>
- <children xmi:type="notation:Shape" xmi:id="_JtsXau42EeyXmJbnrjBfXQ" type="StereotypeComment">
- <styles xmi:type="notation:TitleStyle" xmi:id="_JtsXa-42EeyXmJbnrjBfXQ"/>
- <styles xmi:type="notation:EObjectValueStyle" xmi:id="_JtsXbe42EeyXmJbnrjBfXQ" name="BASE_ELEMENT">
+ <children xmi:type="notation:Shape" xmi:id="_9ws_0KlUEe2LQoLntInr8Q" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_9ws_0alUEe2LQoLntInr8Q"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_9ws_06lUEe2LQoLntInr8Q" name="BASE_ELEMENT">
<eObjectValue xmi:type="uml:Package" href="rclpy.uml#_jLnsoO4dEey3buyMmxEJ_w"/>
</styles>
<element xsi:nil="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_JtsXbO42EeyXmJbnrjBfXQ" x="440" y="280"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_9ws_0qlUEe2LQoLntInr8Q" x="440" y="280"/>
</children>
<styles xmi:type="notation:StringValueStyle" xmi:id="_YzA6Ee4dEey3buyMmxEJ_w" name="diagram_compatibility_version" stringValue="1.4.0"/>
<styles xmi:type="notation:DiagramStyle" xmi:id="_YzA6Eu4dEey3buyMmxEJ_w"/>
@@ -721,15 +721,15 @@
<owner xmi:type="uml:Model" href="rclpy.uml#_21YB0O4aEey3buyMmxEJ_w"/>
</styles>
<element xmi:type="uml:Model" href="rclpy.uml#_21YB0O4aEey3buyMmxEJ_w"/>
- <edges xmi:type="notation:Connector" xmi:id="_JtsXbu42EeyXmJbnrjBfXQ" type="StereotypeCommentLink" source="_jLw2kO4dEey3buyMmxEJ_w" target="_JtsXau42EeyXmJbnrjBfXQ">
- <styles xmi:type="notation:FontStyle" xmi:id="_JtsXb-42EeyXmJbnrjBfXQ"/>
- <styles xmi:type="notation:EObjectValueStyle" xmi:id="_JtsXc-42EeyXmJbnrjBfXQ" name="BASE_ELEMENT">
+ <edges xmi:type="notation:Connector" xmi:id="_9ws_1KlUEe2LQoLntInr8Q" type="StereotypeCommentLink" source="_jLw2kO4dEey3buyMmxEJ_w" target="_9ws_0KlUEe2LQoLntInr8Q">
+ <styles xmi:type="notation:FontStyle" xmi:id="_9ws_1alUEe2LQoLntInr8Q"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_9wtm4qlUEe2LQoLntInr8Q" name="BASE_ELEMENT">
<eObjectValue xmi:type="uml:Package" href="rclpy.uml#_jLnsoO4dEey3buyMmxEJ_w"/>
</styles>
<element xsi:nil="true"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_JtsXcO42EeyXmJbnrjBfXQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_JtsXce42EeyXmJbnrjBfXQ"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_JtsXcu42EeyXmJbnrjBfXQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9ws_1qlUEe2LQoLntInr8Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9wtm4KlUEe2LQoLntInr8Q"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9wtm4alUEe2LQoLntInr8Q"/>
</edges>
</notation:Diagram>
<notation:Diagram xmi:id="_mrsrsO4eEey3buyMmxEJ_w" type="PapyrusUMLClassDiagram" name="time_module" measurementUnit="Pixel">
@@ -802,66 +802,66 @@
<children xmi:type="notation:DecorationNode" xmi:id="_NRiwFO4fEey3buyMmxEJ_w" type="Class_FloatingNameLabel_CN">
<layoutConstraint xmi:type="notation:Location" xmi:id="_NRiwFe4fEey3buyMmxEJ_w" y="15"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwFu4fEey3buyMmxEJ_w" type="Class_AttributeCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwFu4fEey3buyMmxEJ_w" visible="false" type="Class_AttributeCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_NRiwF-4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_NRiwGO4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_NRiwGe4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_NRiwGu4fEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwG-4fEey3buyMmxEJ_w" type="Class_OperationCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwG-4fEey3buyMmxEJ_w" visible="false" type="Class_OperationCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_NRiwHO4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_NRiwHe4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_NRiwHu4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_NRiwH-4fEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwIO4fEey3buyMmxEJ_w" type="Class_NestedClassifierCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_NRiwIO4fEey3buyMmxEJ_w" visible="false" type="Class_NestedClassifierCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_NRiwIe4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_NRiwIu4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_NRiwI-4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_NRiwJO4fEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Class" href="rclpy.uml#_NRiwEO4fEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_NRiwEu4fEey3buyMmxEJ_w" x="14" y="17"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_NRiwEu4fEey3buyMmxEJ_w" x="34" y="17" height="60"/>
</children>
<children xmi:type="notation:Shape" xmi:id="_N42Aoe4fEey3buyMmxEJ_w" type="Class_Shape_CN">
<children xmi:type="notation:DecorationNode" xmi:id="_N42Ao-4fEey3buyMmxEJ_w" type="Class_NameLabel_CN"/>
<children xmi:type="notation:DecorationNode" xmi:id="_N42ApO4fEey3buyMmxEJ_w" type="Class_FloatingNameLabel_CN">
<layoutConstraint xmi:type="notation:Location" xmi:id="_N42Ape4fEey3buyMmxEJ_w" y="15"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_N42Apu4fEey3buyMmxEJ_w" type="Class_AttributeCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N42Apu4fEey3buyMmxEJ_w" visible="false" type="Class_AttributeCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_N42Ap-4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_N42AqO4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_N42Aqe4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_N42Aqu4fEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_N42Aq-4fEey3buyMmxEJ_w" type="Class_OperationCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N42Aq-4fEey3buyMmxEJ_w" visible="false" type="Class_OperationCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_N42ArO4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_N42Are4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_N42Aru4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_N42Ar-4fEey3buyMmxEJ_w"/>
</children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_N42AsO4fEey3buyMmxEJ_w" type="Class_NestedClassifierCompartment_CN">
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N42AsO4fEey3buyMmxEJ_w" visible="false" type="Class_NestedClassifierCompartment_CN">
<styles xmi:type="notation:TitleStyle" xmi:id="_N42Ase4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:SortingStyle" xmi:id="_N42Asu4fEey3buyMmxEJ_w"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_N42As-4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_N42AtO4fEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Class" href="rclpy.uml#_N42AoO4fEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N42Aou4fEey3buyMmxEJ_w" x="134" y="17"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N42Aou4fEey3buyMmxEJ_w" x="174" y="17" height="60"/>
</children>
<styles xmi:type="notation:TitleStyle" xmi:id="_LDGile4fEey3buyMmxEJ_w"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_LDGilu4fEey3buyMmxEJ_w"/>
</children>
<element xmi:type="uml:Package" href="rclpy.uml#_LDGikO4fEey3buyMmxEJ_w"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_LDGiku4fEey3buyMmxEJ_w" x="160" y="180" width="281" height="201"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_LDGiku4fEey3buyMmxEJ_w" x="80" y="80" width="321" height="161"/>
</children>
- <children xmi:type="notation:Shape" xmi:id="_-lPo0Aj7Ee2-xOjQ3SYv9w" type="StereotypeComment">
- <styles xmi:type="notation:TitleStyle" xmi:id="_-lPo0Qj7Ee2-xOjQ3SYv9w"/>
- <styles xmi:type="notation:EObjectValueStyle" xmi:id="_-lPo0wj7Ee2-xOjQ3SYv9w" name="BASE_ELEMENT">
+ <children xmi:type="notation:Shape" xmi:id="_3RrcA6lWEe2LQoLntInr8Q" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_3RrcBKlWEe2LQoLntInr8Q"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3RsDEKlWEe2LQoLntInr8Q" name="BASE_ELEMENT">
<eObjectValue xmi:type="uml:Package" href="rclpy.uml#_LDGikO4fEey3buyMmxEJ_w"/>
</styles>
<element xsi:nil="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-lPo0gj7Ee2-xOjQ3SYv9w" x="360" y="180"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3RrcBalWEe2LQoLntInr8Q" x="360" y="180"/>
</children>
<styles xmi:type="notation:StringValueStyle" xmi:id="_HbgJwe4fEey3buyMmxEJ_w" name="diagram_compatibility_version" stringValue="1.4.0"/>
<styles xmi:type="notation:DiagramStyle" xmi:id="_HbgJwu4fEey3buyMmxEJ_w"/>
@@ -869,15 +869,15 @@
<owner xmi:type="uml:Model" href="rclpy.uml#_21YB0O4aEey3buyMmxEJ_w"/>
</styles>
<element xmi:type="uml:Model" href="rclpy.uml#_21YB0O4aEey3buyMmxEJ_w"/>
- <edges xmi:type="notation:Connector" xmi:id="_-lPo1Aj7Ee2-xOjQ3SYv9w" type="StereotypeCommentLink" source="_LDGike4fEey3buyMmxEJ_w" target="_-lPo0Aj7Ee2-xOjQ3SYv9w">
- <styles xmi:type="notation:FontStyle" xmi:id="_-lPo1Qj7Ee2-xOjQ3SYv9w"/>
- <styles xmi:type="notation:EObjectValueStyle" xmi:id="_-lQP4gj7Ee2-xOjQ3SYv9w" name="BASE_ELEMENT">
+ <edges xmi:type="notation:Connector" xmi:id="_3RsDEalWEe2LQoLntInr8Q" type="StereotypeCommentLink" source="_LDGike4fEey3buyMmxEJ_w" target="_3RrcA6lWEe2LQoLntInr8Q">
+ <styles xmi:type="notation:FontStyle" xmi:id="_3RsDEqlWEe2LQoLntInr8Q"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_3RsDFqlWEe2LQoLntInr8Q" name="BASE_ELEMENT">
<eObjectValue xmi:type="uml:Package" href="rclpy.uml#_LDGikO4fEey3buyMmxEJ_w"/>
</styles>
<element xsi:nil="true"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_-lPo1gj7Ee2-xOjQ3SYv9w" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_-lQP4Aj7Ee2-xOjQ3SYv9w"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_-lQP4Qj7Ee2-xOjQ3SYv9w"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3RsDE6lWEe2LQoLntInr8Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3RsDFKlWEe2LQoLntInr8Q"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3RsDFalWEe2LQoLntInr8Q"/>
</edges>
</notation:Diagram>
<notation:Diagram xmi:id="_iy4woO4qEeyyq6rTvdmD_g" type="PapyrusUMLClassDiagram" name="subscription_module" measurementUnit="Pixel">
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompPackageXML.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompPackageXML.xtend
index b672111..49de5c1 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompPackageXML.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompPackageXML.xtend
@@ -19,7 +19,7 @@
import java.util.List
import org.eclipse.papyrus.designer.languages.common.base.file.IPFileSystemAccess
import org.eclipse.papyrus.robotics.ros2.codegen.common.utils.MessageUtils
-import org.eclipse.papyrus.uml.tools.utils.PackageUtil
+import org.eclipse.papyrus.designer.uml.tools.utils.PackageUtil
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Package
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupConfig.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupConfig.xtend
index 9ccf092..b3e55c3 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupConfig.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupConfig.xtend
@@ -4,13 +4,14 @@
import org.eclipse.papyrus.designer.languages.common.base.file.IPFileSystemAccess
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Package
+import static extension org.eclipse.papyrus.robotics.codegen.common.utils.PackageTools.pkgName
class CreateCompSetupConfig {
def static createSetupCfgfile(Package pkg, List<Class> allComponents, List<Class> componentsInPkg, Class system)'''
[develop]
- script_dir=$base/lib/«system.name»
+ script_dir=$base/lib/«pkg.pkgName»
[install]
- install_scripts=$base/lib/«system.name»
+ install_scripts=$base/lib/«pkg.pkgName»
'''
static def generate(IPFileSystemAccess fileAccess, Package pkg, List<Class> allComponents, List<Class> componentsInPkg, Class system) {
fileAccess.generateFile("setup.cfg", createSetupCfgfile(pkg, allComponents, componentsInPkg, system).toString)
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupPy.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupPy.xtend
index ab228f7..1a19cc0 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupPy.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/build/CreateCompSetupPy.xtend
@@ -4,12 +4,11 @@
import org.eclipse.papyrus.designer.languages.common.base.file.IPFileSystemAccess
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Package
+import org.eclipse.emf.common.util.UniqueEList
import static extension org.eclipse.papyrus.robotics.codegen.common.utils.PackageTools.pkgName
import static extension org.eclipse.papyrus.robotics.ros2.codegen.common.utils.PackageXMLUtils.*
-import org.eclipse.uml2.uml.Namespace
-import org.eclipse.papyrus.designer.infra.base.StringConstants
-import org.eclipse.uml2.uml.NamedElement
+import static extension org.eclipse.papyrus.designer.languages.python.codegen.transformation.PythonCodeGenUtils.getPythonQName
class CreateCompSetupPy {
def static createSetupfile(Package pkg, List<Class> allComponents, List<Class> componentsInPkg, Class system)'''
@@ -21,7 +20,7 @@
setup(
name=package_name,
version='0.0.0',
- packages=[package_name],
+ packages=[package_name, «FOR compPkg : componentsInPkg.usedPackages SEPARATOR ', '»'«pkg.pkgName».«compPkg.name.toLowerCase»'«ENDFOR»],
data_files = [
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
@@ -40,17 +39,22 @@
entry_points={
'console_scripts': [
«FOR component : componentsInPkg»
- '«component.name»_node = «pkg.pkgName».«component.toPythonQName»_main:main',
+ '«component.name» = «pkg.pkgName».«component.getPythonQName»_main:main',
«ENDFOR»
]
}
)
'''
- static def toPythonQName(NamedElement ne) {
- return ne.qualifiedName.replace(Namespace.SEPARATOR, StringConstants.DOT).toLowerCase
+ protected static def usedPackages(List<Class> componentsInPkg) {
+ val pkgs = new UniqueEList<Package>()
+ for (component : componentsInPkg) {
+ pkgs.add(component.nearestPackage)
+ }
+ return pkgs
}
+
static def generate(IPFileSystemAccess fileAccess, Package pkg, List<Class> allComponents, List<Class> componentsInPkg, Class system) {
fileAccess.generateFile("setup.py", createSetupfile(pkg, allComponents, componentsInPkg, system).toString)
}
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Callbacks.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Callbacks.xtend
index 0a5e518..6de3717 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Callbacks.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Callbacks.xtend
@@ -16,16 +16,12 @@
import org.eclipse.papyrus.designer.languages.common.profile.Codegen.NoCodeGen
import org.eclipse.papyrus.designer.languages.common.profile.Codegen.TemplateBinding
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.Const
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.External
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.Ptr
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.Ref
import org.eclipse.papyrus.designer.transformation.base.utils.TransformationException
import org.eclipse.papyrus.robotics.codegen.common.utils.ApplyProfiles
import org.eclipse.papyrus.robotics.core.utils.FunctionUtils
import org.eclipse.papyrus.robotics.profile.robotics.components.ActivityPort
import org.eclipse.papyrus.robotics.profile.robotics.functions.FunctionKind
-import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil
+import org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil
import org.eclipse.uml2.uml.Behavior
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Package
@@ -39,8 +35,8 @@
import static extension org.eclipse.papyrus.robotics.core.utils.InteractionUtils.*
import static extension org.eclipse.papyrus.robotics.ros2.codegen.common.utils.MessageUtils.*
import static extension org.eclipse.papyrus.robotics.ros2.codegen.common.utils.RosHelpers.*
-import static extension org.eclipse.papyrus.uml.tools.utils.StereotypeUtil.apply
-import static extension org.eclipse.papyrus.uml.tools.utils.StereotypeUtil.applyApp
+import static extension org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil.apply
+import static extension org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil.applyApp
/**
* provide the callback functions (via bind) for the various kind of ports
@@ -67,9 +63,7 @@
// use commObject name as parameter
fctCopy.specification.createOwnedParameter("commobj", port.commObject)
- return '''
- self.«fct.name»
- '''
+ return '''self.«fct.name»'''
}
}
@@ -89,8 +83,6 @@
ApplyProfiles.applyCommonProfile(resultParam)
val resultTpl = resultParam.applyApp(TemplateBinding)
resultTpl.actuals.add(port.serviceType)
- val resultParamPtr = resultParam.applyApp(Ptr)
- resultParamPtr.declaration = "::SharedFuture"
}
}
@@ -107,21 +99,14 @@
val fctCopy = component.getOwnedBehavior(fct.name)
if (fctCopy.specification !== null) {
// request/response parameter (and boolean return value)
- val reqParam = fctCopy.specification.createOwnedParameter("request", port.serviceType)
- val refReq = StereotypeUtil.applyApp(reqParam, Ptr)
- refReq.declaration = "::Request::SharedPtr"
- StereotypeUtil.applyApp(reqParam, Const)
- val resParam = fctCopy.specification.createOwnedParameter("response", port.serviceType)
- val refRes = StereotypeUtil.applyApp(resParam, Ptr)
- refRes.declaration = "::Response::SharedPtr"
- StereotypeUtil.applyApp(resParam, Const)
+ fctCopy.specification.createOwnedParameter("request", port.serviceType)
+ fctCopy.specification.createOwnedParameter("response", port.serviceType)
// use bool from ROS2 primitive type library (not all types there work without additional includes)
val retParam = fctCopy.specification.createOwnedParameter("ret",
port.getRosPrimitiveType("primitive::bool"))
retParam.direction = ParameterDirectionKind.RETURN_LITERAL
- return '''
- self.«fct.name»
- '''
+
+ return '''self.«fct.name»'''
}
}
@@ -150,11 +135,7 @@
ApplyProfiles.applyCommonProfile(handleParam)
val template = StereotypeUtil.applyApp(handleParam, TemplateBinding)
template.actuals.add(port.serviceType)
- val handleParamPtr = StereotypeUtil.applyApp(handleParam, Ptr)
- handleParamPtr.declaration = "::SharedPtr"
- val feedbackParam = lFeedbackFct.specification.createOwnedParameter("feedback", port.serviceType)
- val feedbackParamPtr = feedbackParam.applyApp(Ptr)
- feedbackParamPtr.declaration = "::Feedback::ConstSharedPtr"
+ lFeedbackFct.specification.createOwnedParameter("feedback", port.serviceType)
}
val resultFct = activityPort.getFunction(FunctionKind.HANDLER, FunctionUtils.R_RESULT)
@@ -164,9 +145,6 @@
val resultParam = lResultFct.specification.createOwnedParameter("result", handleType)
val resultTpl = StereotypeUtil.applyApp(resultParam, TemplateBinding)
resultTpl.actuals.add(port.serviceType)
- val resultParamPtr = resultParam.applyApp(Ptr)
- resultParamPtr.declaration = "::WrappedResult &"
- resultParam.apply(Const)
}
val goalFct = activityPort.getFunction(FunctionKind.HANDLER, FunctionUtils.GOAL)
@@ -199,9 +177,7 @@
val cancelResponse = getType(port, "ros2Library::rclcpp_action::CancelResponse");
// add parameters for handle_goal callback: uuid, goal and goalResponse (return value)
- val uuidParam = lGoalFct.specification.createOwnedParameter("uuid", goalUUID)
- uuidParam.apply(Ref)
- uuidParam.apply(Const)
+ lGoalFct.specification.createOwnedParameter("uuid", goalUUID)
val goalTypeName = String.format("std::shared_ptr<const %s::Goal>", port.serviceType.externalName)
lGoalFct.specification.createOwnedParameter("goal", component.dummyType(goalTypeName))
val goalRetParam = lGoalFct.specification.createOwnedParameter("return", goalResponse)
@@ -260,8 +236,6 @@
var dummyType = pkg.getPackagedElement(name) as Class
if (dummyType === null) {
dummyType = pkg.createOwnedClass(name, false)
- val ext = dummyType.applyApp(External)
- ext.name = name
}
return dummyType
}
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ComponentTransformations.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ComponentTransformations.xtend
index ca276c0..5c9cf8b 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ComponentTransformations.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ComponentTransformations.xtend
@@ -22,7 +22,6 @@
import org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain
import org.eclipse.papyrus.designer.transformation.core.transformations.TransformationContext
import org.eclipse.papyrus.designer.uml.tools.utils.ElementUtils
-import org.eclipse.papyrus.robotics.codegen.common.utils.ApplyProfiles
import org.eclipse.papyrus.robotics.core.utils.PortUtils
import org.eclipse.papyrus.robotics.profile.robotics.components.ComponentDefinition
import org.eclipse.papyrus.robotics.profile.robotics.functions.Function
@@ -39,7 +38,7 @@
import org.eclipse.uml2.uml.UMLPackage
import org.eclipse.uml2.uml.util.UMLUtil
-import static org.eclipse.papyrus.robotics.ros2.codegen.python.utils.RosPythonTypes.*
+import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.utils.RosPythonTypes.*
import static extension org.eclipse.papyrus.designer.uml.tools.utils.ElementUtils.varName
import static extension org.eclipse.papyrus.robotics.codegen.common.utils.ActivityUtils.*
@@ -55,220 +54,225 @@
import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.component.ParameterTransformations.declareParameters
import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.component.ParameterTransformations.initParameters
import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.component.ParameterTransformations.moveParameters
-import static extension org.eclipse.papyrus.uml.tools.utils.StereotypeUtil.applyApp
+import static extension org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil.applyApp
class ComponentTransformations extends AbstractCompTransformations {
-
+
new(IPFileSystemAccess fileAccess, IProject genProject) {
super(fileAccess, genProject)
}
+
/**
*
*/
- def createOnConfigureMethod(Class component){
- var op = component.createOwnedOperation('on_configure', null, null)
- var ob = component.createOwnedBehavior('on_configure', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
- op.methods.add(ob)
- op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
- ob.languages.add("Python")
- ob.bodies.add('''
- «FOR activity : component.activities»
- «val activityCl = activity.base_Class»
- «val period = activity.period»
- «val activateFcts = activity.getFunctions(FunctionKind.ON_CONFIGURE)»
- «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
- «IF activateFcts.size > 0»
- «FOR activateFct : activateFcts»
- self.«activateFct.name»()
- «ENDFOR»
- «ENDIF»
- «IF period !== null && periodicFcts.size > 0»
- # periodic execution («period») for «activityCl.name» using a timer
- «FOR periodicFct : periodicFcts»
- self.timer_«activityCl.name» = self.create_timer(«period.convertPeriod», self.«periodicFct.name»)
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
-
- return TransitionCallbackReturn.SUCCESS
- ''')
- }
- /**
- *
- */
- def static convertPeriod(String period){
- if(period.contains("ms")){
- val floatPeriod = Float.parseFloat(period.replace("ms", "")) / 1000
- return floatPeriod.toString
- }
-
- else if(period.contains("s"))
- return period.replace("s", "")
- }
- /**
- *
- */
- def createOnActivateMethod(Class component){
- var op = component.createOwnedOperation('on_activate', null, null)
- var ob = component.createOwnedBehavior('on_activate', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
- ob.languages.add("Python")
- op.methods.add(ob)
- op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
- ob.bodies.add('''
- «FOR activity : component.activities»
- «val activateFcts = activity.getFunctions(FunctionKind.ON_ACTIVATE)»
- «IF activateFcts.size > 0»
- «FOR activateFct : activateFcts»
- self.«activateFct.name»()
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
-
- return TransitionCallbackReturn.SUCCESS
- ''')
- }
- /**
- *
- */
- def createOnDeactivateMethod(Class component){
- var op = component.createOwnedOperation('on_deactivate', null, null)
- var ob = component.createOwnedBehavior('on_deactivate', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
- ob.languages.add("Python")
- op.methods.add(ob)
- op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
- ob.bodies.add('''
- «FOR activity : component.activities»
- «val activityCl = activity.base_Class»
- «val deactivateFcts = activity.getFunctions(FunctionKind.ON_DEACTIVATE)»
- «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
- «IF deactivateFcts.size > 0»
- «FOR deactivateFct : deactivateFcts»
- self.«deactivateFct.name»()
- «ENDFOR»
- «ENDIF»
- «IF periodicFcts.size > 0»
- «FOR periodicFct : periodicFcts»
- self.timer_«activityCl.name».cancel()
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
-
- return TransitionCallbackReturn.SUCCESS
- ''')
- }
- /**
- *
- */
- def createOnCleanupMethod(Class component){
- var op = component.createOwnedOperation('on_cleanup', null, null)
- var ob = component.createOwnedBehavior('on_cleanup', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
- ob.languages.add("Python")
- op.methods.add(ob)
- op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
- }
- /**
- *
- */
- def createOnShutdownMethod(Class component){
- var op = component.createOwnedOperation('on_shutdown', null, null)
- var ob = component.createOwnedBehavior('on_shutdown', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
- ob.languages.add("Python")
- op.methods.add(ob)
- op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
- ob.bodies.add('''
- «FOR activity : component.activities»
- «val activityCl = activity.base_Class»
- «val shutdownFcts = activity.getFunctions(FunctionKind.ON_SHUTDOWN)»
- «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
- «IF shutdownFcts.size > 0»
- «FOR shutdownFct : shutdownFcts»
- self.«shutdownFct.name»()
- «ENDFOR»
- «ENDIF»
- «IF periodicFcts.size > 0»
- «FOR periodicFct : periodicFcts»
- self.timer_«activityCl.name».destroy()
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
-
- return TransitionCallbackReturn.SUCCESS
- ''')
- }
+ def createOnConfigureMethod(Class component) {
+ var op = component.createOwnedOperation('on_configure', null, null)
+ var ob = component.createOwnedBehavior('on_configure', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ op.methods.add(ob)
+ op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
+ ob.languages.add("Python")
+ ob.bodies.add('''
+ «FOR activity : component.activities»
+ «val activityCl = activity.base_Class»
+ «val period = activity.period»
+ «val activateFcts = activity.getFunctions(FunctionKind.ON_CONFIGURE)»
+ «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
+ «IF activateFcts.size > 0»
+ «FOR activateFct : activateFcts»
+ self.«activateFct.name»()
+ «ENDFOR»
+ «ENDIF»
+ «IF period !== null && periodicFcts.size > 0»
+ # periodic execution («period») for «activityCl.name» using a timer
+ «FOR periodicFct : periodicFcts»
+ self.timer_«activityCl.name» = self.create_timer(«period.convertPeriod», self.«periodicFct.name»)
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+
+ return TransitionCallbackReturn.SUCCESS
+ ''')
+ }
+
/**
*
*/
- def createROS2Dependencies(Class component){
- val lcStateSC = getType(component, "rclpy::lifecycle::State")
+ def static convertPeriod(String period) {
+ if (period.contains("ms")) {
+ val floatPeriod = Float.parseFloat(period.replace("ms", "")) / 1000
+ return floatPeriod.toString
+ } else if (period.contains("s"))
+ return period.replace("s", "")
+ }
+
+ /**
+ *
+ */
+ def createOnActivateMethod(Class component) {
+ var op = component.createOwnedOperation('on_activate', null, null)
+ var ob = component.createOwnedBehavior('on_activate', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ ob.languages.add("Python")
+ op.methods.add(ob)
+ op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
+ ob.bodies.add('''
+ «FOR activity : component.activities»
+ «val activateFcts = activity.getFunctions(FunctionKind.ON_ACTIVATE)»
+ «IF activateFcts.size > 0»
+ «FOR activateFct : activateFcts»
+ self.«activateFct.name»()
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+
+ return TransitionCallbackReturn.SUCCESS
+ ''')
+ }
+
+ /**
+ *
+ */
+ def createOnDeactivateMethod(Class component) {
+ var op = component.createOwnedOperation('on_deactivate', null, null)
+ var ob = component.createOwnedBehavior('on_deactivate',
+ UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ ob.languages.add("Python")
+ op.methods.add(ob)
+ op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
+ ob.bodies.add('''
+ «FOR activity : component.activities»
+ «val activityCl = activity.base_Class»
+ «val deactivateFcts = activity.getFunctions(FunctionKind.ON_DEACTIVATE)»
+ «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
+ «IF deactivateFcts.size > 0»
+ «FOR deactivateFct : deactivateFcts»
+ self.«deactivateFct.name»()
+ «ENDFOR»
+ «ENDIF»
+ «IF periodicFcts.size > 0»
+ «FOR periodicFct : periodicFcts»
+ self.timer_«activityCl.name».cancel()
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+
+ return TransitionCallbackReturn.SUCCESS
+ ''')
+ }
+
+ /**
+ *
+ */
+ def createOnCleanupMethod(Class component) {
+ var op = component.createOwnedOperation('on_cleanup', null, null)
+ var ob = component.createOwnedBehavior('on_cleanup', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ ob.languages.add("Python")
+ op.methods.add(ob)
+ op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
+ }
+
+ /**
+ *
+ */
+ def createOnShutdownMethod(Class component) {
+ var op = component.createOwnedOperation('on_shutdown', null, null)
+ var ob = component.createOwnedBehavior('on_shutdown', UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ ob.languages.add("Python")
+ op.methods.add(ob)
+ op.createOwnedParameter('state', getType(component, "rclpy::lifecycle::State"))
+ ob.bodies.add('''
+ «FOR activity : component.activities»
+ «val activityCl = activity.base_Class»
+ «val shutdownFcts = activity.getFunctions(FunctionKind.ON_SHUTDOWN)»
+ «val periodicFcts = activity.getFunctions(FunctionKind.PERIODIC)»
+ «IF shutdownFcts.size > 0»
+ «FOR shutdownFct : shutdownFcts»
+ self.«shutdownFct.name»()
+ «ENDFOR»
+ «ENDIF»
+ «IF periodicFcts.size > 0»
+ «FOR periodicFct : periodicFcts»
+ self.timer_«activityCl.name».destroy()
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+
+ return TransitionCallbackReturn.SUCCESS
+ ''')
+ }
+
+ /**
+ *
+ */
+ def createROS2Dependencies(Class component) {
+ val lcStateSC = getType(component, "rclpy::lifecycle::State")
val lcTransitionCallbackReturnSC = getType(component, "rclpy::lifecycle::TransitionCallbackReturn")
val lcPublisherSC = getType(component, "rclpy::lifecycle::Publisher")
- val rclpyPkg = UMLFactory.eINSTANCE.createPackage;
- rclpyPkg.name = "rclpy"
- component.createDependency(rclpyPkg)
-
- if (lcStateSC instanceof Classifier && lcTransitionCallbackReturnSC instanceof Classifier && lcPublisherSC instanceof Classifier) {
+ component.createDependency(component.getRclPy)
+
+ if (lcStateSC instanceof Classifier && lcTransitionCallbackReturnSC instanceof Classifier &&
+ lcPublisherSC instanceof Classifier) {
component.createDependency(lcStateSC)
component.createDependency(lcTransitionCallbackReturnSC)
-
- if(component.hasProvidedsPort){
+
+ if (component.hasProvidedsPort) {
component.createDependency(lcPublisherSC)
- }
+ }
}
-
- for(port : PortUtils.getAllPorts(component)){
- if(port.communicationPattern.query){
+
+ for (port : PortUtils.getAllPorts(component)) {
+ if (port.communicationPattern.query) {
val msg_type = port.serviceType
msg_type.name = port.serviceType.externalName.getSrvName
val pkg = msg_type.package
pkg.name = 'srv'
ApplyPythonProfile.apply(pkg)
pkg.applyApp(Module)
- component.createDependency(msg_type)
- }
- else if(port.communicationPattern.action){
-
- }
- else{
+ component.createDependency(msg_type)
+ } else if (port.communicationPattern.action) {
+ } else {
val msg_type = port.commObject
- //msg_type.name = port.commObject.externalName
+ // msg_type.name = port.commObject.externalName
val pkg = msg_type.package
ApplyPythonProfile.apply(pkg)
pkg.applyApp(Module)
- component.createDependency(msg_type)
- }
+ component.createDependency(msg_type)
+ }
}
- }
- /**
- *
- */
- def static String getSrvName(String externalName){
- val index = externalName.lastIndexOf("::")
- if(index != -1){
- return externalName.substring(index + 2)
- }
- return ''
- }
- /**
+ }
+
+ /**
*
*/
- def static hasProvidedsPort(Class component){
- for(port : PortUtils.getAllPorts(component)){
- val cp = port.communicationPattern
+ def static String getSrvName(String externalName) {
+ val index = externalName.lastIndexOf("::")
+ if (index != -1) {
+ return externalName.substring(index + 2)
+ }
+ return ''
+ }
+
+ /**
+ *
+ */
+ def static hasProvidedsPort(Class component) {
+ for (port : PortUtils.getAllPorts(component)) {
+ val cp = port.communicationPattern
if (port.provideds.size() > 0 && (cp.isPush || cp.isPubSub || cp.isSend)) {
return true
}
- }
- return false
- }
+ }
+ return false
+ }
+
/**
* Create a parent python package that contains the component's package.
*/
- def createParentPkg(Class component){
- val aPkg = UMLFactory.eINSTANCE.createPackage
+ def createParentPkg(Class component) {
+ val aPkg = UMLFactory.eINSTANCE.createPackage
aPkg.name = genProject.name.toLowerCase
aPkg.packagedElements.add(component.nearestPackage)
- }
-
+ }
+
def static createPubsSubsAttrs(Class component) {
for (port : PortUtils.getAllPorts(component)) {
val cp = port.communicationPattern
@@ -333,7 +337,7 @@
/**
* Remove functions that are not referenced by activities (this can happen after
- * deletion of a function from an activity)
+ * deletion of a function an activity)
*/
def static removeUnrefFunctions(Class component) {
val cd = UMLUtil.getStereotypeApplication(component, ComponentDefinition)
@@ -351,15 +355,15 @@
}
}
}
+
/**
*
*/
- def static void createTimerAttrs(Class component) {
+ def static void createTimerAttrs(Class component) {
for (activity : component.activities) {
val period = activity.period
if (period !== null) {
- val timerBase = ElementUtils.getQualifiedElementFromRS(component,
- "rclpy::timer::Timer") as Type;
+ val timerBase = ElementUtils.getQualifiedElementFromRS(component, "rclpy::timer::Timer") as Type;
component.createOwnedAttribute('''timer_«activity.base_Class.name»_''', timerBase);
}
}
@@ -380,15 +384,16 @@
component.liftFunctions
component.createConstructor
component.createROS2Dependencies
-
+
if (component.isRegistered) {
}
+ if (component.hasExternalCode) {
+ new Ros2CodeSkeleton(component).createSkeleton();
+ }
+ // call main after skeleton creation
component.createMain;
- if (component.hasExternalCode) {
- new Ros2CodeSkeleton().createSkeleton(component);
- }
// val stdString = getType(node, "ros2Library::std_msgs::String");
// node.createDependency(stdString)
component.removeActivities
@@ -397,7 +402,7 @@
component.createServiceAttrs
component.createActionAttrs
component.createTimerAttrs
-
+
if (component.allParameters.size > 0) {
component.declareParameters
component.initParameters
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Constructor.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Constructor.xtend
index d7f3ca5..6e90289 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Constructor.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Constructor.xtend
@@ -14,11 +14,10 @@
package org.eclipse.papyrus.robotics.ros2.codegen.python.component
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.ConstInit
import org.eclipse.papyrus.robotics.codegen.common.utils.ApplyProfiles
import org.eclipse.papyrus.robotics.core.utils.PortUtils
import org.eclipse.papyrus.robotics.profile.robotics.components.ComponentPort
-import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil
+import org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil
import org.eclipse.uml2.uml.Class
import org.eclipse.uml2.uml.Classifier
import org.eclipse.uml2.uml.OpaqueBehavior
@@ -50,7 +49,12 @@
}
val op = addConstrOp(component)
addConstrMethod(component, op)
+ val qosRPolicy = getType(component, "rclpy::qos::ReliabilityPolicy")
+ val qosHPolicy = getType(component, "rclpy::qos::HistoryPolicy")
+ component.createDependency(qosRPolicy)
+ component.createDependency(qosHPolicy)
}
+
/**
* Add an init operation (constructor) that creates the ROS2 publishers/subscribers/clients/... for ports
*/
@@ -66,12 +70,6 @@
ApplyProfiles.applyStdProfile(init)
create = StereotypeUtil.applyApp(init, Create)
}
- var constInit = StereotypeUtil.applyApp(init, ConstInit)
- if (constInit === null) {
- ApplyProfiles.applyCppProfile(init)
- constInit = StereotypeUtil.applyApp(init, ConstInit)
- }
- constInit.initialisation = '''rclcpp_lifecycle::LifecycleNode("«component.name»", options)'''
return init
}
@@ -83,6 +81,7 @@
constructorOp.methods.add(ob)
ob.languages.add("Python")
ob.bodies.add('''
+ super().__init__('«component.name»')
«FOR port : PortUtils.getAllPorts(component)»
«IF port.communicationPattern !== null»
«val pattern = port.communicationPattern»
@@ -114,10 +113,10 @@
self.«port.varName»_pub_ = self.create_publisher(«port.commObject.name», "«port.topic»", «port.qos("1")»)
«««port.varName»_pub_->on_activate()
«ELSEIF port.requireds.size() > 0»
- defaultQoSProfile = rclpy.qos.QoSProfile(reliability=QoSReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
- history=QoSHistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,
- depth = 100
- )
+ defaultQoSProfile = rclpy.qos.QoSProfile(
+ reliability=ReliabilityPolicy.BEST_EFFORT,
+ history=HistoryPolicy.KEEP_LAST,
+ depth = 100)
self.«port.varName»_sub_ = self.create_subscription(«port.commObject.name», "«port.topic»", «port.class_.callBackMethodForPush(port)», qos_profile = defaultQoSProfile)
«ENDIF»
'''
@@ -128,10 +127,10 @@
def static createSend(Port port) '''
«IF port.provideds.size() > 0»
««« Subscriber
- defaultQoSProfile = rclpy.qos.QoSProfile(reliability=QoSReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
- history=QoSHistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,
- depth = 100
- )
+ defaultQoSProfile = rclpy.qos.QoSProfile(
+ reliability=ReliabilityPolicy.BEST_EFFORT,
+ history=HistoryPolicy.KEEP_LAST,
+ depth = 100)
self.«port.varName»_recv_ = self.create_subscription(«port.commObject.name», "«port.topic»", «port.class_.callBackMethodForPush(port)», qos_profile = defaultQoSProfile)
«ELSEIF port.requireds.size() > 0»
««« Publisher
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/CreateMain.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/CreateMain.xtend
index 872b0a9..3dc9165 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/CreateMain.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/CreateMain.xtend
@@ -14,48 +14,47 @@
package org.eclipse.papyrus.robotics.ros2.codegen.python.component
-import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.ManualGeneration
import org.eclipse.papyrus.designer.languages.python.profile.python.Main
-import org.eclipse.papyrus.robotics.codegen.common.utils.ApplyProfiles
import org.eclipse.uml2.uml.Class
-import static extension org.eclipse.papyrus.uml.tools.utils.StereotypeUtil.apply
-import static extension org.eclipse.papyrus.uml.tools.utils.StereotypeUtil.applyApp
+import static extension org.eclipse.papyrus.designer.uml.tools.utils.StereotypeUtil.applyApp
+import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.utils.RosPythonTypes.*
+import static extension org.eclipse.papyrus.robotics.codegen.common.utils.ActivityUtils.*
+import static extension org.eclipse.papyrus.robotics.core.utils.ParameterUtils.getAllParameters
+
import org.eclipse.papyrus.robotics.ros2.codegen.python.utils.ApplyPythonProfile
+import org.eclipse.papyrus.robotics.codegen.common.component.CodeSkeleton
class CreateMain {
- /**
- * register a ROS2 components
- */
- def static registerComponent(Class component) '''
- #include "rclcpp_components/register_node_macro.hpp"
-
- // Register the component with class_loader.
- // This acts as a sort of entry point, allowing the component to be discoverable when its library
- // is being loaded into a running process.
- RCLCPP_COMPONENTS_REGISTER_NODE(«component.qualifiedName»)
- '''
/**
* Create the main entry point for a class
*/
def static createMain(Class component) {
- val mainClass = component.nearestPackage.createOwnedClass(component.name + "_main", false);
- component.createDependency(mainClass)
- mainClass.apply(ManualGeneration)
+ val mainClass = component.nearestPackage.createOwnedClass(component.name + "_main", false)
+ val implClass = component.nearestPackage.getOwnedMember(component.name + CodeSkeleton.POSTFIX) as Class
ApplyPythonProfile.apply(mainClass)
val mainST = mainClass.applyApp(Main)
mainST.body = component.createMainCode.toString
+ if (implClass !== null) {
+ mainClass.createDependency(implClass);
+ }
+ else {
+ mainClass.createDependency(component);
+ }
+ mainClass.createDependency(mainClass.getRclPy)
}
def static createMainCode(Class component) '''
rclpy.init()
- «component.name»_node = «component.name»('«component.name»_node')
- «component.name»_node.get_logger().info('«component.name» node has been created')
- «component.name»_node.declareParameters()
- «component.name»_node.initParameterVars()
- executor = rclpy.executors.MultiThreadedExectutor()
- executor.add_node(«component.name»_node)
+ «component.name.toLowerCase» = «component.name»«IF component.hasExternalCode»«CodeSkeleton.POSTFIX»«ENDIF»('«component.name»_node')
+ «component.name.toLowerCase».get_logger().info('«component.name» node has been created')
+ «IF component.allParameters.size > 0»
+ «component.name.toLowerCase».declareParameters()
+ «component.name.toLowerCase».initParameterVars()
+ «ENDIF»
+ executor = rclpy.executors.MultiThreadedExecutor()
+ executor.add_node(«component.name.toLowerCase»)
executor.spin()
rclpy.shutdown()
'''
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ParameterTransformations.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ParameterTransformations.xtend
index be5902e..421aeb2 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ParameterTransformations.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/ParameterTransformations.xtend
@@ -26,6 +26,7 @@
import static extension org.eclipse.papyrus.robotics.core.utils.ParameterUtils.getAllParameters
import static extension org.eclipse.papyrus.robotics.core.utils.ParameterUtils.getParameterClass
import static extension org.eclipse.papyrus.robotics.ros2.codegen.python.utils.RosPythonTypes.*
+import org.eclipse.uml2.uml.LiteralBoolean
class ParameterTransformations {
/**
@@ -59,23 +60,12 @@
initParamsOb.languages.add("Python")
initParamsOb.bodies.add('''
«FOR parameter : component.allParameters»
- self.get_parameter("«parameter.name»", «parameter.name.varName»_)
+ self.«parameter.name.varName»_ = self.get_parameter("«parameter.name»")
«ENDFOR»
''')
}
/**
- * Helper function that will add a comma if the passed string is non empty
- */
- def static comma(String s) {
- if (s !== null && s.length() > 0) {
- return ", " + s;
- } else {
- return ""
- }
- }
-
- /**
* Move parameters into the main components, rename it eventually to
* ensure that it is a valid identifier and remove default values (as
* the have been taken into account for parameter declaration already
@@ -114,8 +104,9 @@
value = String.format("std::string(\"%s\")", value)
// map all strings to std::string
parameter.type = parameter.getType("ros2Library::stdlib::string")
- } else if (typeName == "vector<string>") {
- value = String.format("std::vector<std::string>(%s)", value);
+ } else if (parameter.defaultValue instanceof LiteralBoolean) {
+ // transform true/false into True/False
+ value = value.toFirstUpper;
}
}
return String.format("%s", value);
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/RoboticsPythonCreator.java b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/RoboticsPythonCreator.java
index fb9ee83..03567c9 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/RoboticsPythonCreator.java
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/RoboticsPythonCreator.java
@@ -112,4 +112,12 @@
String fileName = super.getFileName(element);
return fileName; // .replaceFirst(super.getFileName(model) + File.separator, StringConstants.EMPTY);
}
+
+ /**
+ * use absolute imports (otherwise, imports are not found after installation into ROS2 install folders)
+ */
+ @Override
+ protected boolean useRelativeImports() {
+ return false;
+ }
}
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Ros2CodeSkeleton.xtend b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Ros2CodeSkeleton.xtend
index a53c723..d12890e 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Ros2CodeSkeleton.xtend
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/component/Ros2CodeSkeleton.xtend
@@ -17,14 +17,28 @@
import org.eclipse.papyrus.robotics.codegen.common.component.CodeSkeleton
import org.eclipse.papyrus.robotics.profile.robotics.functions.Function
import org.eclipse.uml2.uml.Class
+import org.eclipse.uml2.uml.UMLPackage
+import org.eclipse.uml2.uml.OpaqueBehavior
/**
* Create a template for the code that needs to be filled by a developer.
*
*/
class Ros2CodeSkeleton extends CodeSkeleton {
+
+ new(Class component) {
+ super(component);
+ }
+
override addConstrOp(Class skeleton) {
- return Constructor.addConstrOp(skeleton);
+ val constructorOp = Constructor.addConstrOp(skeleton)
+ val ob = component.createOwnedBehavior(skeleton.name, UMLPackage.eINSTANCE.getOpaqueBehavior) as OpaqueBehavior
+ constructorOp.methods.add(ob)
+ ob.languages.add("Python")
+ ob.bodies.add('''
+ super().__init__(options)
+ ''')
+ return constructorOp
}
override moveFunction(Class skeleton, Function function) {
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/GenerateCodeHandler.java b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/GenerateCodeHandler.java
index 3ec4ed6..8bf1639 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/GenerateCodeHandler.java
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/GenerateCodeHandler.java
@@ -23,9 +23,9 @@
import org.eclipse.papyrus.designer.transformation.base.utils.ProjectManagement;
import org.eclipse.papyrus.designer.transformation.core.transformations.TransformationContext;
import org.eclipse.papyrus.designer.transformation.profile.Transformation.ExecuteTrafoChain;
+import org.eclipse.papyrus.designer.uml.tools.utils.PackageUtil;
import org.eclipse.papyrus.robotics.ros2.codegen.python.jobs.PythonGenJob;
import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
-import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Classifier;
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/RewriteCDTHandler.java b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/RewriteCDTHandler.java
index fb9a701..2616f91 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/RewriteCDTHandler.java
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/handlers/RewriteCDTHandler.java
@@ -24,10 +24,10 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.papyrus.designer.transformation.base.utils.ProjectManagement;
import org.eclipse.papyrus.designer.transformation.profile.Transformation.ExecuteTrafoChain;
+import org.eclipse.papyrus.designer.uml.tools.utils.PackageUtil;
import org.eclipse.papyrus.robotics.ros2.codegen.common.RoboticsTContext;
import org.eclipse.papyrus.robotics.ros2.codegen.python.jobs.PythonGenJob;
import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
-import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.uml2.uml.Classifier;
public class RewriteCDTHandler extends CmdHandler {
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/utils/RosPythonTypes.java b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/utils/RosPythonTypes.java
index aa7fab0..9e75849 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/utils/RosPythonTypes.java
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.python/src/org/eclipse/papyrus/robotics/ros2/codegen/python/utils/RosPythonTypes.java
@@ -15,12 +15,15 @@
package org.eclipse.papyrus.robotics.ros2.codegen.python.utils;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.designer.uml.tools.utils.ElementUtils;
import org.eclipse.papyrus.robotics.codegen.common.utils.Helpers;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Type;
public class RosPythonTypes {
+ public static final String RCLPY = "rclpy"; //$NON-NLS-1$
public static final URI RCLPY_LIBRARY_URI = URI.createURI("pathmap://ROS2_PYTHON_LIBRARY/rclpy.uml"); //$NON-NLS-1$
/**
@@ -36,5 +39,15 @@
// don't need a copy, as these types are not in previous transformation steps
return Helpers.getTypeFromRS(element, RCLPY_LIBRARY_URI, qualifiedName, false);
}
-
-}
+
+ /**
+ * return a reference to the rclpy package
+ *
+ * @param element
+ * an element of the source model (used to identify resource set)
+ * @return the rclpy package if found
+ */
+ public static Package getRclPy(Element element) {
+ return (Package) ElementUtils.getQualifiedElementFromRS(element, RCLPY_LIBRARY_URI, RCLPY);
+ }
+}
\ No newline at end of file
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_client.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_client.py
index f5d1179..2248700 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_client.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_client.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='client',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_server.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_server.py
index e06d9fd..7a5c7cc 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_server.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/clientServer/launch/launch_server.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='server',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_publisher.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_publisher.py
index c6bbebb..aa6c862 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_publisher.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_publisher.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='publisher',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_subscriber.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_subscriber.py
index 3c0101e..7fe11c8 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_subscriber.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe/launch/launch_subscriber.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='subscriber',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_publisher.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_publisher.py
index 07291db..1e0240b 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_publisher.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_publisher.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='publisher',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_subscriber.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_subscriber.py
index eb16904..8f2243d 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_subscriber.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/launch/launch_subscriber.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='subscriber',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/periodicPublisherCompdef/PeriodicPublisher.cpp b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/periodicPublisherCompdef/PeriodicPublisher.cpp
index d69d7e2..dd0c27c 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/periodicPublisherCompdef/PeriodicPublisher.cpp
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/periodicPublisherCompdef/PeriodicPublisher.cpp
@@ -20,7 +20,6 @@
#include "periodicPublisherCompdef/PeriodicPublisher.h"
// Derived includes directives
-#include "periodicPublisherCompdef/PeriodicPublisher_impl.h"
#include "periodicPublisherCompdef/PeriodicPublisher_main.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/subscriberCompdef/Subscriber.cpp b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/subscriberCompdef/Subscriber.cpp
index e4d5329..f9f5c8e 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/subscriberCompdef/Subscriber.cpp
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/publishSubscribe_extcode/src-gen/subscriberCompdef/Subscriber.cpp
@@ -26,7 +26,6 @@
// Derived includes directives
#include "rclcpp/rclcpp.hpp"
-#include "subscriberCompdef/Subscriber_impl.h"
#include "subscriberCompdef/Subscriber_main.h"
namespace subscriberCompdef {
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_client.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_client.py
index a9fc23d..c186815 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_client.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_client.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='client',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld
diff --git a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_server.py b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_server.py
index 4670ff8..4759697 100644
--- a/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_server.py
+++ b/plugins/ros2/org.eclipse.papyrus.robotics.ros2.codegen.tests/expectedResult/sendReceive/launch/launch_server.py
@@ -13,7 +13,7 @@
# Start of user code parameters
# End of user code
-
+
# Add the actions to the launch description.
return LifecycleNode(
name='server',
@@ -32,7 +32,7 @@
# Launch Description
ld = LaunchDescription()
ld.add_entity(generate_entity())
-
+
# Start of user code post-launch
# End of user code
return ld