Automation-Research-Team / OpenHRC

Open Human-Robot Collaboration/Cooperation Library
GNU Lesser General Public License v2.1
8 stars 1 forks source link

apply different interface/controller to each robots #19

Closed itadera closed 1 year ago

itadera commented 1 year ago

If you use single interface/controller for all robots

#include "ohrc_control/single_control.hpp"
#include "ohrc_teleoperation/marker_interface.hpp"

int main(int argc, char** argv) {
  ros::init(argc, argv, "marker_teleoperation");
  SingleControl<MarkerInterface> interface; // just declare the interface/controller class name used for all robots
  if (interface.control() < 0)
    ROS_ERROR("End by some fails");
}

And if you different interface/controller to each robots;

#include "ohrc_control/control.hpp"
#include "ohrc_teleoperation/marker_interface.hpp"
#include "ohrc_teleoperation/twist_topic_interface.hpp"

class MultiControl : virtual public Control {
public:
  MultiControl() {
    interfaces.resize(nRobot);
    interfaces[0] = std::make_shared<MarkerInterface>(cartControllers[0]);
    interfaces[1] = std::make_shared<TwistTopicInterface>(cartControllers[1]);
  }
};

int main(int argc, char** argv) {
  ros::init(argc, argv, "marker_teleoperation");

  MultiControl interface;
  if (interface.control() < 0)
    ROS_ERROR("End by some fails");
}