Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Papyrus/customizations/robotics/compdef"

Line 28: Line 28:
 
Creation and editing of functions
 
Creation and editing of functions
 
</center>
 
</center>
 +
 +
Please note that if you edit a function, the pop-dialog will initially present the ID tab used to edit its name, you need to navigate explicitly to the function tab.
 +
 +
The association of a function with an activity port can be expressed by means of an activity port reference. visible in the upper right corner of the function edit dialog, see below.
 +
 +
<center>
 +
[[Image:Papyrus-customizations-robotics-function-edit.png|950px]]<br/>
 +
Creation and editing of functions
 +
</center>
 +
 +
A function can optionally contain C++ code. If present (the property "code in model" is calculated automatically), the code will be embedded into the generated code by the code generator, for instance for ROS2.
 +
 +
If not, the ROS2 generator will create an implementation skeleton (in a folder called src-skel) that needs to be edited after code generation. In order to avoid that the file is overwritten by subsequent calls of the generator, the developer should create a copy the skeleton in the "src" folder.
  
 
=== Linking functions with Activities ===
 
=== Linking functions with Activities ===

Revision as of 07:55, 24 June 2020

Component Definition

A component definition is an encapsulated entity that consists of activities (which in turn have functions), ports and parameters. See also Component Definition meta-model

Creating parameters

A parameter entry is part of a parameter block. If you create a new component definition using the wizard, the parameter block is already part of your component. A new parameter can be created in two different ways (1) Use the diagram and add a parameter entry to the parameter block (Note that you cannot drop an entry on the icon itself). (2) Opening the textual editor for the component definition. This editor appears in a property view tab called "Textual Spec." when the component is selected.

An overview of the properties along with their type an description is available along with their type, if either the component itself or the parameter block is selected.

Component ports

A ports can be created via the "Component Port" tool from the palette. It must be placed on the border of the component. When a new port is created, the tool will first ask whether this is a provided or required port. Afterwards, the user has to select an existing service definition, either from a model already loaded into the resource set (since already referenced by another element of your model), a registered model or a model in the workspace.

Activities

Activities can be created from the palette. Activities have functions that are handling requests arriving at a component port (being called) or actively sending messages or requests (calling) to a port.

Functions

Functions can be created via the property view of activities, via the "+" icon in the dialog shown below.

Papyrus-customizations-robotics-functions.png
Creation and editing of functions

Please note that if you edit a function, the pop-dialog will initially present the ID tab used to edit its name, you need to navigate explicitly to the function tab.

The association of a function with an activity port can be expressed by means of an activity port reference. visible in the upper right corner of the function edit dialog, see below.

Papyrus-customizations-robotics-function-edit.png
Creation and editing of functions

A function can optionally contain C++ code. If present (the property "code in model" is calculated automatically), the code will be embedded into the generated code by the code generator, for instance for ROS2.

If not, the ROS2 generator will create an implementation skeleton (in a folder called src-skel) that needs to be edited after code generation. In order to avoid that the file is overwritten by subsequent calls of the generator, the developer should create a copy the skeleton in the "src" folder.

Linking functions with Activities

In order to link a function with a a port on the component level, a function is linked with an activity port (via an activity port reference that can be set via the property view). The activity port is linked with the component port via a connector that is available in palette.

When the user creates the link between a component port and an activity port, the tool will automatically create a handler function (with correctly setup activity port), if there is no function yet that is associated with the activity port.

Back to the top