ros2 control update_rate

asked 2022-07-25 03:59:26 -0500

MaxDio gravatar image

Hello I have a question regarding the ros2_control framework.

I would like to build my own controller which has to run at a specific frequency. I thought I can alter the udapte_rate parameter in the controller_manager config file. To test the rate I increase a counter every update call and publish it every 1000 ms. I set the counter to 1000 (Hz) so I would assume the counter message to increase approximately the same. However, the counter increases significantly faster. Any ideas how I can enforce a specific rate in my controller?

Regards Max

edit retag flag offensive close merge delete

Comments

Are you building from source or using a debian? And which version of ROS2?

AndyZe gravatar image AndyZe  ( 2022-07-25 11:44:27 -0500 )edit

Here's the main ros2_control loop which (I believe) should operate as you've described. Maybe you can put some debug code there?

https://github.com/ros-controls/ros2_control/blob/9c4c40e732f07f7dbc0c6881bd7462c72c2c179e/controller_manager/src/ros2_control_node.cpp#L71

This bit of code has changed a lot recently, which is why I asked what version you are using.

AndyZe gravatar image AndyZe  ( 2022-07-25 11:46:29 -0500 )edit

Hi I use foxy using debian. OK the rate limiter was not included in my code that should hopefully fix it...

MaxDio gravatar image MaxDio  ( 2022-07-26 02:07:29 -0500 )edit