blob: 24db4d035902a5b87b5e68977da44f9aefeabdba [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:robotics.components="http://www.eclipse.org/papyrus/robotics/components/1" xmlns:robotics.functions="http://www.eclipse.org/papyrus/robotics/functions/1" xmlns:robotics.generics="http://www.eclipse.org/papyrus/robotics/generics/1" xmlns:robotics.parameters="http://www.eclipse.org/papyrus/robotics/parameters/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/robotics/components/1 http://www.eclipse.org/papyrus/robotics/1#//components http://www.eclipse.org/papyrus/robotics/functions/1 http://www.eclipse.org/papyrus/robotics/1#//functions http://www.eclipse.org/papyrus/robotics/generics/1 http://www.eclipse.org/papyrus/robotics/1#//generics http://www.eclipse.org/papyrus/robotics/parameters/1 http://www.eclipse.org/papyrus/robotics/1#//parameters">
<uml:Model xmi:id="_6nSQsEfEEeiwO_ETU0BG9A" name="addClientCompdef">
<ownedComment xmi:type="uml:Comment" xmi:id="_ETCcQF0bEeqenIMm5aFGvw" annotatedElement="_6nSQsEfEEeiwO_ETU0BG9A">
<body>This component models a client that adds 2 integers and receives a reply with their sum.
It has an empty set of parameters.
It has a port named useAdd that requires a service named &quot;AddServiceDef&quot; defined in the simple servicedef model. This model appears as loaded model in the model explorer, but not in your workspace.
The component is mapped to a ROS2 lifecycle node and needs to be activated before it starts operating. The component has an activity that gets called when the component is activated (e.g by sending a lifecycle configure/activate request via the ros2 command line tool.)
The function fCallAdd defines the request as a (x,y) structure and sends the request via the useAdd port in 2 possible ways:
- in a asynchronous non-blocking way (no callback function) and next by checking to its reply after 5s;
- by defining a callback function that it'll execute when the reply will be received.
In both cases, the function displays the received result (or an error if the reply was not received in time).</body>
</ownedComment>
<packageImport xmi:type="uml:PackageImport" xmi:id="_lwxc0ExOEei_Sui04GqxlQ">
<importedPackage xmi:type="uml:Model" href="pathmap://ROBOTICS_LIBRARIES/robotics.library.uml#_LaOOAJcvEeeV0-Lu2yLOjA"/>
</packageImport>
<packageImport xmi:type="uml:PackageImport" xmi:id="_vPI0sExOEei_Sui04GqxlQ">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packageImport xmi:type="uml:PackageImport" xmi:id="_VwyNkPV1EemSEqXywHKEEA">
<importedPackage xmi:type="uml:Model" href="pathmap://ROS2_TESTMODELS/simple/models/services/simple.servicedef.uml#_6nSQsEfEEeiwO_ETU0BG9A"/>
</packageImport>
<packagedElement xmi:type="uml:Class" xmi:id="_-9MoUEiFEeiAtInRNnLmIQ" name="AddClient">
<ownedAttribute xmi:type="uml:Property" xmi:id="_DPbI0HX0EeirHb2XH36K_A" name="activity2" type="_DNyKEHX0EeirHb2XH36K_A"/>
<ownedAttribute xmi:type="uml:Port" xmi:id="_6SlXMHq1EeikT4nAmbXssQ" name="useAdd" type="_ZYcQwPV1EemSEqXywHKEEA" aggregation="composite"/>
<ownedConnector xmi:type="uml:Connector" xmi:id="_LCWWgAbwEeq69tbfZET3mw">
<end xmi:type="uml:ConnectorEnd" xmi:id="_LCYLsAbwEeq69tbfZET3mw" partWithPort="_DPbI0HX0EeirHb2XH36K_A" role="_Fv2rwHq2EeikT4nAmbXssQ"/>
<end xmi:type="uml:ConnectorEnd" xmi:id="_LCYLsQbwEeq69tbfZET3mw" role="_6SlXMHq1EeikT4nAmbXssQ"/>
</ownedConnector>
<nestedClassifier xmi:type="uml:Class" xmi:id="_kiyUIEiHEeiAtInRNnLmIQ" name="ParameterSet"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_DNyKEHX0EeirHb2XH36K_A" name="CallAdd">
<generalization xmi:type="uml:Generalization" xmi:id="_DN1NYHX0EeirHb2XH36K_A">
<general xmi:type="uml:Class" href="pathmap://ROBOTICS_LIBRARIES/robotics.library.uml#_dFzyYPn9Eee8c8wpObBu7w"/>
</generalization>
<ownedAttribute xmi:type="uml:Property" xmi:id="_dI62YHX0EeirHb2XH36K_A" name="activate" visibility="public" type="_4IFoAHXzEeirHb2XH36K_A"/>
<ownedAttribute xmi:type="uml:Port" xmi:id="_Fv2rwHq2EeikT4nAmbXssQ" name="addPort" aggregation="composite"/>
</nestedClassifier>
<nestedClassifier xmi:type="uml:Class" xmi:id="_ZYcQwPV1EemSEqXywHKEEA"/>
</packagedElement>
<packagedElement xmi:type="uml:OpaqueBehavior" xmi:id="_4IFoAHXzEeirHb2XH36K_A" name="fCallAdd" isAbstract="true">
<language>C++</language>
<body>auto request = std::make_shared&lt;
simple::srv::AddServiceDef::Request>();
request->x = 2;
request->y = 3;
RCLCPP_INFO(get_logger(), &quot;doing request&quot;);
// use a call in which the future is polled first
auto result_future = useAdd_client->async_send_request(request);
if (result_future.wait_for(std::chrono::seconds(5s)) != std::future_status::ready) {
RCLCPP_ERROR(get_logger(), &quot;service call failed. This happens, since the call is executed within the activation callback&quot;);
}
else {
auto result = result_future.get();
RCLCPP_INFO(get_logger(), &quot;result = %d&quot;, result->sum);
}
// now make a call referencing a callback (in a lambda)
useAdd_client->async_send_request(request,
[this](
rclcpp::Client&lt;simple::srv::AddServiceDef>::SharedFuture arg_future) {
auto result = arg_future.get();
RCLCPP_INFO(get_logger(), &quot;result = %d&quot;, result->sum);
}
);
</body>
</packagedElement>
<packagedElement xmi:type="uml:Usage" xmi:id="_u0gz8PV5EemIj9SnfMX-0g" client="_ZYcQwPV1EemSEqXywHKEEA">
<supplier xmi:type="uml:Interface" href="pathmap://ROS2_TESTMODELS/simple/models/services/simple.servicedef.uml#_aTuOIHoWEeif1855zzC59A"/>
</packagedElement>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_6voUYEfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6vqJkEfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/bpc/1#/"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_BPC_PROFILES/bpc.profile.uml#__9qqMJZ1Eeeq1f8hGgKVzA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7CwrwEfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7CxS0EfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#/"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#__9qqMJZ1Eeeq1f8hGgKVzA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7Cyg8EfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7Cyg8UfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//components"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_EZ1TgJZ2Eeeq1f8hGgKVzA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7Cyg8kfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7Cyg80fEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//commpattern"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_8Z6x8Je6EeeiCOWsEr9OuA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7CzIAkfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7CzvEEfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//deployment"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_tu6OsJe9EeeiCOWsEr9OuA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7CzvEUfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7CzvEkfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//services"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_SlbOAJe_EeeiCOWsEr9OuA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7C0WIEfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7C0WIUfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//commobject"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_bz5AcPCaEeee6ab5J_C5Dg"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7C0WIkfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7C09MEfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//functions"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_SV7GwC6LEei0V9-WLHIyvg"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_7C09MUfEEeiwO_ETU0BG9A">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_7C1kQEfEEeiwO_ETU0BG9A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//parameters"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_-pU5oDmpEei--ZsfKWaFtw"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_vBSogEfFEeiuVfmPqBuUBA">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_vBVEwEfFEeiuVfmPqBuUBA" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/MARTE/1#//MARTE_Foundations/NFPs"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://Papyrus_PROFILES/MARTE.profile.uml#_U_GAoAPMEdyuUt-4qHuVvQ"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_vBXhAEfFEeiuVfmPqBuUBA">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_vBXhAUfFEeiuVfmPqBuUBA" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/MARTE/1#//MARTE_Annexes/VSL/DataTypes"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://Papyrus_PROFILES/MARTE.profile.uml#_9FdqwA-MEdyLh7muGbCqMw"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_QpoCUEfMEeiuVfmPqBuUBA">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_QpopYEfMEeiuVfmPqBuUBA" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_Kv8EIKFXEeS_KNX0nfvIVQ"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_I4cKUEoDEeie-dKbx_4wnA">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_I442QEoDEeie-dKbx_4wnA" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/robotics/1#//generics"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://ROBOTICS_PROFILES/robotics.profile.uml#_eFhjMEnvEeien6eLHpkAxA"/>
</profileApplication>
<profileApplication xmi:type="uml:ProfileApplication" xmi:id="_eP0y4KcHEemKm7jDzAkd-g">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_eP5EUKcHEemKm7jDzAkd-g" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/C_Cpp/1#/"/>
</eAnnotations>
<appliedProfile xmi:type="uml:Profile" href="pathmap://PapyrusC_Cpp_PROFILES/C_Cpp.profile.uml#_j9REUByGEduN1bTiWJ0lyw"/>
</profileApplication>
</uml:Model>
<robotics.components:ComponentDefinition xmi:id="_-9VLMEiFEeiAtInRNnLmIQ" base_Class="_-9MoUEiFEeiAtInRNnLmIQ"/>
<robotics.parameters:Parameter xmi:id="_ki1XcEiHEeiAtInRNnLmIQ" base_Class="_kiyUIEiHEeiAtInRNnLmIQ"/>
<robotics.functions:Function xmi:id="_79pkUHXzEeirHb2XH36K_A" base_Class="_4IFoAHXzEeirHb2XH36K_A" kind="ON_ACTIVATE"/>
<robotics.components:Activity xmi:id="_DN4QsHX0EeirHb2XH36K_A" base_Class="_DNyKEHX0EeirHb2XH36K_A"/>
<robotics.components:ActivityInstance xmi:id="_DPfaQHX0EeirHb2XH36K_A" base_Property="_DPbI0HX0EeirHb2XH36K_A"/>
<C_Cpp:Include xmi:id="_rrFA0Hh8Eei2lO6rEWqUCQ" preBody="#include &lt;iostream>&#xA;using namespace std;" base_class="_-9MoUEiFEeiAtInRNnLmIQ" base_Classifier="_-9MoUEiFEeiAtInRNnLmIQ"/>
<robotics.components:ComponentPort xmi:id="_6SoagHq1EeikT4nAmbXssQ" base_Port="_6SlXMHq1EeikT4nAmbXssQ"/>
<robotics.components:ActivityPort xmi:id="_Fv69MHq2EeikT4nAmbXssQ" base_Port="_Fv2rwHq2EeikT4nAmbXssQ"/>
<robotics.components:ComponentDefinitionModel xmi:id="_3qoH0NAQEemsvtLt7dgtCQ" authorship="ansgar.radermacher@cea.fr Ansgar" provenance="info-list@cea.fr CEA LIST" base_Package="_6nSQsEfEEeiwO_ETU0BG9A"/>
<robotics.components:ComponentService xmi:id="_ZYkMkPV1EemSEqXywHKEEA" base_Class="_ZYcQwPV1EemSEqXywHKEEA"/>
<robotics.generics:Connects xmi:id="_LCYywAbwEeq69tbfZET3mw" base_Connector="_LCWWgAbwEeq69tbfZET3mw"/>
</xmi:XMI>