Skip to content
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

Add forwarding of parameters from controller_manager to controllers #234

Closed

Conversation

v-lopez
Copy link
Contributor

@v-lopez v-lopez commented Nov 11, 2020

fixes #168

@codecov-io
Copy link

Codecov Report

Merging #234 (833b166) into master (c47791a) will decrease coverage by 0.21%.
The diff coverage is 27.65%.

@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   34.61%   34.40%   -0.22%     
==========================================
  Files          52       52              
  Lines        2981     3075      +94     
  Branches     1855     1924      +69     
==========================================
+ Hits         1032     1058      +26     
- Misses        310      320      +10     
- Partials     1639     1697      +58     
Flag Coverage Δ
unittests 34.40% <27.65%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
controller_interface/src/controller_interface.cpp 31.57% <0.00%> (-1.76%) ⬇️
.../include/controller_manager/controller_manager.hpp 62.50% <ø> (ø)
...r_manager/test/test_controller/test_controller.hpp 100.00% <ø> (ø)
...ontroller_manager/test/test_controller_manager.cpp 13.25% <18.42%> (+4.36%) ⬆️
...r_manager/test/test_controller/test_controller.cpp 73.33% <33.33%> (-26.67%) ⬇️
controller_manager/src/controller_manager.cpp 39.08% <34.69%> (-0.63%) ⬇️

Comment on lines +139 to +141
// This sleep is needed to prevent a too fast test from ending before the
// executor has began to spin, which causes it to hang
std::this_thread::sleep_for(50ms);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this screams for flakyness. Any way we can work around this 50ms? Might be 100ms on my OSX machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, I haven't found any simple one. I was generous with the sleep (I needed a fraction of those 50ms), but I don't like either.

To me it's a bug, because the destructor of the spin future hangs without this every now and then.

There's nothing that I see on the Executor API to check if it's spinning. A way would be to add a timer or something and wait until it is triggered by the executor, but it's not going to be pretty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I reported ros2/rclcpp#1454
And attempted the workaround I suggested, which lead to a segfault, reported in ros2/rclcpp#1455

For now I'm gonna leave the sleep here and we can revisit this in the future if we manage to fix this upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we can accept this as it is, as the rclcpp might be a long way ahead?
I don't like the sleeps either, specially since I was pushing changes to address ros-controls/ros2_controllers#27 but I can't find a nice solution to this right now.

Victor Lopez and others added 2 commits November 11, 2020 18:19
Copy link
Contributor

@Karsten1987 Karsten1987 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a valid approach and should work as far as I can see this (haven't tested it locally though.)

One thing I'd like to see in a test is the behavior of the on_set_parameters_callback within a controller. I think that should be supported, but essentially to verify that a callback is being triggered within the controller if the controller manager calls set_parameter on the controller node.

rclcpp::Parameter new_param;
std::string prefix;
std::tie(prefix, new_param) = get_controller_param(parameter);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


return result;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add another test here which checks for a a callback on a change of parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, need to finish some things tomorrow, probably will be done by Friday.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@destogl destogl mentioned this pull request Nov 18, 2020
@v-lopez
Copy link
Contributor Author

v-lopez commented Nov 18, 2020

As discussed in the ROS Control WG meeting, we're not going to go with this solution.

Instead, the load service will have one extra parameter, that will specify the target state of the lifecycle node of the controller. Probably a choice of unconfigured, configured and active (or whatever the right lifecycle states names are).

This allows to load a unconfigured controller, load the parameters later, and configure and start it though the regular lifecylce interface.

@destogl
Copy link
Member

destogl commented Nov 19, 2020

Can you also add here how an example YAML should then look like?

My proposal can be found here.

@destogl
Copy link
Member

destogl commented Dec 15, 2020

Agreed with @v-lopez to close this in a direct call on Dec, 14th

@destogl destogl closed this Dec 15, 2020
destogl added a commit to StoglRobotics-forks/ros2_control that referenced this pull request Aug 11, 2022
* Remove from ci.yaml

* Remove controller also from linters-CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review how to provide controller parameters
4 participants