-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After reconnecting to the agent, data cannot be received normally for a period of time #434
Comments
Can you share your application code? How are you reimplementing the reconnection? |
We refer to the reconnection code in https://github.com/micro-ROS/micro_ros_arduino/blob/galactic/examples/micro-ros_reconnection_example/micro-ros_reconnection_example.ino. Call "destroy_entities" via a trigger signal, and then reconnect via "create_entities". In addition, our other test of reconnection is to reset the MCU, so that it will directly connect through "create_entities". |
Does this mean that the micro-ROS node finally reconnects? Or it never receives a subscription again? |
The micro ROS node finally successfully reconnected. but it can not receives a subscription until the "uxr_receive_best_effort_message" function, seq_num catches up to stream->last_handled |
We found in the function "uxr_create_session_retries", after calling the function "uxr_reset_stream_storage", calling "wait_session_status" to receive data may cause "uxr_reset_stream_storage" to become invalid, it means the "stream->last_handled" was changed because of the mcu can still receive subscribed topics at 50hz. |
Which are the values of |
1000 |
Does it have the same behaviour if you set |
No, we creat a static library, RMW_UXRCE_ENTITY_CREATION_DESTROY_TIMEOUT this value is the default 1000.This is our colcon.meta
|
Could you try to set the value to 0 and rebuild the library and check if the issue is solved? |
We set the value to 0, but it still doesn't work. "stream->last_handled" will still be changed in the "wait_session_status" function, we still need to call the "uxr_reset_stream_storage" function again. |
Is it reasonable to call the "uxr_reset_stream_storage" function again after the "wait_session_status" function? |
According to the documentation:
|
I see that in the |
Working on it |
Could you please post the agent log for this scenario with the debug flag |
agent.log |
A few questions:
|
1.yes, we use threads on your application. 2.we creat 7 publishers, 4 subscribers, 10 service servers. but only 2 publishers and 1 subscribers are used in the test. 3.we used a button to "destroy_entities" and "create_entities" to reconnect agent, In addition, we restarted the program to reconnect agent. |
Can you share your code? Threading has its limitations, for example:
|
|
Ok, when you have an example code for reproducing the issue we will take a look. |
This is a simple example code, I added some debugging printing.
|
ok, I have replicated it and you are right:
It makes sense to call |
I added a service to the above program and |
I found that it is the same if |
Services use subscriptions to get the request/response messages, so it makes sense. |
After the first connection is successful, the ros2 terminal will not fail to respond when calling the service call. When the reconnection is complete, sometimes the service call will not respond, service list can see it was created. What does "make sure that is already created" mean? Hasn't the service been created yet? |
When you reconnect the service is deleted and created again, so if you are on the middle of a request when this happens, the request will fail. Also, it can be a good idea to increase the executor spin time on |
After the reconnection is successful, as long as I don’t set |
Are you using best effort services ( |
I tried to use |
We just merged the second And regarding the services, what are you exactly testing?
Also, this changes may help: micro-ROS/rmw_microxrcedds#224 |
Thank you for your help. We are testing the situation after the mcu reconnects through the microros if the agent is not closed.
micro-ROS/rmw_microxrcedds#224 does not seem to help. I found that the microros_ros threads increased after reconnection. Is it possible that this problem is related to the agent? |
I have replicated the issue and it looks quite possible, working on it. |
We have found a bug on services destruction on the Agent side, check here: eProsima/Micro-XRCE-DDS-Agent#295 |
Thank you for your help, I think it has solved the issue |
Great news! |
Issue template
Steps to reproduce the issue
We created a subscriber on stm32f103, and created a publisher on another machine to publish the same topic at a frequency of 50hz. When stm32f103 successfully reconnects to the agent, it cannot subscribe to this topic for a certain period of time.
After debugging, it was found that the problem appeared in the function "uxr_create_session_retries" of the file "session.c". After calling the function "uxr_reset_stream_storage", calling "wait_session_status" to receive data may cause "uxr_reset_stream_storage" to become invalid and cause problems.
We try to call "uxr_reset_stream_storage" again after calling "wait_session_status" to avoid the problem, but I don't know if this modification is feasible. I want to ask your suggestions?
Expected behavior
When we reconnect the agent successfully, the MCU can subscribe and respond to data normally.
Actual behavior
Additional information
The text was updated successfully, but these errors were encountered: