eProsima Micro XRCE-DDS Gen

eProsima Micro XRCE-DDS Gen is a Java application used to generate source code for the eProsima Micro XRCE-DDS software.

This tool can generate from a given IDL specification file, the C struct associated with the Topic, as well as the serialization and deserialization methods. Also, it can generate a sample demo that works with the proposed topic. As an example of the potential of this tool, the following shows the source code generated from the ShapeDemo IDL file.

// ShapeType.idl

struct ShapeType {
    @key string color;
    long x;
    long y;
    long shapesize;

If we will perform the following command:

$ microxrceddsgen ShapeType.idl

it will generate the following header file and its corresponding source:

 * @file ShapeType.h
 * This header file contains the declaration of the described types in the IDL file.
 * This file was generated by the tool gen.

#ifndef _ShapeType_H_
#define _ShapeType_H_

#include <stdint.h>
#include <stdbool.h>

 * @brief This struct represents the structure ShapeType defined by the user in the IDL file.
 * @ingroup SHAPETYPE
typedef struct ShapeType
    char color[255];
    int32_t x;
    int32_t y;
    int32_t shapesize;

} ShapeType;

struct ucdrBuffer;

bool ShapeType_serialize_topic(struct ucdrBuffer* writer, const ShapeType* topic);
bool ShapeType_deserialize_topic(struct ucdrBuffer* reader, ShapeType* topic);
uint32_t ShapeType_size_of_topic(const ShapeType* topic, uint32_t size);

#endif // _ShapeType_H_

eProsima Micro XRCE-DDS Gen is also able to generate both publisher and subscriber source code examples, related with the topic specified in the IDL file, by adding the flag -example:

$ microxrceddsgen -example <file.idl>

The Client library must be compiled with the WRITE_ACCESS_PROFILE option for the publisher, to use these examples and the READ_ACCESS_PROFILE option for the subscriber.


To use eProsima Micro XRCE-DDS Gen, it is needed to follow the next steps:

  1. Install its dependencies:

    1.1 Gradle.

    1.2 Java JDK.

  2. Clone the code from the GitHub repository.

    $ git clone --recursive https://github.com/eProsima/micro-XRCE-DDS-gen.git
    $ cd micro-XRCE-DDS-gen
  3. Build the code with Gradle.

    $ gradle build


At present, eProsima Micro XRCE-DDS Gen only supports Structs composed of integer, string, array and sequence types, even though it is planned to enhance the capabilities of the eProsima Micro XRCE-DDS Gen tool in a near future.