-
Notifications
You must be signed in to change notification settings - Fork 293
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
Clear registered handles of DiffDriveController on deactivate #596
Clear registered handles of DiffDriveController on deactivate #596
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #596 +/- ##
==========================================
+ Coverage 35.78% 35.90% +0.12%
==========================================
Files 189 7 -182
Lines 17570 674 -16896
Branches 11592 361 -11231
==========================================
- Hits 6287 242 -6045
+ Misses 994 132 -862
+ Partials 10289 300 -9989
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -558,6 +558,7 @@ controller_interface::CallbackReturn DiffDriveController::configure_side( | |||
} | |||
|
|||
// register handles | |||
registered_handles.clear(); |
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.
should this happen on deactivate?
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.
That is being executed on activate, before creating the handles.
I can change it to use the other solution if you think it's better.
Well those handles should be returned from loan on deactivate so I think
it's only appropriate ;)
…On Fri, 5 May 2023, 20:29 Noel Jiménez García, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In diff_drive_controller/src/diff_drive_controller.cpp
<#596 (comment)>
:
> @@ -558,6 +558,7 @@ controller_interface::CallbackReturn DiffDriveController::configure_side(
}
// register handles
+ registered_handles.clear();
That is being executed on activate, before creating the handles.
I can change it to use the other solution if you think it's better.
—
Reply to this email directly, view it on GitHub
<#596 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA24PYOJXQZWXRIFEWMWBL3XEVIKDANCNFSM6AAAAAAXWLDTOI>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Houston, we have a problem. Some tests are failing and they seem legit caused by this PR. Possible they are badly designed tests... |
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 pointing in this direction, I was not able to find this on my own ;)
The tests fail now, because it is assumed that the commands are zero after deactivation
ros2_controllers/diff_drive_controller/test/test_diff_drive_controller.cpp
Lines 424 to 425 in 546422d
EXPECT_EQ(0.0, left_wheel_vel_cmd_.get_value()) << "Wheels are halted on deactivate()"; | |
EXPECT_EQ(0.0, right_wheel_vel_cmd_.get_value()) << "Wheels are halted on deactivate()"; |
This is now not the case, because DiffDriveController::halt()
has no effect if no handles are registered.
halt(); |
Let it explicitly halt before releasing the handles?
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
@Mergifyio backport humble |
✅ Backports have been created
|
Hi,
With the current implementation, the wheel handles are not being reset when running
on_deactivate
method. Then, if the controller is deactivated and then activated again the handles are accumulated and that can lead to issues (See ros-controls/ros2_control_demos#239)on_activate
andon_deactivate
are the opposite, so everything that is enabled inon_activate
have to be disabled inon_deactivate
(or reset at the beginning of theon_activate
). Following that, I propose two possible solutions, let me know which one fits better:Current Solution: Reset the handles with
registered_handles.clear();
in theconfigure_side()
method.Alternative Solution: Clear each of the handles in
on_deactivate
method: