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

Single controller template #302

Conversation

mikepurvis
Copy link
Contributor

@mikepurvis mikepurvis commented Feb 9, 2018

As hinted at in #299 (comment), with C++11 it's now possible to achieve all features of MultiInterfaceController with a single Controller template that doesn't break the existing API. You basically get an init() function which includes pointers to all the hardware interfaces you specify in the template instantiation, eg:

class VelEffController : public controller_interface::Controller<VelocityJointInterface, EffortJointInterface>
{
public:
  bool init(VelocityJointInterface* v, EffortJointInterface* e, ros::NodeHandle &n) override;
}

With a single argument, this is the same as the legacy Controller usage. For compatibility with existing MultiInterfaceController, a deprecated adapter header is supplied which populates a reduced RobotHW as it worked before.

I'd propose this as a change for ROS Melodic, and removing the now deprecated multi_interface_controller.h in ROS N.


Note that the diff given here is pretty unhelpful. I'd suggest reviewing the new versions of the headers directly:

https://github.com/mikepurvis/ros_control/blob/single-controller-template/controller_interface/include/controller_interface/controller.h
https://github.com/mikepurvis/ros_control/blob/single-controller-template/controller_interface/include/controller_interface/multi_interface_controller.h


@adolfo-rt in particular I'm interested to hear from, as he was the original author of MultiInterfaceController, upon which this work builds heavily.

@mikepurvis mikepurvis force-pushed the single-controller-template branch from c8fbd90 to a2b3390 Compare February 11, 2018 01:22
@bmagyar bmagyar changed the base branch from kinetic-devel to melodic-devel March 23, 2018 19:37
const std::string sdp = suffix+delimiter+prefix;
std::stringstream ss;
ss << prefix;
std::copy(val.begin(), val.end(), std::ostream_iterator<class T::value_type>(ss, sdp.c_str()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang-7 complains about class here:

robothw_interfaces.h:60:68: error: typedef 'value_type' cannot be referenced with a class specifier
  std::copy(val.begin(), val.end(), std::ostream_iterator<class T::value_type>(ss, sdp.c_str()));
                                                                   ^

using typename works without problems.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also dies with Clang 6

@bmagyar
Copy link
Member

bmagyar commented Sep 3, 2018 via email

@mikepurvis
Copy link
Contributor Author

Closed in favour of #387.

@mikepurvis mikepurvis closed this Aug 1, 2019
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