Open tostbrot1 opened 1 year ago
But also it prints “Failed status on line 36: 1. Continuing” every 1000 ms.
You are printing it here #define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){printf("Failed status on line %d: %d. Continuing.\n",__LINE__,(int)temp_rc);}}
Also, depending on the task priority design you have, maybe it is important to have a sleep
in every loop, so the micro-ROS task allows low-priority tasks to execute.
Regarding the bad timing of the second timer, I will try to find a slot to take a look, but in the meanwhile can you check if keeping your code as it is and adding only the LED timer to the executor also fails depending on the agent status?
Thanks for your fast reply. When I am adding only the LED timer to the executor, the LED timer does not fail. The LED does not start to blink when the connection to the agent is lost. So I think the Publisher causes the LED timer to fail.
Yes, it seems that somewhere inside our RMW is waiting too long when dealing with DDS entities. Let me check
Hello,
I am working on an application where I want to use micro-ROS on an ESP32-S3. In the application I need to realize a real-time controller with a cycle of 10 ms. As micro-ROS is advertised as a solution for real-time applications, I expected that I can use the micro-ROS timer for my controller and for understanding I firstly tested the behavior of micro-ROS a little bit.
Steps to reproduce the issue
For testing I expanded the int32_publisher example with a second timer. This timer only sets a led on or off at each callback. The timer 1 (publisher) is set to a cycle time of 1000 ms and the timer 2 (led) is set to a cycle time of 10 ms.
Then I tested my example and while the micro-ROS-agent was active it worked great. The led shines constantly so the timer callback seems to be fast and constant. Also the printf output is shown every second. After that I tested the behavior of the timer when losing the agent by disabling the Wi-Fi of my Ubuntu. But after the ESP32 lost the connection to the agent, micro-ROS did not behave like I expected. The printf output is still displayed every 1000 ms. But also it prints “Failed status on line 36: 1. Continuing” every 1000 ms. My conclusion is that the publisher cannot publish anymore because it needs an agent. Am I understanding this right? Also I noticed that the callback of my second timer does not work anymore with the right frequency after stopping the agent. The led blinks with a frequency of 1 Hz. This is way too slow for my application because the controller always needs to be called with a constant frequency. After I activated the Wi-Fi, the publisher and the second timer worked again correctly.
Expected behavior
The timer frequency is independend wether the micro-ROS-agent ist available or not. The timer 2 is called every 10 ms even if the micro-ROS-agent is not connected.
Actual behavior
The callback frequency of the timer 2 drops to 1 Hz instead of the wanted 100 Hz, while the agent is not connected .
Additional information
Did I do something wrong in my application? Is it possible to make the micro-ROS-timer work independently from the micro-ROS-agent or do I need to do a workaroud like a using a GPT Timer?
Thank you for your reply.