ros-controls / ros2_control

Generic and simple controls framework for ROS 2
https://control.ros.org
Apache License 2.0
473 stars 291 forks source link

Add controller type to load controller service #665

Open jlack1987 opened 2 years ago

jlack1987 commented 2 years ago

Is this something that has been considered before? I feel like it's a very small price to pay for something that would really simplify the overall process of loading a controller especially with the way parameters are different in ros2 as opposed to ros1. With this you don't need to bother loading the controller type to the param server at all as it's in the load controller service request

destogl commented 2 years ago

I don't see anything against it. Can you explain a bit more your use-case?

But we have to think about other parameters of controller to. A use case or example would be great to see all the requirements and consequences of this feature.

jlack1987 commented 2 years ago

We make a service call to load a particular controller(for which we should know the plugin type) and the plugin type needs to be loaded as a parameter that is then grabbed from the controller manager at load time. I just feel like it'd be more straightforward and direct to simply add a type field to the load controller service in which case the controller manager doesn't need to do any parameter fetching. Basically everything done in this function could be eliminated by simply adding the plugin type to the load controller service

destogl commented 2 years ago

Yes, we could add this. Do you mind open a PR with this functionality?

We should not remove anything because there are many cases where you want to simply use controller names and type is “not essential”. So, service should have type as an optional parameter. If type-argument is provided, other load_controller method can be called that accepts booth.