How to Run RTI Connext DDS on Intel Edison Boards

1 Introduction


Note:
These instructions are based on RTI Connext DDS 5.2.0.

This HOWTO describes the steps you need to follow to set up your Edison board to build DDS applications. For this exercise, I directly compiled on the Edison target. Intel provides a cross compiler environment for different machines (see https://software.intel.com/en-us/iot/hardware/edison/downloads).

The document is organized as follows:

  • Section 2 explains how to set up your Edison board.
  • Section 3 shows how to install Java on your Edison board.
  • Section 4 explains how to install RTI Connext on your Edison Board.
  • Section 5 illustrates the development of DDS applications on Edison.

2 Setting up the Edison Board

First you need to setup your Edison board and connect to it since the Edison does not have a monitor interface built-in.

2.1 Getting started

Follow the getting started guide (https://software.intel.com/en-us/iot/library/edison-getting-started) to setup your board. The getting started guide will walk you through the steps of installing required drivers and firmware. It will also walk you through connecting to the Edison over USB. The getting started guide has instructions for Linux, Windows, and MacOS. This document was created using:

Linux edison 3.10.17-poky-edison+ #1 SMP PREEMPT Wed Apr 29 03:54:01 CEST 2015 i686 GNU/Linux

2.2 Connect to the Edison over WiFi

The easiest way to connect to an Edison is over WiFi. This allows you to easily transfer files using scp and remotely login using ssh. The Edison doesn’t have a display option so remote login is what you need. Follow the steps at https://software.intel.com/en-us/connecting-your-intel-edison-board-using-wifi.

3 Install Java

The standard image for Edison does not have Java installed. If you are planning on developing Connext applications in Java you need to install Java.

3.1 Getting the Java package

Download the latest Java version for Linux from Java (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). For example for Java Version 8 Update 51 download jdk-8u51-linux-i586.tar.gz. The file name will be different for different versions. The Edison doesn’t have a monitor and therefore no browser you need to download the package from your host computer and then transfer the tar.gz (e.g. jdk-8u51-linux-i586.tar.gz) file to the Edison using scp.

 3.2 Installing Java

Once you have the file transferred to the Edison you can install Java. The instructions below are for installing version Java 8 Update 51 (8u51). If you are installing another version, make sure you change the version number appropriately when you type the commands at the terminal.

Change to the directory in which you want to install Java. Move the .gz (e.g. jdk-8u51-linux-i586.gz) to the directory you want to install Java which should be the directory you are in currently. Unpack the tarball and install Java

tar zxvf jdk-8u51-linux-i586.gz

The Java files are installed in a directory called jre1.8.0_51 in the current directory. Delete the .gz file if you want to save disk space.

Change the .profile to add Java to the PATH environment variable. For example add:

export PATH=/opt/jdk1.8.0_51/bin/:$PATH

If you installed Java in /opt. Otherwise change the path accordingly. 

4. Install RTI Connext

Contact sales@rti.com to get the RTI Connext Professional 5.2 package for Linux or get the evaluation version rti_connext_dds-5.2.0-eval-x64Linux3gcc4.8.2.run from http://www.rti.com/downloads/index.html. Transfer the install package to your Edison and run the package:

./rti_connext_dds-5.2.0-eval-i86Linux3gcc4.8.2.run

And follow the instructions on the screen.

Change the .profile to add the RTI Connext directory to the  PATH environment variable and set the required environment variables.. For example if you installed RTI Connext in /opt add:

export NDDSHOME=/opt/rti_connext_dds-5.2.0
export PATH=$NDDSHOME/bin:$PATH
export LD_LIBRARY_PATH=$NDDSHOME/lib/i86Linux3gcc4.8.2:$LD_LIBRARY_PATH
export NDDS_LICENSE_FILE=$NDDSHOME 

If you installed Java in /opt. Otherwise change the path accordingly.

5 Compile and Run a Hello World Example

To validate your installation you can build a "hello world" application in C++ and Java using rtiddsgen on your Edison board.

5.1 C++ Example

Create a directory where you would like to build your application and change to the directiry

First, create a file called hello.idl with the following content:

1
2
3
4
struct hello_message {
   string name; //@key
   long count;
};

Use rtiddsgen to generate a C++ example for:

rtiddsgen -example i86Linux3gcc4.8.2 -language C++11 hello.idl

Note: Remember to export the NDDSHOME environment variable and include the bin/ directory in the PATH and as explained above.

The rtiddsgen utility generates several files, including a makefile and two source files with the publisher and subscriber applications. Now, edit hello_publisher.cxx and add some data to be sent. To do this, look for the comment "/* Modify the data to be sent here */" in the C++ source file and add the code highlighted here:

// Modify the data to be written here
sample.count(count);
sample.name("RTI Connext Professional");

std::cout << "Writing hello_message, count " << count << std::endl

To build the examples, use the makefile generated by rtiddsgen.

make -f makefile_hello_i86Linux3gcc4.8.2

Run the publisher

./objs/i86Linux3gcc4.8.2/hello_publisher  
Writing hello_message, count 0
Writing hello_message, count 1
Writing hello_message, count 2
Writing hello_message, count 3   

Open a second terminal (e.g. putty) and connect to the Edison board. Change to the directory where the source code for your example is and run the subscriber

./objs/i86Linux3gcc4.8.2/hello_subscriber 
hello_message subscriber sleeping for 4 sec...
[name: RTI Connext Professional, count: 1]
hello_message subscriber sleeping for 4 sec...
[name: RTI Connext Professional, count: 2]
hello_message subscriber sleeping for 4 sec...
[name: RTI Connext Professional, count: 3]
hello_message subscriber sleeping for 4 sec...

5.2 Java Example

This requires Java to be installed as described above. Just like in the C++ example, create a file called hello.idl with the following content in your computer:

1
2
3
4
struct hello_message {
   string name; //@key
   long count;
};

Use rtiddsgen to generate a Java example. Remember to set NDDSHOME to the right path before running the rtiddsgen.

rtiddsgen -example i86Linux3gcc4.8.2 -language java hello.idl

Edit hello_messagePublisher.java and add some data to be sent. To do this, look for the comment "/* Modify the data to be sent here */" in the Java source file and add the code highlighted here:

System.out.println("Writing hello_message, count " + count);

/* Modify the instance to be written here */
instance.name = "RTI Connext Professional";
instance.count = count;

/* Write Data */
writer.write(instance, instance_handle);

try { 
    Thread.sleep(sendPeriodMillis);
} catch (InterruptedException ix) {
    System.err.println("INTERRUPTED");
    break;
}

Build 

make -f makefile_hello_i86Linux3gcc4.8.2

Run the publisher:

make -f makefile_hello_i86Linux3gcc4.8.2 hello_messagePublisher 
java  -classpath ".:/media/sdcard/rti_connext_dds-5.2.0/lib/java/nddsjava.jar" hello_messagePublisher
Writing hello_message, count 0
Writing hello_message, count 1
Writing hello_message, count 2
Writing hello_message, count 3     

Open a second terminal (e.g. putty) and connect to the Edison board. Change to the directory where the source code for your example is and run the subscriber

make -f makefile_hello_i86Linux3gcc4.8.2 hello_messageSubscriber
java  -classpath ".:/media/sdcard/rti_connext_dds-5.2.0/lib/java/nddsjava.jar" hello_messageSubscriber
hello_message subscriber sleeping for 4 sec...
Received:
    name: RTI Connext Professional
    count: 0

hello_message subscriber sleeping for 4 sec...
Received:
    name: RTI Connext Professional
    count: 1

hello_message subscriber sleeping for 4 sec...
Received:
    name: RTI Connext Professional
    count: 2

hello_message subscriber sleeping for 4 sec...
Received:
    name: RTI Connext Professional
    count: 3