-
Notifications
You must be signed in to change notification settings - Fork 280
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
Review how to provide controller parameters #168
Comments
I did some kind of "proposal" YAML during development of #147. Here the out for the discussion:
I am not very fond of this solution since there is a controller's name three times in the YAML. |
@destogl But in this proposal, at which point in time do you load the yaml? Right now what happens is:
The problem is that parameters can only be set after 2., because prior to that the controller node did not exist. But 3. occurs in the same operation and fails. Possible solutions: @bmagyar @Karsten1987 I'd love your take on this. |
From reading through this, there's really two problems here: 1.) How to load a controller by name
Is there a chance to enhance the service call to take not only a controller name but also it's appropriate type? I don't see a big drawback to this as I believe the type is just as well known as the controller name at the time of loading. 2.) How to propagate parameters to the controllers From the options you've listed I think we could get it to work with a union of (a) and (d). Let's say we load a general parameter file into the controller manager's node, the controller manager could internally hold a map of parameters for each controller and forwards these onto the controller's namespace between loading and configure. Does this make sense? |
Regarding 1) the service could be changed to take the type as an input, it will be less convenient for people who need to be stopping and starting controllers continuously, that for sure is us and some of our customers. If the parameter's are going to be in a central location as suggested in 2) I'd keep it like that.
What are your thoughts? I could start to draft this later this week. |
I've been thinking about this for the last couple of days and agree with declaring it all parameters in the @v-lopez please go ahead. |
Don't you have to do exactly this when parameters are going to be changed? ROS2 gives you a nice way of subscribing to parameter changes (you get a callback). If you force each controller node to exclusively look for their parameters on another node (aka the controller manager node) you'll lose that one. |
I was thinking about how you'd read those parameters from an intermediate structure provided by the controller manager, so unless that controller manager actively updates this structure you'd be using outdated params, but I didn't think about that parameter changes callback. I'll get back to you once I've worked a bit more on it. |
@Karsten1987 and this is what I meant by not focusing on this for now. Better lose niceties in the short term than not having a short term. |
I wouldn’t consider this a nice thing to have. It’s fundamentally different from what all the ros2 parameter tutorials would tell you how to deal with parameters.
We at least have to make this clear that the regular ros2 concepts don’t apply here. And that concerns me a bit.
… On Nov 11, 2020, at 6:20 AM, Bence Magyar ***@***.***> wrote:
@Karsten1987 and this is what I meant by not focusing on this for now. Better lose niceties in the short term than not having a short term.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Please take a look at #234. I've added the callback thing, so the parameters are updated on the controller's node, I believe operation will not be different in general. One thing that will differ, is that if someone updates directly the controller's parameters, the controller_manager copy of the parameters will not be updated. |
@v-lopez how did you test the current master branch? I've tried to load a test controller via the service call and it immediately crashes:
given a name with a |
Then further, even if I hardcode the type within the controller manager, the instantiation of the node crashes with the following:
I feel like the loading mechanism is currently broken :( |
What's the branch you are using for getting the urdf? |
I am working on this PR: #236 but yes, you're right. The name of the controller here got me confused. It's essentially the node name of the controller, not the name of the plugin being exported via pluginlib.xml. Running it with your suggestion make it work. The controller I am using is here: ros-controls/ros2_controllers#109 |
@v-lopez: I just look again at this issue and corresponding PR #234 I am using this yaml, loaded when starting the
Are you trying to get the same YAML format as in ROS1? E.g.:
|
My guess is that if the parameters are loaded as part of the launch file, they are stored in a file in But if you run using a launch file, a controller_manager with some default controllers with their parameters, and later you want to load a different controller, you cannot set the parameters of the new controller until its Node exists, and then the situation exposed here occurs. And just to anticipate any other question, that is one of our main use cases and of our customers, they developer their controllers and load then dynamically in ROS1 without having to edit our launch files. |
Thanks, I think I am getting it now... So, you are using the same name for the controller? |
Yeah, the most reduced example is that you start a controller_manager without controllers configured. Later, you set the parameter |
The current implementation summarized:
ControllerManager
allows undeclared parameters hereIf a controller with name
arm_trajectory_controller
must be loaded using the service interface, there must exist a/controller_manager/arm_trajectory_controller.type
parameter with the type of the controller, so the controller manager can read it and instantiate the proper class.On the other hand, there's also the parameters required by the controller itself.
Controllers are loaded and configured on the
load_controller
service, so in the namespace of thearm_trajectory_controller
, there must be the parameters necessary to configure it by the time it is loaded.But the controller node doesn't exist before loading the controller, so it's not possible to load them beforehand.
Maybe we could use SubNodes? In any way, the controllers should be within the namespace of the controller manager they are going to be loaded into.
Some related discussion here: https://github.com/ros-controls/ros2_control/pull/139/files#r491415213
The text was updated successfully, but these errors were encountered: