Skip to main content
Jump to: navigation, search

Papyrus/customizations/robotics/compdefscratch

< Papyrus‎ | customizations/robotics
Revision as of 08:55, 29 October 2020 by Christophe.aussagues.cea.fr (Talk | contribs) (Step-by-step procedure)

Component definitions from scratch

Forewords

Please read here for the description of the example taken as reference in this section.

Step-by-step procedure

We may now define the types of the components to be created:

  1. We create a new Robotics project with “Create a component” as the main objective.
  2. Then, we click on “Next” and choose the project’s name, for example fromscratch_components, before clicking on “Finish”.
  3. As we aim to define two component types that will be named Mult_client (that send the data to be multiplied) and Mult_server (that performs the multiplication), we suppress the initial model by right-clicking on fromscratch_components/components/fromscratch_components.compdef and selecting Delete.
  4. We then select the fromscratch_components/models/components, we right-click on it, we select New Robotics model with “Create a component” as the main objective.
  5. Then, we click on “Next”, we see the parent folder as fromscratch_components/models/components, we replace the File name by mult_server.compdef.di, before clicking on “Finish”.
  6. We now click on the “Mult_server diagram” view in the “Notation Views” part of the “Welcome” panel. By default, a component named Mult_server has been created.
  7. We drag-and-drop a Parameter Entry from the Palette to the Parameters internal structure of the component that exists by default in the main component.
  8. We select the parameter type as the primitive uint32.
  9. In the Properties view, we change the name as initial_number_of_requests and we set its Default value to 0.
  10. We then drag-and-drop an Activity from the Palette to the main component.
  11. We name it mult_activity.
  12. We drag-and-drop an Activity Port from the Palette to the mult_activity Activity.
  13. We drag-and-drop a Component Port from the Palette to the main component limits. We select it as Provided and Workspace matches/services.servicedef.uml/svcdefs/Query_MultInMultOut.
  14. We name it multiply.
  15. We connect via the Palette connects definition the Activity port and the component Port. It creates a multiply_handler Function in the mult_activity Activity to manage the requests that will be sent to the component.
  16. We drag-and-drop another Activity Port from the Palette to the mult_activity Activity. We drag-and-drop another Component Port from the Palette to the main component limits. We select it as Provided and Workspace matches/services.servicedef.uml/svcdefs/Push_NumOfRequests. We name it processed_requests.
  17. We connect via the Palette connects definition the Activity port and the component Port. A no handler is needed for pushing elements, no handler function is created.


Here is the resulting diagram:

Papyrus-customizations-robotics-fromscratch-4.png
Server component model

Here is the illustrated procedure: Papyrus-customizations-robotics-createComponentServer.gif
Server component model creation


We now model the client:

  1. We then select the fromscratch_components/models/components, we right-click on it, we select New Robotics model with “Create a component” as the main objective.
  2. Then, we click on “Next”, we see the parent folder as fromscratch_components/models/components, we replace the File name by mult_client.compdef.di, before clicking on “Finish”.
  3. We now click on the “Mult_client diagram” view in the “Notation Views” part of the “Welcome” panel. By default, a component named Mult_client has been created.
  4. We drag-and-drop a Parameter in the Mult_client component.
  5. We drag-and-drop two Parameter Entry from the Palette to the Parameters internal structure of the Mult_client component, one for the init_xVal and the other for the init_yVal, set to 1.
  6. We then drag-and-drop an Activity from the Palette to the main component.
  7. We name it Activity1.
  8. We drag-and-drop an Activity Port from the Palette to the Activity1 Activity.
  9. We drag-and-drop a Component Port from the Palette to the main component limits.
  10. We select it as Required and Workspace matches/services.servicedef.uml/svcdefs/Query_MultInMultOut.
  11. We name it multiply.
  12. We connect via the Palette connects definition the Activity port and the component Port.
  13. We drag-and-drop another Activity Port from the Palette to the Activity1 Activity.
  14. We drag-and-drop another Component Port from the Palette to the main component limits.
  15. We select it as Required and Workspace matches/services.servicedef.uml/svcdefs/Push_NumOfRequests.
  16. We name it processed_requests.
  17. We connect via the Palette connects definition the Activity port and the component Port. It creates a processed_requests_handler Function in the Activity1 Activity to manage the pushed messages that will be sent to the component.
  18. We then drag-and-drop a Periodic Task from the Palette to the Activity1 Activity.
  19. In the Properties view, we select the Activities tab and set its period to “500ms”.
  20. We select the Activity1 Activity, the Functions tab and add a new function named by default fNewFunction and triggers by default by a handler.
  21. We change the name to mainClientFunction and its Kind as PERIODIC. This is the (main) function of left and right components that will be executed each 500ms.


Here is the resulting diagram:

Papyrus-customizations-robotics-fromscratch-5.png
Client component model

Here is the illustrated procedure: Papyrus-customizations-robotics-createComponentClient.gif
Server component model creation

Position with respect to the robotics domain

A component definition is a tier-3 activity, i.e. an activity that is typically done by a component developer. A component developer manages the design and configuration of components as well as their parameters. He can edit its architecture in the Architecture Model Explorer and he can specify in each component which port uses a given service.

Back to the top