Chapter 2. Using the SmartMDSD Toolchain

Table of Contents

2.1. Introduction
2.1.1. Installation and Requirements
2.1.2. Development Workflow
2.1.3. Working with the SmartMDSD Toolchain and SmartSoft Framework
2.1.3.1. SmartMDSD and SmartSoft on the filesystem
2.1.3.2. Starting the SmartMDSD Toolchain for the First Time
2.1.3.3. SmartMDSD Eclipse Projects
2.1.3.4. Version Control Considerations
2.2. System Design View
2.2.1. Project Structure
2.2.2. Communication Objects
2.2.2.1. Modeling Communication Objects
2.2.2.2. Generated files
2.2.3. Parameter Sets
2.2.4. Compile SmartSoft Communication/Coordination Repositories
2.2.5. Documentation
2.3. Component Development View
2.3.1. Component Projects
2.3.2. Component Modeling
2.3.2.1. Component Hull
2.3.2.1.1. Communication Patterns
2.3.2.1.2. SmartTask
2.3.2.1.3. SmartComponentMetadata
2.3.2.2. Component Parameters
2.3.2.2.1. SmartParameterMaster
2.3.2.2.2. SmartParameterSlave
2.3.2.2.3. SmartComponentParameter
2.3.2.2.4. Parameter Documentation
2.3.3. Component Implementation
2.3.3.1. Generated Files
2.3.3.2. Start Services and Tasks
2.3.3.3. Using Communication Objects
2.3.3.4. Using Services
2.3.3.5. Status Codes
2.3.3.6. Component Wide Variables
2.3.3.7. Using Parameters Within the Component
2.3.4. Compile SmartSoft Component Projects
2.3.4.1. Add Additional Libraries
2.3.4.2. Add Compiler Flags
2.3.4.3. Add Your Own Source Files
2.3.5. Component Documentation
2.4. System Composition View
2.4.1. System Composition Project
2.4.2. System Configuration
2.4.2.1. System Configuration Model
2.4.2.1.1. Change Connections
2.4.2.1.2. Delete Components From the Model
2.4.2.2. Component Instance Configuration
2.4.3. System Deployment
2.4.3.1. Deployment model
2.4.3.2. Code Generation
2.4.3.3. Target Considerations
2.4.3.4. Deploying Additional Files
2.4.3.5. Start-Stop-Hooks
2.4.3.6. Predeploy Infrastructure
2.4.3.7. Deploying the Application
2.4.4. Running the Application
2.4.4.1. Running the Application from Toolchain
2.4.4.2. Running the Application without the Toolchain
2.4.4.3. Component Output and Log Files
2.5. Tips and Tricks
2.5.1. SmartSoft Full Build of Source Tree
2.5.2. SmartSoft and the RaspberryPi
2.5.2.1. Preconditions
2.5.2.2. Step by Step Instructions
2.5.3. Delete Model Elements
2.5.4. Common Error Messages
2.5.4.1. Component Development View
2.5.4.2. System Composition View

2.1. Introduction

The SmartMDSD Toolchain is based on Eclipse Modeling Tools and uses graphical and textual Domain Specific Languages (DSLs). It uses UML-profiles to implement the SmartSoft robotics meta-model SmartMARS and uses PapyrusUML for graphical modeling. Xtext is used for textual modeling. Additional assistants, validators, checks and glue-logic create the necessary bridges between the DSLs to achieve the overall workflow. Using other Eclipse plugins, e.g. CDT, the component developer can add business logic to the component and implement, for example, algorithms, glue code or reuse libraries. [4]

2.1.1. Installation and Requirements

For running SmartSoft, you need the SmartSoft kernel and ACE. We recommend the script-based installation as described on the website.

To run the SmartMDSD Toolchain we recommend Ubuntu 12.04 LTS and Java OpenJDK 1.6.0_36. A minimum of 4GB RAM is required if you only use few components, but we recommend 6-8GB+ for large setups.

We recommend to install the latest version of the SmartMDSD Toolchain using the installation script. If you prefer to install it manually, follow these instructions:

# wget http://sourceforge.net/projects/smart-robotics/files/latest/download?source=directory
# tar -xzf SmartMDSD-toolchain-X.X.tag.gz

You can start the toolchain by double clicking the extracted binary "SmartMDSD-toolchain-X.X/eclipse" (prefered/standard method).

2.1.2. Development Workflow

The development workflow is divided in modeling communication objects, modeling and implementing components and then using these components to integrate them by composition. The rest of this chapter follows this structure. For a complete description of the development workflow, please refer to [4].

2.1.3. Working with the SmartMDSD Toolchain and SmartSoft Framework

2.1.3.1. SmartMDSD and SmartSoft on the filesystem

After the script installation ACE is installed at $ACE_ROOT (typically /opt/ACE_wrappers) and SmartSoft is installed at $SMART_ROOT_ACE (typically $HOME/SOFTWARE/smartsoft). Existing SmartMDSD projects can be found at:

  • SmartSoft communication/coordination projects: $SMART_ROOT_ACE/src/interfaceClasses/

  • SmartSoft component projects: $SMART_ROOT_ACE/src/components/

  • SmartSoft deployment projects: $SMART_ROOT_ACE/src/deployments/

The most convenient place to keep new SmartSoft communication/coordination projects is in the directories listed above. If you would like to store SmartSoft communication/coordination projects on an other directory add the following line to your ~/.profile file:

export SMART_PACKAGE_PATH=$SMART_PACKAGE_PATH:<EXTERNALDIRECTORY>

Thereby, <EXTERNALDIRECTORY> has to be replaced with the directory to the SmartSoft communication/coordination project.

