Use blocking read in controller manager (backport #1760) - #1922
Open
mergify[bot] wants to merge 4 commits into
Open
Use blocking read in controller manager (backport #1760)#1922mergify[bot] wants to merge 4 commits into
mergify[bot] wants to merge 4 commits into
Conversation
* Setup CM to not sleep and use blocking read * Change default value for blocking_read to true * Updated documentation for blocking read functionality. (cherry picked from commit c747f3e) # Conflicts: # ur_robot_driver/doc/migration/makoa.rst
Author
|
Cherry-pick of c747f3e has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4d5763d. Configure here.
Member
|
Waiting for ros2_control getting released with the required change, therefore blocked until then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR is mainly a testing PR for implementing a non-sleeping ros2_control node that follows the hardware's pace.
It requires a non-sleeping controller manager, e.g. the one from ros-controls/ros2_control#3213.
Basically, this tries to solve the issue that the control loop on the ROS machine and the one on the robot can have a phase shift and might be slightly different. To illustrate things, I added a simple controller that moves a joint on a fixed sine wave pattern with fixed sampling times in between. This is for illustration purposes and will not get merged.
With a non-blocking read with a controller_manager running at a fixed 500Hz we can observe that every couple of minutes, the two loops (controller_manager and robot) come to a point, where it can happen that the robot didn't receive a new command since the last control cycle.
I've used a preempt-rt patched kernel for that test. The upper curve shows the total amount of control cycles without a new command coming in to the robot. For the test I used a position interface.
We can see that control runs quite stable up to a point where the two loops get "out of sync". There, the robot doesn't get a new package for the next control loop. In our case we do linear extrapolation in that case. In the next cycle, we get a new command correcting this extrapolation. This is especially visible on the acceleration domain. After a while, this stabilizes again only to reoccur a few minutes later.
With the controller manager not sleeping and the hardware interface doing a blocking read, the same plot looks exactly like the left half of the plot above, but for a very long time (tested for ~1h). The number of missed packages stays at 0 given a direct network connection without any disturbances.
Note
Medium Risk
Changes real-time control-loop synchronization defaults and depends on ros2_control hardware synchronization support; misconfiguration between launch and URDF defaults could affect timing in custom setups.
Overview
Adds a
blocking_readlaunch/configuration path so the ROS control loop can wait on incoming robot state instead of running on a fixed timer, reducing phase drift between the driver and the robot controller.ur_control.launch.pydefaultsblocking_readtotrueand passeshardware_synchronization.expect_blocking_read_writetoros2_control_node.ur_rsp.launch.pyandur.urdf.xacroexpose the same flag (URDF/xacro defaultfalsefor multi-robot setups) and map it to hardwarenon_blocking_read.Docs cover the new startup argument, a blocking read usage section, and Makoa migration notes (launch defaults vs URDF default).
Reviewed by Cursor Bugbot for commit eee3cd4. Bugbot is set up for automated code reviews on this repo. Configure here.
This is an automatic backport of pull request #1760 done by [Mergify](https://mergify.com).
Note
Medium Risk
Changes real-time control-loop synchronization and depends on matching ros2_control hardware synchronization with UR hardware
read()behavior; launch defaultfalsevs docs calling blocking the recommended startup default may confuse custom launch chains that omitblocking_readon the description side.Overview
Introduces a
blocking_readlaunch/xacro flag so the driver can block inread()on fresh robot state and let the robot controller pace the ROS control loop, instead of relying on a fixed timer that can drift out of phase with the robot.ur_control.launch.pypasseshardware_synchronization.expect_blocking_read_writeandoverruns.print_warnings(inverted when blocking is enabled) intoros2_control_node, and declaresblocking_read(defaultfalsein this backport).ur_rsp.launch.pyforwards the same argument into the robot description;ur.urdf.xacromaps it to hardwarenon_blocking_readvia${not blocking_read}.startup.rstdocuments the new startup argument and a Blocking read section explaining when to enable it (single-robot setups vs unreliable comms).Reviewed by Cursor Bugbot for commit affee10. Bugbot is set up for automated code reviews on this repo. Configure here.