-
Notifications
You must be signed in to change notification settings - Fork 343
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
Make diff_drive_controller a ChainableControllerInterface #1485
Make diff_drive_controller a ChainableControllerInterface #1485
Conversation
Please always install pre-commit to avoid failing tests ;) otherwise, run it manually with regarding tests: have a look at the mecanum controller, it is chainable anf there are exactly those tests already available |
19b7630
to
a353628
Compare
I've fixed my formatting by running |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
+ Coverage 83.86% 84.15% +0.29%
==========================================
Files 122 121 -1
Lines 11148 11298 +150
Branches 948 955 +7
==========================================
+ Hits 9349 9508 +159
+ Misses 1486 1473 -13
- Partials 313 317 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Thanks for the follow-up. In principle this looks very good, some comments:
- shouldn't we also check for proper exported reference interfaces like here?
- in principle I'm fine with the change from RealtimeBox to RealtimeBuffer, but this soon might be changed to the lock-free queue. Is there a reason to change this in this PR? If not, I'd ask to remove the change because it is out-of-scope here.
To be honest I did not know the full implications of switching from a RealtimeBox to RealtimeBuffer, but I chose the change because every other example of chainable interface (eg. mecanum, passthrough, chainable-diff-drive) used it. I figured it probably had a reason for being used, but at the very least using the RealtimeBuffer would provide consistency across the chainable controllers. It seemed like the RealtimeBuffer was designed specifically for use-cases like the chainable interface, where the reference_interfaces could either be safely updated at a realtime rate or more slowly through the publisher, whereas the RealtimeBox would simply make a best-effort attempt at getting and setting the variables (which may in fact be sufficient for this use case) but didn't explicitly account for realtime vs non-realtime. Let me know if you would like me to proceed with changing RealtimeBuffer back to RealtimeBox, and I will do it. I agree that there should be a check for properly exported reference interfaces. I will imitate the mecanum drive when_controller_configured_expect_properly_exported_interfaces test. I will try to do that later today. |
with chained mode tests + export reference interfaces test
a353628
to
52ee68a
Compare
I just added a test for export_reference_interfaces(). |
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.
OK I see your point regarding the RT buffer (I also think that the box was not the right thing to use). Thanks for adding the additional test.
I tested this version with the demos in the non-chained mode, and it still works like expected.
For future PRs: It is not desired to squash the commits (we do that at the time of the merge in the base branch), it just takes more time to review because I can't see now what has changed since the time of my last review.
Apologies, in the future I will not squash commits while the PR is in progress. The changes I made were to add the test |
you are right, I haven't realized that button before. You never stop learning ;) |
This pull request is in conflict. Could you fix it @arthurlovekin? |
Is there a way that I can fix the Rolling ABI compatibility check? It seems to be broken because of the change from ControllerInterface to ChainableControllerInterface and I see no way around that. Side question: I see in the documentation that there is a Working Group meeting every second Wednesday, but I cannot find the link to join. Would it be possible for me to attend? |
Dear @arthurlovekin the announcement, in ROS discourse, for tomorrow's meeting group is here: https://discourse.ros.org/t/ros2-control-working-group-meeting-15th-january-2025/41528 To join I copied paste the invitation in the announcement: |
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.
Thanks for the nice contribution. I've some questions around the code that I've reviewed. Thank you
small fixes: use isfinite not isnan Co-authored-by: Sai Kishor Kothakota <[email protected]>
This change truly is ABI breaking, but this is no show-stopper for this PR. Furthermore, for controllers this is not really an issue because we load them as plugins dynamically. |
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.
Can you please fix the merge conflict after #1478?
@christophfroehlich the merge conflict should be resolved |
One thing that occurred to me as I was writing the reset_buffer() code: If you want to switch from one controller to another, is it desirable for this controller to halt() on_deactivate()? Perhaps I misunderstand the controller_manager because it seems like you would want to be able to switch without stopping the motors. If you switch into the diff_drive_controller from another one it also seems like there could be issues with the acceleration limiter, since from the diff_drive_controller's perspective its previous_two_commands have been set to zero, but you may be switching at a time when the other controller is commanding a high value. (but if you don't set the previous_two_commands to zero then a single starting command at the beginning will be able to bypass the acceleration limits, which can only be applied if multiple commands have been sent). |
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.
Please fix the pre-commit (cpplint) error. (consider installing pre-commit to avoid this the next time)
@saikishor can you let me know your thoughts on my responses to your comments? |
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.
It looks pretty good to me now.
I've one question. I see that you are resetting the buffer in the on_configure, and inside we are setting a message with NaN's, so does that mean upon activation until the cmd_timeout_
and if no message is received within this timeout, it will keep printing Command message contains NaNs. Not updating reference interfaces.
?
…()->now()` to `->now()` Co-authored-by: Sai Kishor Kothakota <[email protected]>
f795b62
You are correct. For me, it was giving a warning about four times on startup. This is kind of annoying so I switched it to RCLCPP_WARN_SKIPFIRST_THROTTLE so that it will skip the first warning, then wait the cmd_vel_timeout_ until logging again (by which time it won't be hitting this warning). However, if you send it a NaN later, then it should give you a warning. |
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.
LGTM. Thanks for all the followups.
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.
LGTM!
3d14b42
into
ros-controls:master
Using dea3d3c as a reference, I made the diff_drive_controller into a ChainableControllerInterface. I used a RealtimeBuffer to handle the incoming velocity command messages, and I also added lifecycle checks and support for the speed_limiter that were not included in dea3d3c. I also added some tests that run the chainable controller in unchained mode, and I intend to test it in chained mode in one of my current projects (though I couldn't readily figure out how to make this into a test).