ROS 2 Messages

ros2mappingpanel.png

Reference Information ESD405/IXXAT/Peak

I/O Card Model Number

N/A

I/O Driver Model Number

ROS2 Foxy

I/O Module License:

ICS-SWB-1212.

Description

Starting with Simulation Workbench 2022.2, we added support to exchange ROS 2 messages. The ROS 2 Message I/O task provides support for ROS 2 messages under ROS Foxy distribution on the RedHawk / Ubuntu 20.04 version of Simulation Workbench only. This is implemented on top of the existing Linux network layer.

Support for a limited number of ROS messages is provided. Additional message support would require enhancements to this I/O task.


 
 
 

Prerequisite for ROS Messages Support

To use ROS messages, you must install ROS foxy on your ubuntu based RedHawk system.

Follow the steps provided at https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html

By default the ROS software will be installed in /opt/ros/foxy. Do not change the default location as this location is used by Simulation Workbench to source the environment needed to run ROS applications.

Supported ROS Messages

For the messages mentioned above, Simulation Workbench supports both subscriber and publisher modes of communication.
For published message, the transmission can be scheduled at a determined rate specified in milliseconds or whenever the content of the message as mapped to RTDB items changes.

ROS Message Mapping

Before mapping RTDB items to a ROS message, a message must be created either as a publisher or subscriber. The message topic specified is the one that will be advertised by the ROS management layer.
The fields available for mapping on a specific message are determined by the structure of the message. When creating a new ROS message, the fields will be displayed in the I/O panel under the specific message.
Because of the nature of some ROS messages, those that include variable size arrays of objects cannot be mapped to simple RTDB items. To resolve the problem, a new concept of "structure mapping" has been introduced.
The Structure Mapping tab on the right side of the I/O mapping panel is enabled only when a ROS field that accept structure mapping is selected. Such field are suffixed with the "-Struct" string. When a non "structure" field is selected under the ROS message, the Structure Mapping is disabled and the "Item Mapping is enabled. In this case, the normal simple item mapping behavior applies.
 
For instance , the ObjDataArray message is defined as :

It is impossible to fill this message with simple RTDB item values.
In order to map RTDB items to this message, we define RTDB items with the following names:
The [5] means that RTDB items name input.object[0]... to input.objects[4]... will be created when loading the RTDB in memory.
Also, the ROS message will contain an array of 5 ObjData objects.

In this case if we map the "structure" input.objects[0] to the objects field of the ROS message, the RTDB items that exist under the input.objects[0..4] will populate the array ObjData[] in the message.
For this to work , the items names under the "structure" input... must match the field names defined in the ROS message.
If there is a mismatch between RTDB item names and ROS message fields, a dialog is displayed indicating the mismatch.


 
 
 
 
 
 
 
 
 
 
 
 

ROS Example RTDB & Tests

A series of example RTDB's and Tests is provided as part of the Simulation Workbench. The examples are under the ROS project under the Hardware-Tests project.
All the RTDB's contain a loopback configuration where a publisher message of one type/.topic is looped back to a subscriber message of the same type/topic.
You should be able to run those tests provided your installation of ROS is working.