ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

here is an example for anyone wondering how to do it. https://github.com/HemaZ/FastRTPS-ROS2

here is an example for anyone wondering how to do it. https://github.com/HemaZ/FastRTPS-ROS2

First we need to get all the messages dependencies from ROS2 installation.

Example if we need to build sensors_msg/Image we should build all of the message dependencies. Image -> Header -> Time

we can get these messages from

/opt/ros/dashing/share/sensor_msgs/msg/Image.idl
/opt/ros/dashing/share/std_msgs/msg/Header.idl
/opt/ros/dashing/share/builtin_interfaces/msg/Time.idl

and copy them to current directory.

edit this line

#include "builtin_interfaces/msg/Time.idl"

in Header.idl to #include "Time.idl"

edit this line in Image.idl #include "std_msgs/msg/Header.idl" to #include "Header.idl"

generate the messages using fastrtpsgen like this

fastrtpsgen -example CMake Image.idl

edit line #37 in ImagePubSubTypes.cxx to setName("sensor_msgs::msg::dds_::Image_");

Edit topic name in ImagePublisher.cxx and ImageSubscriber.cxx and add rt/ before the topic name. ie Wparam.topic.topicName = "rt/ImagePubSubTopic";

Add these two lines under the above line.

Wparam.qos.m_publishMode.kind = ASYNCHRONOUS_PUBLISH_MODE; // To handle big data
Wparam.historyMemoryPolicy = rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;

build the project

mkdir build
cd build
cmake ..
make
./Image publisher