multithread_publisher with custom_transport
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

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?
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"
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.