For technical reasons at the moment, you cannot have SmartSoft projects in a directory-tree that leads to other SmartSoft projects. In other words, do not keep a SmartSoft project in a direct hierarchy of another project. Example: it is not allowed to have a SmartSoft Component project at ~/SOFTWARE/smartsoft/, because there are other projects in ~/SOFTWARE/smartsoft/src/components/. However, you are fine to keep your custom projects in ~/my_projects/ or ~/SOFTWARE/smartsoft/src/my_components/ or even ~/SOFTWARE/smartsoft/src/components/. For most cases, e.g. if you are using version control, you will not encounter this problem.

2.1.3.2. Starting the SmartMDSD Toolchain for the First Time

This section will give first time toolchain users an manual on how to set-up the toolchain efficiently.

Start the toolchain by double-clicking the eclipse-executable (recommended) or executing ./eclipse in a terminal within the directory it has been extracted to. The toolchain will need read and write permissions to all imported eclipse projects, therefore we recommend to start the toolchain with the same user that has checked out the SmartSoft repository / installed SmartSoft.

During start-up the toolchain splash will be displayed stating the version of the toolchain. As is normal for eclipse, the user is asked to select a workspace containing projects and settings. How to organize different workspaces is completely up to the user, in case you have no experience with Eclipse we recommend to keep the multiple workspaces concentrated in one directory e.g. ~/WORKSPACES.

Starting the toolchain for the first time, a new workspace location could for example be: /home/$USERNAME/WORKSPACES/SmartMDSD_v2.10. New directories will be created if necessary.

Start toolchain and select new workspace

Figure 2.1. Start toolchain and select new workspace


Once the toolchain is completely started and a new empty workspace has been created the "Welcome to the Eclipse Modeling Tools" window will be shown. Closing this inner window will set up the standard (java) eclipse interface.

Start toolchain and select new workspace

Figure 2.2. Start toolchain and select new workspace


Eclipse features dedicated window arrangements called perspectives to support different task. The toolchain has its own perspective "SmartSoft". To use this perspective select in menu: Window->Open Perspective->Other... SmartSoft

Select the SmartSoft perspective to set-up up eclipse for efficient SmartSoft modelling use.

Figure 2.3. Select the SmartSoft perspective to set-up up eclipse for efficient SmartSoft modelling use.


Some toolchain projects make use of automatically triggered code generation, therefore it is necessary that eclipse is configured to build the projects in the workspace automatically. This setting is enabled by default, to ensure this the user can revisit the setting in the menu: Project->Build Automatically

The started SmartMDSD toolchain.

Figure 2.4. The started SmartMDSD toolchain.


Given this few steps the toolchain is ready to use. To make use of existing work (components, CommunicationObjects, deployments, etc.) a first step is to import those projects the user wants to reuse, into the workspace.

The different kind of toolchain projects (supporting different roles) depend on each other. Communication objects are wrapped in communication/coordination repository projects, they may depend on other projects of the same type, as communication objects can be nested. Component projects depend on communication/coordination repository projects as they are using communications objects to model the services a component features. Deployment projects depend on component projects as they are used to model a system consisting of components.

Dependent projects, e.g. a communication/coordination repository projects required by a component project, are not imported automatically. Therefor the user has to import all (direct and dependent) used projects.

Since the communication objects are the fundamental building blocks, their projects are typically the first thing to import.

To import projects into the workspace select in menu: File->Import. Within the Import dialog select: General->Existing Projects into Workspace continue with next and select the directory containing the projects to include e.g. /home/username/SOFTWARE/smartsoft/src/interfaceClasses. Eclipse will search recursively for projects from this directory on and will present a list of projects to import. In this example a list of all communication/coordination repository projects that are shipped within the smartsoft repo. Importing all existing communication/coordination repository projects into the workspace is in most cases a reasonable thing to do.

Import projects into the workspace, in this case communication/coordination repository projects projects.

Figure 2.5. Import projects into the workspace, in this case communication/coordination repository projects projects.


Once imported the toolchain starts building the projects (reading files and generating code in case the models have changed). The progress can be seen at the bottom right task bar of the toolchain. Other activities such as the C++ indexer for example are also displayed there.

It is important to note that building in this context is always related to eclipse projects and the models, not to the generated results (e.g. C++ code) so no C++ compiler will be triggered.

Toolchain with imported communication objects repository projects.

Figure 2.6. Toolchain with imported communication objects repository projects.


For components or deployment projects the same import procedure can be applied. How to use the imported projects and how to build new projects will be explained in the subsequent sections.

2.1.3.3. SmartMDSD Eclipse Projects

Communication objects, components and system configurations are Eclipse projects. The projects contain a model and source code which is generated from the model by a code generator. During code generation, files for generated code and handwritten code are created (using the generation-gap pattern which links user-code and generated-code by inheritance). The src-gen folder contains the generated code. These files must not be changed by the user, because they are regenerated each time the code generator is started. Therefore, changes to these files will be lost. Files for handwritten code are located in the src-folder. These files are generated once and provides method skeletons for user implementation. However, this means that the files have to be adjusted/deleted manually after renaming/ deleting the corresponding model element.

For automatic code generation and caching, make sure autobild is activated in the workspace. For that, choose Project->Build Automatically in eclipse. If autobild is enalbed, a check mark is shown in front of the menu entry "Build Automatically".

2.1.3.4. Version Control Considerations

All folders and files of the projects except the folders "bin" and "build" should be commited. These folders contain files which are altered as soon as the project is opened in the toolchain. Therefore, it is not advisable to add these folders to the version control.

WordPress Appliance - Powered by TurnKey Linux