Supporting Material for EclipseCon’17 unconference

Title: Developing Robotic Applications Using Model-Driven Engineering Techniques

This workshop gives attendees an opportunity to gain practical experience in combining Model-Driven Engineering with the development of robotic applications using UML for Real-Time (UML-RT) and Papyrus-RT. UML-RT is a profile of UML specifically designed for Real-Time and Embedded (RTE) systems. It has a long, successful track record of application and tool support via, e.g., IBM Rational RoseRT, IBM RSA-RTE, and now Papyrus-RT. Papyrus-RT is an Eclipse-based, open-source modeling development environment for UML-RT systems. It allows the generation of complete, executable code from models and advances the state-of-art via support for model representation with mixed graphical / textual notations and an extensible code generator.

This workshops will consist of several interleaving examples and hands-on sessions in order to familiarize attendees with the development of robotic applications using Papyrus-RT. It includes the following steps: – a) Introduction to the core modelling concepts of UML-RT (capsules, protocols and ports, state machines) and code generation with Papyrus-RT, and b) the graphical representation and modification of structural and behavioural models in Papyrus and their use for code generation; – a) Introduction to the modelling of robotic applications with Papyrus-RT and deployment on target platforms (Raspberry PI) and b) hands-on sessions for modelling simple use cases with basic sensors and actuators (LED, push button, presence sensor, ultra-sonic detection sensor, etc.); – a) Introduction to the Eclipse PolarSys Rover, and b) development with Papyrus-RT of simple scenarios to drive the Rover (move forward, move backwards, rotate, etc.); – Development of more complex robotic applications (follow the line, obstacle detection and avoidance, etc.) using Papyrus-RT.

Audience: the intended audience includes everybody interested in robotic systems and the use of modelling for the development of robotic applications. Industrial practitioners, researchers from academia and industry, as well as educators are welcome and should be able to benefit. Some prior exposures to class modelling and behavioural modelling with state machines in UML are useful. Some knowledge in the development in single-board computer is not mandatory. Prior exposures to UML-RT is not mandatory as an introduction will be given at the beginning of the session. Attendees are expected to have basic notions in Unix commands (e.g., cd, ssh, make). Some single-board computers, including a bare RaspberryPI 3 with sensors / actuators will be provided to attendees to test their development. Attendees are expected to bring their own laptops.

Slides of the workshop are available here.

Supporting Material

In order to prepare the hand’s sessions, we invite the attendees to install Papyrus-RT and set up their environment. It is done by following the steps below:

 

Requirements:

  • Java 8 JRE or JDK
  • The Papyrus-RT runtime environment (i.e., the implementation of the underlying infrastructure to, e.g., create capsules, timers, and timeouts, and deliver messages) runs on Linux. So, if you’re installing Papyrus-RT into a Linux environment, you will not need anything extra to be able to compile and run the code generated by Papyrus-RT from the model. However, to do that in a Windows or macOS environment you will need additional software:
    • Windows: you also need to install either (1) Cygwin, or (2) a Virtual Machine Manager (a.k.a., ‘hypervisor’) such as VirtualBox or VMWare together with the Vagrant virtual development environment. If you are feeling adventurous, you can try the ‘Bash on Ubuntu on Windows’ in Windows 10 which apparently allows you to run Linux applications; however, I have no more information on this.
    • macOS: as for Windows, you can use a hypervisor and Vagrant

 

Installing Papyrus-RT:

  1. Get the last version of the Papyrus-RT RCP from the Papyrus-RT download page
  2. Extract the archive and double-click on Papyrus-RT.
  3. Papyrus-RT will prompt you to enter a workspace path. Select the path that you want.

You are all set and ready to use Papyrus-RT !

 

Preparing the environment for building:

Preparing the environments for building is not a requirement for using Papyrus-RT and generating code. It is however required if you want to compile and test the code you generated with the tool. To do it, several steps has to be followed. Below is a digest version of the instructions that are available on the Papyrus-RT wiki.

  • On Linux:
    1. Open a console and locate the folder <YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts
    2. Execute the make command to compile the Papyrus-RT runtime environment
    3. Get the absolute path of the <YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts folder using pwd
    4. Export the UMLRTS_ROOT variable as following (alternatively, you can add it to your .bashrc file):
      $ export UMLRTS_ROOT="<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts"
  • On Windows (Using Cygwin):
    1. Open Cygwin and locate the folder /cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts
    2. Get the absolute path of the /cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts folder using pwd
    3. Export the UMLRTS_ROOT variable as following (alternatively, you can add it to your .bashrc file):
      $ export UMLRTS_ROOT="/cygdrive/c/<YourEclipseInstallation>/plugins/org.eclipse.papyrusrt.rts_0.9.0.<VersionNumber>/umlrts"

For additional information, or for Vagrant users, please follow the instructions here.

 

Importing the models:

The models that will be used during the workshop are available for download here: EclipseCon17-Papyrus-RT-Models.

  1. Once the archive is downloaded (you do not have to extract it), open Papyrus-RT and select `File > Import…’ from the top menu bar
  2. Select `General / Existing Projects into Workspace‘ and hit `Next
  3. Check the second radio button `Select archive file’ and hit `Browse
  4. Locate the archive and hit `OK
  5. Select all the projects and hit `Finish

 

Building the PingPong model:

Generating code from a model and compiling an application with Papyrus-RT is very simple. Instructions below give you an example on how to generate and compile code on the different platforms:

  • Generating code (all platforms):
    1. Make sure that the Papyrus perspective is selected (visible on the top right corner of Eclipse). If not, select `Open perspective‘  and choose `Papyrus
    2. Open the PingPong model using the Project Explorer
    3. In the Model Explorer, right-click on the RootElement and hit `Generate all code
    4. A new project called PingPong_CDTProject will be created and imported into your workspace
  • Compiling on Linux:
    1. Using the console, locate the folder containing the generated code (it should have the following name: PingPong_CDTProject)
    2. Go the the `src’ folder
    3. Execute the make command:
      $ make
  • Compiling on Windows (using Cygwin):
    1. Using Cygwin, locate the folder containing the generated code (it should have the following name: PingPong_CDTProject)
    2. Create a build folder using the following command:
      $ mkdir build
    3. Go the the `build’ folder
    4. Execute the cmake command as follow:
      $ cmake ../src
    5. Execute the make command:
      $ make

For additional information, or for Vagrant users, please follow the instructions here.