-
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
Variadic Controller class + Variadic CompositeController class #387
base: melodic-devel
Are you sure you want to change the base?
Variadic Controller class + Variadic CompositeController class #387
Conversation
…ks for gcc and clang. Original error is: (#1) robothw_interfaces.h:60:68: error: typedef 'value_type' cannot be referenced with a class specifier.
… into melodic-devel
…ontroller-template-melodic2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful indeed!
I have no doubt that the code works, but a test for CompositeController
should be added in controller_manager_tests
to maintain it properly.
CompositeController& operator =(const CompositeController& c); | ||
}; | ||
|
||
} // namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the name of the namespace as well
}; | ||
|
||
} | ||
} // namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the name of the namespace as well
@@ -63,7 +63,7 @@ inline std::string enumerateElements(const T& val, | |||
} | |||
|
|||
|
|||
template <typename T> | |||
template <class T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, you changed this for consistency reasons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't remember the logic for this change, but I don't think it matters; I'm happy for us to consistently use typename
or class
, and can revert this part of the change if the decision is for typename
. I think the only time it matters, typename
is preferred (eg in ab14ea4).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and can revert this part of the change if the decision is for typename
The other templates use class
in their definitions as well, so it is fine for me.
class
seems to be mandatory for nested templates (C++14 and older).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion on this, do it at your leasure.
@ipa-mdl Thanks for looking. I agree on some kind of test; I think in the past when working on this, I got hung up on what exactly such a test should do. Given that the resource merging is already covered by a unit test, is it enough to just demonstrate something which compiles and maybe passes a trivial smoke test? Or should there be a full ControllerA and ControllerB, and then CompositeControllerAB, with a complete lifecycle and verification of the init/start/stop methods being properly called? I'm totally down for that approach, I think my concern is just about keeping the test short and simple enough that it can be easily grokked. |
IMHO something like 90f89e0 should do for now. |
This is a combination of changes previously proposed in #301, #302, and #329. The two additions, both made possible by ROS Kinetic+ being on C++11, are:
Controller
taking a single Interface template parameter, it now takes an arbitrary number of them. This should be backward source compatible with previousController
use, and because it's all headers, there's no ABI breakage. This also means thatMultiInterfaceController
no longer needs to exist, and can be deprecated at a future point (for now it's been made a pass-thru toController
).CompositeController
template has been added, which permits combining controllers, and in particular modifying behaviour when the base controller(s) supply extension points in the form of virtual functions.Clearpath have been using both of these features for 18+ months and found them useful.