micro_ros_espidf_component icon indicating copy to clipboard operation
micro_ros_espidf_component copied to clipboard

multithread_publisher with custom_transport

Open shecker opened this issue 3 years ago • 2 comments

Hello,

I would like to use the multithreaded publisher example with custom_transport via a usb cable. We are using the latest foxy branch.

Unfortunately I get a continuous reconnection on the host side with the publishers being created but then the client getting deleted.

Does anyone know what the issue may be? Thanks Screenshot from 2022-08-17 08-49-44

shecker avatar Aug 17 '22 06:08 shecker

Hi @shecker, a few questions:

  • Did you modify the example in any way? (I see three publishers are created instead of two as in the example).
  • Does your code works with the default UDP or the provided serial transport?
  • Could you elaborate on how your custom transport works?

Acuadros95 avatar Aug 17 '22 06:08 Acuadros95

Hi @Acuadros95

Thanks for your reply. I've done further debugging and have prevented the esp32 from restarting. Now it either publishes with "-DUCLIENT_PROFILE_MULTITHREAD=OFF" or does not connect at all with "-DUCLIENT_PROFILE_MULTITHREAD=ON"

  • I modified the multithread_publisher example by adding in the custom transport functionality from the int32_publisher_custom_transport. I have attached the file here. In addition I modified the app-colcon.meta to include
"microxrcedds_client": {
    "cmake-args": [
        "-DUCLIENT_PROFILE_MULTITHREAD=ON"
    ]
},
  • My code does not use UDP but serial transport.
  • I followed the example int32_publisher_custom_transport but set the baud rate higher (2000000) -> this works well without multithreading.

I believe the issue occurs when I change this line from ON to OFF: "-DUCLIENT_PROFILE_MULTITHREAD=ON"

shecker avatar Aug 17 '22 15:08 shecker

I believe the issue occurs when I change this line from ON to OFF: "-DUCLIENT_PROFILE_MULTITHREAD=ON"

That is expected, this option enables micro-ROS multithread support. It needs to be enabled for any multithreaded micro-ROS app.

Acuadros95 avatar Aug 18 '22 05:08 Acuadros95