micro-ROS / micro_ros_arduino

micro-ROS library for Arduino
Apache License 2.0
449 stars 117 forks source link

Unable to invoque a service if MicroRos agent is compiled with -DRMW_UXRCE_CREATION_MODE=refs #1789

Open jpgarduino opened 5 months ago

jpgarduino commented 5 months ago

Hardware description: Portenta H7 Installation type:github,linux command line Version or commit hash: humble

I use MicroRos to communicate a Portenta H7 with ROS2 Humble in a Ubuntu 22.04 PC. Portenta H7 has subscrivers and publisers and, also, request to services that are hosted in the PC.

If MicroRos Agent is compiled WITHOUT "-DRMW_UXRCE_CREATION_MODE=refs" option, system works as expected. But if agent is compiled WITH "-DRMW_UXRCE_CREATION_MODE=refs" option, Portenta is unable to perform request to any service. Publishers and subscribers work correctly in this scenerario.

Agent is launched with this command line:

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0 --middleware dds -v6 ROS_DOMAIN_ID=$ros_domain_id -r /root/TestServices/custom_qos_test.refs

The content of custom_qos_test.refs file is:

<profiles>
    <participant profile_name="participant_profile">
        <rtps>
            <name>default_xrce_participant</name>
        </rtps>
    </participant>

    <!-- QOS for TestInt32 (RELIABLE) -->
    <topic profile_name="TestInt32__t">
        <name>rt/TestInt32</name>
        <dataType>std_msgs::msg::dds_::Int32_</dataType>
        <historyQos>
          <kind>KEEP_LAST</kind>
          <depth>5</depth>
        </historyQos>
    </topic>

    <data_writer profile_name="TestInt32__dw">
        <historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
        <qos>
          <reliability>
            <kind>RELIABLE</kind>
          </reliability>
          <durability>
            <kind>VOLATILE</kind>
          </durability>
        </qos>
        <topic>
            <kind>NO_KEY</kind>
            <name>rt/TestInt32</name>
            <dataType>std_msgs::msg::dds_::Int32_</dataType>
            <historyQos>
                <kind>KEEP_LAST</kind>
                <depth>5</depth>
            </historyQos>
        </topic>
    </data_writer>

    <requester profile_name="TestService_requester"
               service_name="/TestService"
               request_type="mss_types::srv::dds_::SetPose_Request_"
               reply_type="mss_types::srv::dds_::SetPose_Response_">
    </requester>

    <replier profile_name="TestService_replier"
             service_name="/TestService"
             request_type="mss_types::srv::dds_::SetPose_Request_"
             reply_type="mss_types::srv::dds_::SetPose_Response_">
    </replier>

</profiles>

The problem ocurrs as soon portenta tries to send the request of the service:

image

In fact, when the error occurs, the data of frame shown in the agent is the following:

image

Translating the hex code to ASCII, the result is:

€r d<dds><requester profile_name="0_7" service_name="/TestService" request_type="mss_types::srv::dds_::

image

I don't know if it is a problem with .refs file configuration, but the problem seems to be limited to the services: