added a fixed control period to loop#647
Conversation
|
And it seems this should be backported to Foxy and Galactic too |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
We haven't discussed this option yet, no that I'm aware of at least. So I definitely welcome the timer suggestion but I think that should be additional to this PR, not replacing. |
This comment was marked as off-topic.
This comment was marked as off-topic.
destogl
left a comment
There was a problem hiding this comment.
In light of clearer naming of variable as proposed in #645 and trying to make the code cleaner by reducing some lines, I propose the following updates.
@jackcenter can you test this one more time? My proposal should not change the behavior in any way. Sorry for additional effort, but I hope to solve this once for all :)
@bmagyar you will have to review this again.
Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
|
@destogl I made the requested changes and it is much easier to read now, thanks! I ran the tests again and there was no loss in performance or apparent drift. |
destogl
left a comment
There was a problem hiding this comment.
Thanks for the great contribution and detailed analysis!! 🚀
* added a fixed control period to loop * fixe formatting * Improvements to naming convention and readability Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> * Removed unnecessary code missed in last commit Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> * updated variable begin to current_time Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> (cherry picked from commit 4d2bce8)
* added a fixed control period to loop * fixe formatting * Improvements to naming convention and readability Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> * Removed unnecessary code missed in last commit Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> * updated variable begin to current_time Co-authored-by: Denis Štogl <destogl@users.noreply.github.com> (cherry picked from commit 4d2bce8) # Conflicts: # controller_manager/src/ros2_control_node.cpp
This uses a fixed control period to remove the drift issue brought up in Issue #644. It also has the time adjustment from PR #646. I ran some simple tests based on the attachment replacing
controller_manager/ros2_control_node.cpp(similar to what was done in #644) while running the rrbot (ros2 launch ros2_control_demo_bringup rrbot.launch.py) using 10 and 1,000 Hz control loops for 10 seconds.At 1000Hz the current implementation and PR #646 drift almost a full second over the 10-second experiment. This proposed implementation doesn't show any signs of drift over the same test. The data from my quick experiment is here.
I wasn't sure if the period time would need to be updated in the loop or not (I didn't think so), but please let me know if you think it should be moved.
(edit: added test file attachment)
ros2_control_node.cpp.txt