Closed patrickwasp closed 1 year ago
The maximum number of timers is configured with the colcon parameter RMW_UXRCE_MAX_GUARD_CONDITION
which defaults to 4 (detail)
When it comes to timers, does the timeout_ns indicate how often it will run or how long it will wait for the callback to return? If it is just a timeout, how do you set the callback frequency?
The timeout value defines the callback frequency, its not related to the callback execution time.
Are timer callbacks run asynchronously or are they blocking for the rest of the code?
The callbacks run on the same thread that the executor spin method is called, so they the callbacks will block until they return.
You can find more info about timers and the executor here: Executor and timers.
Thanks for the link to vulcanexus, looks like a great resource.
After adding "-DRMW_UXRCE_MAX_GUARD_CONDITION=20"
to the meta file I still don't see the values of the second or third publisher changing. Is there a practical limit to the guard condition value?
Why does rqt
show ~48Hz for every publisher, when I have the timeouts set to different values?
this is my platformio.ini
[env:esp32-poe-iso]
platform = espressif32
board = esp32-poe-iso
framework = arduino
monitor_speed = 115200
board_microros_transport = serial
board_microros_distro = humble
board_microros_user_meta = config/esp32.meta
lib_deps =
https://github.com/micro-ROS/micro_ros_platformio#1.0.0
After adding "-DRMW_UXRCE_MAX_GUARD_CONDITION=20" to the meta file I still don't see the values of the second or third publisher changing.
Did your rebuild the library?
Also, some thoughts:
micro_ros_platformio
version, not the 1.0.0
usleep(100 * 1000)
uint32_t
values for all the float g_first_value
variablesI changed the lib_deps to the latest commit
https://github.com/micro-ROS/micro_ros_platformio#8103c3c2bbf52bc2cae5ff95fc61f06dd5792b62
platformio run --target clean_microros
.usleep
from callbacksuint32_t
instead of float
now everything seems to work correctly, including the correct frequency in Hz. Thanks! Is 20 a good number, or is it too high?
Glad to hear!
Is 20 a good number, or is it too high?
Only a RMW_UXRCE_MAX_GUARD_CONDITION
per timer is needed, but you will just waste a bit of memory.
Closing!
Issue template
Steps to reproduce the issue
Expected behavior
second and third values should be updated. They should also be published at different frequencies.
Actual behavior
only the first value is published with the correct value.
Additional information
If I change the order of the publishers and timers in code then different publishers start working. Is there a built-in limit in
rclc_executor_get_zero_initialized_executor()
,rcl_get_default_allocator()
, orrcl_get_zero_initialized_init_options()
that set the number of timers that can be run?When it comes to timers, does the timeout_ns indicate how often it will run or how long it will wait for the callback to return? If it is just a timeout, how do you set the callback frequency? Are timer callbacks run asynchronously or are they blocking for the rest of the code?
the meta I'm using is