[Closed] QoS and ROS2 middleware rmw_fastrtps

Hello!

I’m having issues while configuring the ROS2 Middleware for Fast DDS (rmw_fastrtps).

Current configuration:
On ROSbot:
export ROSBOT_VER=ROSBOT_2.0_PRO
export ROS_DISTRO=foxy
export ROS_DOMAIN_ID=20
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

        **On computer:**
        export ROS_DOMAIN_ID=20
        export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

While running on ROSbot a minimal publisher, it publishes ok:

        husarion@ubuntu:~$ ros2 run examples_rclcpp_minimal_publisher publisher_lambda

        [INFO] [1656346000.250770345] [minimal_publisher]: Publishing: 'Hello, world! 0'
        [INFO] [1656346000.750609227] [minimal_publisher]: Publishing: 'Hello, world! 1'
        [INFO] [1656346001.250527519] [minimal_publisher]: Publishing: 'Hello, world! 2'
        [INFO] [1656346001.750565720] [minimal_publisher]: Publishing: 'Hello, world! 3'
        [INFO] [1656346002.250651745] [minimal_publisher]: Publishing: 'Hello, world! 4'
        ...

On computer I can see our topic (named /topic):

        computerPrecision-3561:~/ros2_ws$ ros2 topic list
        /parameter_events
        /rosout
        /topic

But I cannot read content (it waits forever once executed this command-line):

        computerPrecision-3561:~/ros2_ws$ ros2 topic echo /topic
        ...

I’ve tried to force QoS parameters (16.1. Configuring Fast DDS in ROS 2 — Fast DDS 2.8.1 documentation) and several QoS configurations through XML files (Unlocking the potential of Fast DDS middleware [community-contributed] — ROS 2 Documentation: Rolling documentation). But I’m not having success.

Sometimes it has worked, but the second time that I re-run…the same problem appears again (with no changes between actions)

I’d be very grateful if someone knows the configuration that I need.

Thanks a lot!

Hi Nannerl,

I was trying to reproduce your issue and only magaged to do so when playing with xml file with profile configuration. It was happening when xml file was missing subscriber proflie.
I was able to successfully run simple talker - listener demo with below config:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">

    <!-- default publisher profile -->
    <publisher profile_name="default_publisher" is_default_profile="true">
        <historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
    </publisher>

    <!-- publisher profile for topic sync_topic -->
    <publisher profile_name="/chatter">
        <historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
        <qos>
            <publishMode>
                <kind>ASYNCHRONOUS</kind>
            </publishMode>
        </qos>
    </publisher>
    
    <!-- subscriber profile for topic sync_topic -->
    <subscriber profile_name="default_subscriber" is_default_profile="true">
	<historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
    </subscriber>

</profiles>

Remember that you have to use that file on both robot and your pc.
If you still have problems it is a good idea to contact eProsima about fast DDS they may have better idea what could be the problem.

Regards,
Dawid

I really thank you. I’ve tried this solution, but both DYNAMIC and PREALLOCATED_WITH_REALLOC are giving the following error: not enough memory in the buffer stream.

2022-07-05 03:01:14.867 [RTPS_READER_HISTORY Error] Change payload size of ‘72’ bytes is larger than the history payload size of ‘35’ bytes and cannot be resized. → Function add_change

2022-07-05 03:01:14.872 [RTPS_READER_HISTORY Error] Change payload size of ‘96’ bytes is larger than the history payload size of ‘35’ bytes and cannot be resized. → Function add_change

terminate called after throwing an instance of eprosima::fastcdr::exception::NotEnoughMemoryException’
what(): Not enough memory in the buffer stream

Hi Nannerl,

If this is not an entire error message could you pass it and add your xml config so I can try to reproduce this error? Also, remember when using xml configuration to export:

export RMW_FASTRTPS_USE_QOS_FROM_XML=1
export FASTRTPS_DEFAULT_PROFILES_FILE=path/to/config.xml

Regards,
Dawid

Hi Dawid.

I thank you. This is the entire error message. However, the xml config used is

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">

    <!-- default publisher profile -->
    <publisher profile_name="default_publisher" is_default_profile="true">
        <historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
    </publisher>

    <!-- publisher profile for topic sync_topic -->
    <publisher profile_name="/chatter">
        <historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
        <qos>
            <publishMode>
                <kind>ASYNCHRONOUS</kind>
            </publishMode>
        </qos>
    </publisher>
    
    <!-- subscriber profile for topic sync_topic -->
    <subscriber profile_name="default_subscriber" is_default_profile="true">
	<historyMemoryPolicy>DYNAMIC</historyMemoryPolicy>
    </subscriber>

</profiles>

Trying this same .xml with the following values for all profiles:

DYNAMIC

PREALLOCATED_WITH_REALLOC

Additionally, ok to this :slight_smile:

export RMW_FASTRTPS_USE_QOS_FROM_XML=1
export FASTRTPS_DEFAULT_PROFILES_FILE=path/to/config.xml

I really appreciate your help.

Hi Nannerl,

Sorry for the late response. Your configuration looks fine, I was trying it and everything seems to work just fine. About the error, it usually appears when you have an error in your xml config or when missing or specifying the wrong path to that file. Make sure you don’t have a typo in your xml file path or variables names. If this still doesn’t resolve your problem I suggest contacting eProsima directly about fast rtps.

Best regards,
Dawid