Recording Topics from RTI Connext DDS Micro applications with RTI Recording Service
This solution describes steps to configure RTI Recording Service to record topics published by RTI Connext DDS Micro for post data-analysis and debugging.
RTI Connext DDS Micro provides a small-footprint modular messaging solution for resource-limited devices. It supports a subset of the standard and extended APIs and QoSs of Connext DDS.
One feature not supported currently by RTI Connext DDS Micro is the ability to send TypeCode information. TypeCodes are used by many of RTI’s tools to determine and display Type information. By default, the Record tool of RTI Recording Service expects TypeCodes for topics it receives. This may seem to be a problem when trying to use the Record tool with RTI Connext DDS Micro applications. However, this is not a problem because the Record tool also supports configuration of type information via an XML configuration file.
This solution uses RTI Connext DDS Micro and the “HelloWorld_dpde” example provided with RTI Connext DDS Micro: ~/rti_connext_micro.2.2.3/example/C/HelloWorld_dpde. The operating system is Ubuntu 12.04, with SQLite 3.7.9 2011-11-01.
Step 1: Generate or build an XML type-definition file
If you are using an IDL (Interface Definition Language) file to define your data types, you need to convert the IDL file into an XML type-definition file by using the rtiddsgen tool.
Caution: If you do not want to overwrite the existing DDS type-support files for your IDL, copy the IDL file to a separate directory, then run rtiddsgen. Note that rtiddsgen will also regenerate type-support files; however out of all the generated files, you only need the XML type-definition file.
For example, execute rtiddsgen with the option –convertToXml
and pass in your IDL file:
$ rtiddsgen -convertToXml HelloWorld.idl Running rtiddsgen version 5.0.0, please wait ... Done $ ls -l total 72 drwxrwxr-x 2 rticonnext rticonnext 4096 Jan 10 00:29 . drwxrwxr-x 10 rticonnext rticonnext 4096 Jan 10 00:27 .. -rw-rw-r-- 1 rticonnext rticonnext 5850 Jan 10 00:29 HelloWorld.cxx -rw-rw-r-- 1 rticonnext rticonnext 2819 Jan 10 00:29 HelloWorld.h -rw-rw-r-- 1 rticonnext rticonnext 45 Jan 10 00:28 HelloWorld.idl -rw-rw-r-- 1 rticonnext rticonnext 23636 Jan 10 00:29 HelloWorldPlugin.cxx -rw-rw-r-- 1 rticonnext rticonnext 8675 Jan 10 00:29 HelloWorldPlugin.h -rw-rw-r-- 1 rticonnext rticonnext 2739 Jan 10 00:29 HelloWorldSupport.cxx -rw-rw-r-- 1 rticonnext rticonnext 1701 Jan 10 00:29 HelloWorldSupport.h -rw-rw-r-- 1 rticonnext rticonnext 374 Jan 10 00:29 HelloWorld.xml
Here you can see the difference between a type definition in IDL and XML. For more details, see the XML-Based Application Creation Getting Started Guide.
struct HelloWorld { string<128> msg; };
<?xml version="1.0" encoding="UTF-8"?> <types> <struct name="HelloWorld"> <member name="msg" stringMaxLength="128" type="string"/> </struct> </types>
For simplicity and to follow the rest of the steps, rename the generated XML type definition file HelloWorld.xml to HelloWorld_type.xml.
Note: Use the version of rtiddsgen provided with regular RTI Connext DDS, since the code generator provided with RTI Connext DDS Micro does not include the -convertToXml
option. Otherwise you will get the following error message,
ERROR com.rti.ndds.nddsgen.Main Invalid option –convertToXml
Step 2: Configure the XML configuration file for RTI Recording Service
Add the Type definition (the XML generated in Step 1 above) to the RTI Recording Service configuration file.
For example, review HelloWorld_rec_cfg.xml for Connext 5.3.1 and earlier, and HelloWorld_rec_cfg6.xml for Connext 6.0.0 and above. These files are attached at the bottom of this article.
Step 3: Launch the Record tool from a command line
Run the Record tool. For example, if using Connext 5.3.1 or earlier,
$ rtirecord -cfgFile HelloWorld_rec_cfg.xml -cfgName example RTI Recorder started
If using Connext 6.0.0 and above,
$ rtirecordingservice -cfgFile HelloWorld_rec_cfg6.xml -cfgName example RTI Recording Service (Recorder) 6.0.1 starting...
This will create a database and store your published samples in it. Later, you can inspect the database contents using sqlite3 (see Step 5 below). You can also use the Replay tool to playback the recorded samples. You can find more information about the Replay tool in Chapters 4 in the RTI Recording Service User’s Manual.
To stop the Record tool, press “Control + C”.
Step 4: Start the RTI Connext DDS Micro Publisher and Subscriber applications
For a Topic and data recording, you only need to run the Publisher application. You will see "Matched a subscriber" if the Record tool is already running and subscribed to the published topic type (defined in and passed thru HelloWorld_type.xml to the Record tool in an RTI Recording Service configuration XML file).
$ ./objs/i86Linux2.6gcc4.4.5/HelloWorld_publisher Hello World! (0) Hello World! (1) Matched a subscriber Hello World! (3)
Running the Subscriber application is optional. But it is good to see if the Subscriber is getting data from the Publisher in real-time. Alternatively, you can follow Step 5 in parallel to view the data with <1 sec delay.
$ ./objs/i86Linux2.6gcc4.4.5/HelloWorld_subscriber Matched a publisher Running for 24 hours, press Ctrl-C to exit Sample received msg: Hello World! (0)
NOTE: Make sure you are publishing data using the same domain ID (e.g. domain ID 0) you have configured in the RTI Recording Service XML configuration file (e.g., HelloWorld_rec_cfg.xml).
Step 5: Verify the recorded data
To verify the recorded data, there are multiple options. One can replay the data using RTI's Replay Service, or alternatively, one could use sqlite3 to directly examine the contents of the database file.
To use Replay Service in Connext version 6.x, download the helloworld_rep_cfg6.xml file, ensure that your working directory includes the simple_config.dat recording file created in previous steps, and run the following command:
$ rtireplayservice -cfgFile helloworld_rep_cfg6.xml -cfgName example RTI Recording Service (Replay) 6.1.0 starting...
While the Replay Service is running, start up the Micro subscriber as outlined in Step 4 above. You should see the Micro subscriber recieve samples from the Replay Service.
To use sqlite3 to directly examine the database written by Recording Service, open the dataBase (“simple_config.dat_0_0” if using Connext 5.3.1, or "simple_config.dat" if using Connext 6+) using sqlite3 and list the available tables (sqlite> .tables
). The data published for the topic "Example HelloWorld" is recorded in the table “Example HelloWorld$RecordAll$domain0” in Connext 5.3.1 and below, and in Connext 6+ the table is called "Example HelloWorld@0".
Further related details can be found in the RTI Recording Service User's Manual.
$ sqlite3 simple_config.dat SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables Example HelloWorld@0 sqlite> select * from "Example HelloWorld@0"; 1382438856898131|0|0|2|1|1|1382438856|898066996|0|0|0|0|-950573486|1087397860|-557797922|2563|0|0|0|0|0|1382438856898131|000002|000001|1|Hello World! (1) 1382438857898667|0|0|2|2|1|1382438857|898586997|0|0|0|0|-950573486|1087397860|-557797922|2563|0|0|0|0|0|1382438857898867|000003|000002|1|Hello World! (2) 1382438858899436|0|0|2|2|1|1382438858|899352998|0|0|0|0|-950573486|1087397860|-557797922|2563|0|0|0|0|0|1382438858899436|000004|000003|1|Hello world! (3) ...
Alternatively, to view the data using a GUI tool, you can use SQLite Studio (http://sqlitestudio.pl/).