Table Of Contents

Previous topic

RobotML Modeling Platform

Next topic

ARROCAM RobotML Generator

This Page

RobotML Code Generators

RobotML is using Acceleo as a code generator transforming models into code (MDA approach).

See also

Acceleo website

Go to Acceleo tutorials page.

RobotML generators allowed to generate source code from the RobotML model to some middleware or simulator. They are include in the RobotML platform, and using Acceleo to browse the RobotML model.

List of the RobotML platform generators:

RobotML generator <CodeGenerators/RobotMLGenerators/RobotMLGenerators>
Naming conventions <NamingConventions> Standard sensors structures <StandardSensorsStructures>

How to create a new RobotML generator

In your Project explorer view, do right clic and select New/Project... In the New project window, choose Acceleo prject in the Acceleo model to text category, and clic on Next.

New project window

In the window Create a new Acceleo generator project, name your project, and select the 1.5 JAVA version (J2SE-1.5). Clic on Next.

New Acceleo generator project window creation.

Now named your new module, and on the add button in the metamodel section. A metamodel list is shown. Select your metamodel should to use, and clic on OK. For example if you should use UML, select in the developpement time version tab.


If you should use a custom domain specific language, select your metamodel in the Runtime version tab.

Select your module type:

  • Template, if you should to realize some generation with the metamodel.
  • Query, if you should to do a functions library.

Clic on Finish

Module properties

Your new RobotMLGenerators will added in your Project explorer. Now

Adding a new module to an existing RobotML generator

On your Acceleo generator project, do right clic, and select new/Other.... Chosse Acceleo module file in the category Acceleo model to text, and clic Next.

Name your module, select the metamodel should to use, and select the module type. Clic on Finsih.

See also

How to create a new RobotML generator

Adding your new generator in the RobotML generator interface

Import the RobotML generator project in your workspace (org.eclipse.robotml.generators.generator.ui). Open the file MANIFEST.MF and slect the Dependencies tab. In the Required plug-in section, add your generator plug-in. In the package org.eclipse.robotml.generators.generator.ui.xml, open the file config.xml, and add you generator declaration int the generator_list node.

The following example show how to declare generators:

      <domain name="athenaDSL">
         <implementation class="org.xtext.athenaDSL.impl.AthenaDSLFactoryImpl" method="init"/>
         <implementation class="org.xtext.athenaDSL.impl.AthenaDSLPackageImpl" method="init"/>
      <generator name="athena" id="org.eclipse.robotml.generators.acceleo.athena" class="org.eclipse.robotml.generators.acceleo.athena.files.GenerateAthena" src-type="model" target-folder="athena"/>
      <generator name="vle" id="org.eclipse.robotml.generators.xtext.athena.vle" class="org.eclipse.robotml.generators.xtext.athena.vle.main.GenerateVLE" src-type="file" src-ext="adl" target-folder="vle-generated-src" src-enerator="athena"/>
      <generator name="athena-simu" id="org.eclipse.robotml.generators.xtext.athena.simu" class="org.eclipse.robotml.generators.xtext.athena.simu.main.GenerateAthena" src-type="file" src-ext="adl" target-folder="simu-athena-generated-src" src-generator="athena"/>
Node Attribute Description
robotml   Root node.
domain_list   Declaration node for a domain list.
  • name
Domain language declaration. - Language name.
  • class
  • method
Implementation declaration. - Class containing the method to call. - Method name to call.
generator_list   Declaration node for a generator list.
  • name
  • id
  • class
  • src-type
  • src-ext
  • target-folder
  • src-generator
Generator declaration. - Generator name. - Generator ID (org.eclipse.robotml.generators.XXX). - Generator class. - Source type (model or file). - Source file extension (Only if src=”file”). - Target folder name. - Name of the source generator used to generate the source file (only if src=”file”).


If your should to define a new Domain Specific Language, you shoukd to declare it on the file config.xml. Add a domain node, and specify the implementation to initialize your domain language (see the example).

Create a user interface for a RobotMl generator

In your Acceleo generator project,, do right clic, and select Acceleo/Create Acceleo UI launcher. Name you UI project, clic on Next. Select the project who will be called by your interface.

Project list for the user interface.

Give a label to your generator.


This label will be visible in the environment context menu.

Choose your working file filter. Your generator interface will be visible only if the selection match this file filter. Clic on Finish.

User interface properties.

Implement a RobotML generator in your user interface

In your Acceleo User interface project, open the file, and modifiy the method doGenerate() as following:

public void doGenerate(IProgressMonitor monitor) throws IOException {
   if (!targetFolder.getLocation().toFile().exists()) {


   //GenerateXXX is the main class of the RobotML generator. By convention, <XXX> is the name of the generator.
   //Example for `Athena` langauge, the name of the main class is GenerateAthena.
   GenerateXXX generator = new GenerateXXX(modelURI, targetFolder.getLocation().toFile(), arguments);
   String generationID =
      new ArrayList<String>());

Validate a new RobotML generator

In your project explorer view, select your RobotML generator, and do right clic. Choose, Run as.../Eclipse application. A new eclipse applciation start. In this new envioronment, import the needed files to execute your generator, then select a imported file, do right clic. The contextual menu, should contain your gnerator label. Select it to execute your generator.


In exception, if you using particular metamodel, it’s necessary to register it befor using. For example : if you use the DSL Athena, you should to initialized it with the following methods in your user interface code.


You need also to modifiy the RobotML generator code registerPackage method as following:

public void registerPackages(ResourceSet resourceSet) {
   if(!isInWorkspace(org.xtext.athenaDSL.AthenaDSLPackage.class)) {


Do not forget replace the tag @generated by @generated not to not loosing your modification, when you modifiy the template file module.