-
Notifications
You must be signed in to change notification settings - Fork 766
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
[gazebo_ros_control] support hwinterface switching #256
[gazebo_ros_control] support hwinterface switching #256
Conversation
In case it is not desired to have this functionality in the default gazebo_ros_control-plugin and I'd be happy to hear comments, suggestions and concerns regarding this new feature! |
Ping? Any comments on this PR? |
I only have general thoughts on this at the moment. The executive summary is:
Switching the control mode of a joint is a feature that makes sense both for simulated and real hardware settings, i.e., its usefulness is agnostic of the underlying robot backend. As such, I'd like to see this feature added with existing simulation and hardware reference implementations. I'm concerned that this PR is focusing mostly on getting the simulation end of things working, and not taking the whole picture into account. As you probably know, @bmagyar has been looking into this, as time permits. If I'm correct, he has already validated an implementation in simulation, and is presently performing a hardware validation. Having the mode-switching logic should live in a place where it can benefit real and simulated settings without code duplication indeed turned out to be a bit tricky, and is something we can discuss in greater detail when a PR to this effect comes forth. Unfortunately I can't point you to the branch where development is taking place, as it's in a private repo. What I'd like to avoid here is the roll-out of a feature with non-trivial API implications without good reference implementations supporting the major usecases. My weariness is not without reason. Last year, I made the mistake of introducing transmission support following a two-step process: simulation in hydro first (thanks to @davetcoleman), and then real hardware in indigo. Not having validated both in parallel introduced some ripples which are still being felt today. |
Well, this PR indeed is the simulation part of our concept, yes. But the idea is not limited to simulation. Some more details probably will clariffy this: Another advantage of this concept is that there is no need for an additional I hope these additional comments clarify our concept. Thus, I hope the need for ros_control#184 becomes clearer. Without having this notification function that we could derive in our controller manager, we would need to implement our own controller_manager as a whole, as most functions of the We then still could discuss what happens with this PR proposed here! |
Ping? Just wanted to ask whether my additional comments helped to elimate the concerns regarding this concept being to much focused on simulation... I understand that @bmagyar is working on the Are there any reasons against having two concepts available for those wanting to use them? To further facilitate the decision, I moved the |
+1
Seems like it would add unnecessary complexity and maintenance. We should stick to one. Thanks for all these efforts - I never use Gazebo anymore so its hard for me to really weight in on these issues. |
We decided to host the new plugin in our own repository ipa320/cob_gazebo_plugins I will eventually close this PullRequest, too, as the required changes affecting |
I wanted to give an update on this issue as there has been quite some progress on this issue in the ros_control repository: In ros-controls/ros_control#200, an API for hardware_interface switching (or joint_mode switching) is proposed that - after a detailed discussion and several iterations - is now almost finalized and ready to be merged (minor beautification is still to be done). In conjunction to the efforts of getting to this API version, we continuously tested the APIs with an extension of the default gazebo_ros_control plugin (i.e. hwi_switch_gazebo_ros_control plugin), that has originally been proposed in this PR! The current version of the hwi_switch_gazebo_ros_control plugin making use of the hardware_interface switching API now lives here (and will be merged into ipa320 soon. However, as I still think of this gazebo_ros_control_plugin being useful for the greater gazebo_ros_pkgs community, I wanted to open up the discussion whether it is desirable to have this hwi_switch_gazebo_ros_control plugin back in gazebo_ros_pkgs again. Either way, comments and suggestions are welcome! @adolfo-rt @davetcoleman @ipa-mdl |
This is the PR for a gazebo_ros_control plugin using the new strict hwi switch API introduced in https://github.com/ros-controls/ros_controll/pull/200 Thus, closing this one! |
This PR requires ros_control#184.
Before giving details on the changes proposed in this PR, I will point out the motiviation for this PR and the use-case we had in mind.
Motivation
The current
gazebo_ros_control_plugin
uses theDefaultRobotHWSim
class to implement a HardwareInterface that connects gazebo with ros_control. TheDefaultRobotHWSim
offers allhardware_interface::PositionJointInterface
,hardware_interface::VelocityJointInterface
andhardware_interface::EffortJointInterface
in a single class. Thus allowing to useposition_controllers
,velocity_controllers
andeffort_controllers
to be used with gazebo.Unfortunately, with the current implmentation only one HardwareInterface can be used at a time!
This is due to how
DefaultRobotHWSim::initSim()
currently handleshardwareInterface
-tag of the transmissions. Although, allhardwareInterface
-tags from the transmissions are parsed, only the first is used lateron.This PR now extends
DefaultRobotHWSim::initSim()
in a way that several HardwareInterfaces can be specified for a joint, e.g. like this:This PR introduces means to keep track of the currently selected HardwareInterface by providing according data structures.
This PR also provides a specific
GazeboControllerManager
which derives from the basecontroller_manager::ControllerManager
class. This new class implements thenotifyHardwareInterface()
-function proposed in ros_control#184.The
notifyHardwareInterface()
-function is called duringswitchController()
-function, i.e. when a new controller is meant to be started, Before switching the actual controllers, the newnotifyHardwareInterface()
-function allows theGazeboControllerManager
to also switch the HardwareInterface required by a resource of the controller to be started.With this, it is also possible to have controllers requiring different HardwareInterface within the same gazebo session without needing to change the
hardwareInterface
-tag in the transmission (URDF).For example:
can be loaded to the parameter server and then those two controllers can be switched using the ControllerManagers
switch_controller
-Service "on-the-fly".Note: With this, no "PID-Parameter-Tuning" would be required for simulation anymore, as gazebo supports all the (Standard-)HardwareInterfaces.
This PR does not change the
DefaultRobotHWSim::readSim()
andDefaultRobotHWSim::writeSim()
functions as those are already capable of handling various HardwareInterfaces, i.e.joint_control_methods_
.I would like to thank @ipa-mdl for his help implementing this feature!