Closed gsokoll closed 1 year ago
Probably you will need to use rcl_init_options_fini
somewhere when using custom domains. Please read the RCL API documentation.
I suspected there might need to be a fini for the init_options (and had a comment in my code to that effect), but didn't find it when googling. Might have googled for rclc_init_options_fini by mistake.
In any case - I have added rcl_init_options_fini to my destroy_entities function now and it seems to be working reliably. Thanks.
Issue template
Steps to reproduce the issue
We are attempting to build a test app to ensure the micro ros connection can tolerate either the host or client device restarting, and/or interruptions to the network. We have used code similar to https://docs.vulcanexus.org/en/humble/rst/tutorials/micro/handle_reconnections/handle_reconnections.html with the addition of specifying the custom domain id per code similar to https://github.com/micro-ROS/micro-ROS-demos/blob/45f342d4ef887f6a2e9f2dfa45d1d3388d7f6dbd/rclc/configuration_example/configured_publisher/main.c#L49
Our actual code is given below.
Expected behavior
If we do NOT attempt to use a custom domain (calling rclc_support_init() without any options), the app works as expected.
Actual behavior
If we DO attempt to use a custom domain , the client will not reconnect after an interruption. This occurs irrespective of whether the custom domain ID is 0 or some other non-default value.
If the agent is started before the client: the client will connect initially and work, but if the agent is then stopped and restarted, the client app will fail at the call to rclc_support_init_with_options() during the create_entities() function when it attempts to reconnect. The return value from rclc_support_init_with_options() is 1 (i.e. RMW_RET_ERROR 1 =Generic error to indicate operation could not complete successfully)
If the client is started before the agent is running: the client app will spin in the WAITING_AGENT state until the agent is started. It will connect successfully when the agent is started. However if the agent is stopped and restarted, the client will fail at the call to rclc_support_init_with_options() during the create_entities() function when it attempts to reconnect. The return value from rclc_support_init_with_options() is 1.
Additional information
Response from the agent when the client app successfully connects:
Response from the client when an unsuccessful attempt is made by the client to connect:
Our test code follows below.