Skip to content
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

Open
wants to merge 7 commits into
base: melodic-devel
Choose a base branch
from

Conversation

mikepurvis
Copy link
Contributor

@mikepurvis mikepurvis commented Aug 1, 2019

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:

  • Instead of Controller taking a single Interface template parameter, it now takes an arbitrary number of them. This should be backward source compatible with previous Controller use, and because it's all headers, there's no ABI breakage. This also means that MultiInterfaceController no longer needs to exist, and can be deprecated at a future point (for now it's been made a pass-thru to Controller).
  • A new 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.

Copy link
Contributor

@mathias-luedtke mathias-luedtke left a 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
Copy link
Contributor

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
Copy link
Contributor

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>
Copy link
Contributor

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?

Copy link
Contributor Author

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).

Copy link
Contributor

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).

Copy link
Member

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.

@mikepurvis
Copy link
Contributor Author

@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.

@mathias-luedtke
Copy link
Contributor

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?

IMHO something like 90f89e0 should do for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants