wall timer is slow on ros2 foxy fitzroy

asked 2020-09-15 04:16:58 -0500

white_orange gravatar image

A code sample within LifecycleNode

 std::chrono::duration<double> my_timer_duration = std::chrono::duration<double>(1.0 / 100.0);
 std::shared_ptr<rclcpp::TimerBase> my_timer = this->create_wall_timer(my_timer_duration,
                                     std::bind(&Monitor::my_timer_callback, this));

So, I presume it should invoke the callback with frequency of 100 hz.

When running it on Foxy, I see it can maintain maximum 30 hz even with empty callback function and occupies up to 100% cpu. The same happens with any random duration smaller than ~1/30 second. The same code worked with no issues on Dashing maintaining 100 hz frequency.

What could be the problem?

edit retag flag offensive close merge delete

Comments

https://github.com/ros2/rclpy/issues/520 The issue is present in the Python client as well. Maybe you should report it to rclcpp.

lukicdarkoo gravatar image lukicdarkoo  ( 2020-09-15 15:07:54 -0500 )edit