116 std::map<std::string, std::list<ControllerInfo>> resource_map;
120 for (
const auto& controller_info : info)
122 for (
const auto& claimed_resource : controller_info.claimed_resources)
124 for (
const auto& iface_resource : claimed_resource.resources)
126 resource_map[iface_resource].push_back(controller_info);
132 bool in_conflict =
false;
133 for (
const auto& resource_name_and_claiming_controllers : resource_map)
135 if (resource_name_and_claiming_controllers.second.size() > 1)
137 std::string controller_list;
138 for (
const auto& controller : resource_name_and_claiming_controllers.second)
139 controller_list += controller.name +
", ";
140 ROS_WARN(
"Resource conflict on [%s]. Controllers = [%s]", resource_name_and_claiming_controllers.first.c_str(), controller_list.c_str());
158 const std::list<ControllerInfo>& ) {
return true; }
164 virtual void doSwitch(
const std::list<ControllerInfo>& ,
165 const std::list<ControllerInfo>& ) {}
virtual void doSwitch(const std::list< ControllerInfo > &, const std::list< ControllerInfo > &)
virtual SwitchState switchResult(const ControllerInfo &) const
Return (in realtime) the state of the last doSwitch() for a given controller.
virtual bool checkForConflict(const std::list< ControllerInfo > &info) const
virtual void read(const ros::Time &, const ros::Duration &)
Read data from the robot hardware.
virtual ~RobotHW()=default
virtual bool prepareSwitch(const std::list< ControllerInfo > &, const std::list< ControllerInfo > &)
virtual void write(const ros::Time &, const ros::Duration &)
Write commands to the robot hardware.
Manager for hardware interface registrations.
virtual SwitchState switchResult() const
Return (in realtime) the state of the last doSwitch().
Robot Hardware Interface and Resource Manager.
std::shared_ptr< RobotHW > RobotHWSharedPtr
virtual bool init(ros::NodeHandle &, ros::NodeHandle &)
The init function is called to initialize the RobotHW from a non-realtime thread. ...