-
Notifications
You must be signed in to change notification settings - Fork 268
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
Fix update rate issues by working around MutliThreadedExecutor #275
Conversation
Could you please elaborate on the effects of this approach? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to #260. It seems there is an issue in the depths of rclcpp
(ros2/rclcpp#1487). There is also a solution that needs some more time... (ros2/rclcpp#1168).
The solution is IMHO legit until this is solved in rclcpp
.
Currently the MutliThreadedExecutor performance is very bad. This leads to controllers not meeting their update rate. This PR is a temporary workaround for these issues. The current approach uses a `rclcpp` timer to execute the control loop. When used in combination with the `MutliThreadedExecutor`, the timers are not execute at their target frequency. I've converted the control loop to a while loop on a separate thread that uses `nanosleep` to execute the correct update rate. This means that `rclcpp` is not involved in the execution and leads to much better performance.
@bmagyar I've added a simple benchmark to the description |
This PR actually broke the build on OSX.
|
Sorry, I did not know OSX was a requirment. Should there be a CI for that? Good suggestion to replace the call with |
Currently the MutliThreadedExecutor performance is very bad. This leads to controllers not meeting their update rate. This PR is a temporary workaround for these issues.
The current approach uses a
rclcpp
timer to execute the control loop. When used in combination with theMutliThreadedExecutor
, the timers are not execute at their target frequency. I've converted the control loop to a while loop on a separate thread that usesnanosleep
to execute the correct update rate. This means thatrclcpp
is not involved in the execution and leads to much better performance.I've done some simple performance benchmarking. Using https://github.com/ros-controls/ros2_control_demos
with
update_rate
set to 500 Hz.fix/update-rate-issues branch
master branch
I'm curious what you guys think about this workaround. Without this patch, I'm unable to run a control loop at 50Hz.