-
Notifications
You must be signed in to change notification settings - Fork 307
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
[WIP] HW interface switching revisited #197
[WIP] HW interface switching revisited #197
Conversation
I like the signature you propose for virtual void doSwitch(const std::list<ControllerInfo> &start_list,
const std::list<ControllerInfo> &stop_list); Having knowledge of the controllers to stop (and not only of those to start) is relevant, as one might want to take action on resources that become free. For instance, one might want to switch a joint to an idle, low-power, or safe mode.
I'm not so fond of virtual bool canStart(const ControllerInfo &info) const; To me, the purpose of this method (or
Even if the required logic implied by virtual bool canSwitch(const std::list<ControllerInfo> &start_list,
const std::list<ControllerInfo> &stop_list,
int strictness) const;
OK, sounds reasonable.
The entire |
I see your point with inter-controller mode dependencies, but I came to the conclusion that those are rare cases and can be handled in checkForConflict as well. The main issue here is the best-effort switching. virtual bool canSwitch( const std::list<ControllerInfo> &is_running,
const std::list<ControllerInfo> &to_start,
const std::list<ControllerInfo> &to_stop,
std::list<ControllerInfo> &cannot_start,
std::list<ControllerInfo> &cannot_stop,
int strictness ) const; In addition start_request_ and stop_request_ must be updated based on the result, which introduces multiple iterations on all of these lists.
I prefer the simpler interface, because it is less error-prone. We have a couple of options now:
If you really want to go for the 4th option, you are more than welcome to provide a working implementation. I started to write one, but the effort didn't justify the benefit for me. |
Anything new here? |
I'll give some feedback before the end of the week. |
Initial disclaimer: I expect to have slow response times until mid-April, but will try to stay in the loop as much as possible. Development efforts from my side will likely have to wait until this date. By looking at the So, we can say from the existing implementation that the strictness parameter only applies to controller names and not resources. If now, for consistency's sake, we apply the same reasoning to the mode switching code, then the problem becomes much more tractable. I'm sorry for the noise introduced by trying to fit in the strictness parameter, I just hadn't made the above simple realization. If virtual bool canSwitch(const std::list<ControllerInfo> &start_list,
const std::list<ControllerInfo> &stop_list) const;
virtual void doSwitch(const std::list<ControllerInfo> &start_list,
const std::list<ControllerInfo> &stop_list); What do you think?. |
We are fine with strict canSwitch, I will issue a new PR with this interface as soon as I can :) |
Yes, why not. Having it in a single place instead of in every specialized RobotHW will save code. Anyway, if you see some inconvenience along the way you can defer the filtering to RobotHW. Switching a resource to the mode it's currently on should not be hard to handle. Thanks for offering to prepare the PR. I greatly appreciate the effort you're putting into this. |
I guess this PR can be closed, too, as #200 is merged! |
Based on the discussions in #184 we have prepared a new version of the interface switching.
Interface rationals:
Alternative implementations:
Example usage:
@ipa-fxm has prepared a gazebo plugin that uses this interface, you can find it here: https://github.com/ipa-fxm/cob_gazebo_plugins/tree/hwi_switch/cob_gazebo_ros_control (source+documentation)
What do you think?