hwi_switch_test.cpp
Go to the documentation of this file.
1 // Copyright (C) 2015, Fraunhofer IPA
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright notice,
7 // this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of Fraunhofer IPA nor the names of its
12 // contributors may be used to endorse or promote products derived from
13 // this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 // POSSIBILITY OF SUCH DAMAGE.
27 
29 
30 #include <gtest/gtest.h>
31 
32 #include <map>
33 #include <set>
34 #include <string>
35 #include <algorithm>
36 #include <iterator>
37 
41 
42 namespace hardware_interface {
44 {
45  return i1.name < i2.name;
46 }
47 }
48 template<typename T> T intersect(const T& v1, const T &v2)
49 {
50 
51  std::vector<typename T::value_type> sorted1(v1.begin(), v1.end()), sorted2(v2.begin(), v2.end());
52  T res;
53 
54  std::sort(sorted1.begin(), sorted1.end());
55  std::sort(sorted2.begin(), sorted2.end());
56 
57  std::set_intersection(sorted1.begin(), sorted1.end(), sorted2.begin(), sorted2.end(), std::back_inserter(res));
58  return res;
59 }
60 
61 // NOTE: For test simplicity, this robot abstraction assumes that it will work
62 // with controllers claiming resources from only one hardware interface.
63 // Note that in the general case, controllers can claim resources from multiple
64 // hardware interfaces.
66 {
71 
72  class Joint
73  {
74  double dummy_;
75  std::set<std::string> interfaces_;
76  std::string current_;
78  public:
79  Joint(const std::string &n, hardware_interface::JointStateInterface &iface) : jsh_(n, &dummy_, &dummy_, &dummy_)
80  {
81  iface.registerHandle(jsh_);
82  }
83 
84  template<typename Interface> void registerHandle(Interface &iface, bool can_switch)
85  {
86  if(can_switch) interfaces_.insert(hardware_interface::internal::demangledTypeName<Interface>() );
87  iface.registerHandle(typename Interface::ResourceHandleType(jsh_, &dummy_));
88  }
89  bool prepareSwitch(const std::string &n)
90  {
91  if(interfaces_.find(n) == interfaces_.end()) return false;
92  return n >= current_;
93  }
94  void doSwitch(const std::string &n)
95  {
96  current_ = n;
97  }
98  };
99 
100  typedef std::shared_ptr<Joint> JointSharedPtr;
101 
102  std::map<std::string, JointSharedPtr> joints_;
103 
104  JointSharedPtr makeJoint(const std::string & name)
105  {
106  JointSharedPtr j(new Joint(name, jsi_));
107  joints_.insert(std::make_pair(name, j));
108  return j;
109  }
110 
111  std::vector<std::string> started_;
112  std::vector<std::string> stopped_;
113 public:
115  {
116  JointSharedPtr j;
117 
118  j = makeJoint("j_pv");
119 
120  j->registerHandle(pji_, true);
121  j->registerHandle(vji_, true);
122  j->registerHandle(eji_, false);
123 
124  j = makeJoint("j_pe");
125  j->registerHandle(pji_, true);
126  j->registerHandle(vji_, false);
127  j->registerHandle(eji_, true);
128 
129  j = makeJoint("j_ve");
130  j->registerHandle(pji_, false);
131  j->registerHandle(vji_, true);
132  j->registerHandle(eji_, true);
133 
137 
138  }
139 
140  bool prepareSwitch(const std::list<hardware_interface::ControllerInfo>& start_list,
141  const std::list<hardware_interface::ControllerInfo>& stop_list) override
142  {
143 
144  if(!RobotHW::prepareSwitch(start_list, stop_list))
145  {
146  ROS_ERROR("Something is wrong with RobotHW");
147  return false;
148  }
149 
150  if(!intersect(start_list, stop_list).empty())
151  {
152  ROS_ERROR_STREAM("start_list and stop_list intersect");
153  return false;
154  }
155 
156  bool j_pe_e = false;
157  bool j_ve_v = false;
158 
159  for (const auto& controller : start_list)
160  {
161  if (controller.claimed_resources.size() != 1)
162  {
163  ROS_FATAL("We expect controllers to claim resoures from only one interface. This should never happen!");
164  return false;
165  }
166  const hardware_interface::InterfaceResources& iface_res = controller.claimed_resources.front();
167  for (const auto& resource : iface_res.resources)
168  {
169  // special check
170  if(iface_res.hardware_interface == "hardware_interface::EffortJointInterface" && resource == "j_pe") j_pe_e = true;
171  else if(iface_res.hardware_interface == "hardware_interface::VelocityJointInterface" && resource == "j_ve") j_ve_v = true;
172 
173  // per joint check
174  try
175  {
176  if(!joints_.at(resource)->prepareSwitch(iface_res.hardware_interface))
177  {
178  ROS_ERROR_STREAM("Cannot switch " << resource << " to " << iface_res.hardware_interface);
179  return false;
180  }
181  }
182  catch(...)
183  {
184  ROS_FATAL("This should never happen!");
185  return false;
186  }
187  }
188  }
189  return !(j_pe_e && j_ve_v); // check inter-joint hardware interface conflict
190  }
191  void doSwitch(const std::list<hardware_interface::ControllerInfo> &start_list, const std::list<hardware_interface::ControllerInfo> &stop_list) override
192  {
193  RobotHW::doSwitch(start_list, stop_list); // check if member is defined
194 
195  std::map<std::string, std::string> switches;
196  for (const auto& controller : stop_list)
197  {
198  started_.erase(std::remove(started_.begin(), started_.end(), controller.name), started_.end());
199  stopped_.push_back(controller.name);
200  const hardware_interface::InterfaceResources& iface_res = controller.claimed_resources.front();
201  for (const auto& resource : iface_res.resources)
202  {
203  switches[resource] = "";
204  }
205  }
206  for (const auto& controller : start_list)
207  {
208  stopped_.erase(std::remove(stopped_.begin(), stopped_.end(), controller.name), stopped_.end());
209  started_.push_back(controller.name);
210  const hardware_interface::InterfaceResources& iface_res = controller.claimed_resources.front();
211  for (const auto& resource : iface_res.resources)
212  {
213  switches[resource] = iface_res.hardware_interface;
214  }
215  }
216  for (const auto& to_switch : switches)
217  {
218  joints_[to_switch.first]->doSwitch(to_switch.second);
219  }
220  }
221  bool checkUnqiue() const
222  {
223  return intersect(started_, stopped_).empty();
224  }
225  bool checkNotRunning() const
226  {
227  return started_.empty();
228  }
229 };
230 
231 
233 {
235  {
236  const std::string type_name;
237  public:
238  DummyController(const std::string &name) : type_name(name) {}
239  void update(const ros::Time& /*time*/, const ros::Duration& /*period*/) override {}
241  ros::NodeHandle& /*root_nh*/,
242  ros::NodeHandle& controller_nh,
243  ClaimedResources& claimed_resources) override
244  {
245  std::vector<std::string> joints;
246  if(!controller_nh.getParam("joints", joints))
247  {
248  ROS_ERROR("Could not parse joint names");
249  return false;
250  }
251  std::set<std::string> resources(joints.begin(), joints.end());
253  claimed_resources.assign(1, iface_res);
255  return true;
256  }
257  virtual std::string getHardwareInterfaceType() const
258  {
259  return type_name;
260  }
261  };
262 
263  std::map<std::string, std::string> classes;
264  void add(const std::string type)
265  {
266  classes.insert(std::make_pair("Dummy" + type + "Controller", "hardware_interface::" + type));
267  }
268 public:
269  DummyControllerLoader() : ControllerLoaderInterface("controller_interface::ControllerBase")
270  {
271  add("EffortJointInterface");
272  add("PositionJointInterface");
273  add("VelocityJointInterface");
274  }
275  controller_interface::ControllerBaseSharedPtr createInstance(const std::string& lookup_name) override
276  {
278  }
279  std::vector<std::string> getDeclaredClasses() override
280  {
281  std::vector<std::string> v;
282  for (const auto& declared_class : classes)
283  {
284  v.push_back(declared_class.first);
285  }
286  return v;
287  }
288  void reload() override {}
289 };
290 
292 {
294 }
295 
296 class GuardROS
297 {
298 public:
300  {
301  ros::shutdown();
303  }
304 };
305 
306 TEST(SwitchInterfacesTest, SwitchInterfaces)
307 {
308  GuardROS guard;
309 
310  SwitchBot bot;
311  ros::NodeHandle nh;
312 
314 
315  cm.registerControllerLoader(std::make_shared<DummyControllerLoader>());
316 
317  ros::Timer timer = nh.createTimer(ros::Duration(0.01), std::bind(&update, std::ref(cm), std::placeholders::_1));
318 
319  ASSERT_TRUE(cm.loadController("group_pos"));
320  ASSERT_TRUE(cm.loadController("another_group_pos"));
321  ASSERT_TRUE(cm.loadController("group_vel"));
322  ASSERT_TRUE(cm.loadController("group_eff"));
323  ASSERT_TRUE(cm.loadController("single_pos"));
324  ASSERT_TRUE(cm.loadController("single_eff"));
325  ASSERT_TRUE(cm.loadController("invalid_group_pos"));
326  ASSERT_FALSE(cm.loadController("totally_random_name"));
327 
328  { // test hardware interface conflict
329  std::vector<std::string> start, stop;
330  start.push_back("invalid_group_pos");
331  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
332  }
333  { // test resource conflict
334  std::vector<std::string> start, stop;
335  start.push_back("group_pos");
336  start.push_back("group_vel");
337  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
338  }
339  { // test pos group
340  std::vector<std::string> start, stop;
341  start.push_back("group_pos");
342  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
343  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
344  }
345  { // test same hardware interface switch
346  std::vector<std::string> start, stop, next_start;
347  start.push_back("group_pos");
348  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
349 
350  next_start.push_back("group_pos");
351  ASSERT_TRUE(cm.switchController(next_start, start, controller_manager_msgs::SwitchControllerRequest::STRICT));
352 
353  ASSERT_TRUE(cm.switchController(stop, next_start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
354  }
355  { // test same hardware interface switch
356  std::vector<std::string> start, stop, next_start;
357  start.push_back("group_pos");
358  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
359 
360  next_start.push_back("another_group_pos");
361  ASSERT_TRUE(cm.switchController(next_start, start, controller_manager_msgs::SwitchControllerRequest::STRICT));
362 
363  ASSERT_TRUE(cm.switchController(stop, next_start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
364  }
365  { // test vel group
366  std::vector<std::string> start, stop;
367  start.push_back("group_vel");
368  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
369  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
370  }
371  { // test eff group
372  std::vector<std::string> start, stop;
373  start.push_back("group_eff");
374  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
375  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
376  }
377 
378  { // test direct hardware interface upgrades (okay) and downgrades (conflict)
379  std::vector<std::string> start, stop, next_start;
380  start.push_back("group_eff");
381  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
382 
383  next_start.push_back("group_vel");
384  ASSERT_TRUE(cm.switchController(next_start, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // upgrade
385 
386  ASSERT_FALSE(cm.switchController(start, next_start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // downgrade
387 
388  ASSERT_TRUE(cm.switchController(stop, next_start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
389  }
390 
391  { // test single pos
392  std::vector<std::string> start, stop;
393  start.push_back("single_pos");
394  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
395  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
396  }
397  { // test single eff
398  std::vector<std::string> start, stop;
399  start.push_back("single_pos");
400  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
401  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
402  }
403  { // test single pos + group_eff (resource conflict)
404  std::vector<std::string> start, stop;
405  start.push_back("single_pos");
406  start.push_back("group_eff");
407  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
408  }
409  { // test single pos + group_eff (hardware interface conflict)
410  std::vector<std::string> start, stop;
411  start.push_back("single_eff");
412  start.push_back("group_vel");
413  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
414  }
415  { // test single pos + group_vel
416  std::vector<std::string> start, stop;
417  start.push_back("single_pos");
418  start.push_back("group_vel");
419  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
420  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
421  }
422  { // test single pos + group_vel + totally_random_name
423  std::vector<std::string> start, stop;
424  start.push_back("single_pos");
425  start.push_back("group_vel");
426  start.push_back("totally_random_name");
427  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
428  ASSERT_FALSE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT));
429 
430  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::BEST_EFFORT));
431  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::BEST_EFFORT)); // clean-up
432  }
433  { // test restart
434  std::vector<std::string> start, stop;
435  start.push_back("single_pos");
436  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
437 
438  ASSERT_TRUE(cm.switchController(start, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // restart
439  ASSERT_TRUE(bot.checkUnqiue());
440 
441  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
442  }
443  { // test stop for controller that is not running
444  std::vector<std::string> start, stop;
445  stop.push_back("single_pos");
446  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
447  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::BEST_EFFORT));
448  }
449  { // test stop for controller that is not running
450  std::vector<std::string> start, stop;
451  start.push_back("single_pos");
452  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
453  ASSERT_FALSE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::STRICT));
454  ASSERT_TRUE(cm.switchController(start, stop, controller_manager_msgs::SwitchControllerRequest::BEST_EFFORT));
455  ASSERT_TRUE(cm.switchController(stop, start, controller_manager_msgs::SwitchControllerRequest::STRICT)); // clean-up
456  }
457  ASSERT_TRUE(bot.checkNotRunning());
458 }
459 
460 int main(int argc, char **argv)
461 {
462  testing::InitGoogleTest(&argc, argv);
463  ros::init(argc, argv, "controller_manager_switch_test");
464 
465  ros::AsyncSpinner spinner(1);
466  spinner.start();
467  int ret = RUN_ALL_TESTS();
468  return ret;
469 }
controller_manager::ControllerManager
ROS Controller Manager and Runner.
Definition: controller_manager.h:64
hardware_interface::operator<
bool operator<(hardware_interface::ControllerInfo const &i1, hardware_interface::ControllerInfo const &i2)
Definition: hwi_switch_test.cpp:43
SwitchBot::vji_
hardware_interface::VelocityJointInterface vji_
Definition: hwi_switch_test.cpp:69
DummyControllerLoader::createInstance
controller_interface::ControllerBaseSharedPtr createInstance(const std::string &lookup_name) override
Definition: hwi_switch_test.cpp:275
SwitchBot::Joint
Definition: hwi_switch_test.cpp:72
SwitchBot::makeJoint
JointSharedPtr makeJoint(const std::string &name)
Definition: hwi_switch_test.cpp:104
SwitchBot
Definition: hwi_switch_test.cpp:65
SwitchBot::Joint::jsh_
hardware_interface::JointStateHandle jsh_
Definition: hwi_switch_test.cpp:77
SwitchBot::prepareSwitch
bool prepareSwitch(const std::list< hardware_interface::ControllerInfo > &start_list, const std::list< hardware_interface::ControllerInfo > &stop_list) override
Definition: hwi_switch_test.cpp:140
ROS_ERROR_STREAM
#define ROS_ERROR_STREAM(args)
DummyControllerLoader::DummyController
Definition: hwi_switch_test.cpp:234
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros::TimerEvent::last_real
Time last_real
controller_interface::ControllerBase::ControllerState::INITIALIZED
@ INITIALIZED
hardware_interface::InterfaceResources::hardware_interface
std::string hardware_interface
ros::AsyncSpinner::start
void start()
SwitchBot::doSwitch
void doSwitch(const std::list< hardware_interface::ControllerInfo > &start_list, const std::list< hardware_interface::ControllerInfo > &stop_list) override
Definition: hwi_switch_test.cpp:191
DummyControllerLoader
Definition: hwi_switch_test.cpp:232
hardware_interface::JointStateInterface
SwitchBot::Joint::doSwitch
void doSwitch(const std::string &n)
Definition: hwi_switch_test.cpp:94
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
hardware_interface::InterfaceManager::registerInterface
void registerInterface(T *iface)
controller_interface::ControllerBase::state_
ControllerState state_
ros::AsyncSpinner
SwitchBot::SwitchBot
SwitchBot()
Definition: hwi_switch_test.cpp:114
SwitchBot::Joint::prepareSwitch
bool prepareSwitch(const std::string &n)
Definition: hwi_switch_test.cpp:89
ros::shutdown
ROSCPP_DECL void shutdown()
SwitchBot::checkUnqiue
bool checkUnqiue() const
Definition: hwi_switch_test.cpp:221
controller_interface::ControllerBase::ClaimedResources
std::vector< hardware_interface::InterfaceResources > ClaimedResources
update
void update(controller_manager::ControllerManager &cm, const ros::TimerEvent &e)
Definition: hwi_switch_test.cpp:291
SwitchBot::pji_
hardware_interface::PositionJointInterface pji_
Definition: hwi_switch_test.cpp:68
main
int main(int argc, char **argv)
Definition: hwi_switch_test.cpp:460
controller_manager::ControllerLoaderInterface::ControllerLoaderInterface
ControllerLoaderInterface(const std::string &name)
Definition: controller_loader_interface.h:48
DummyControllerLoader::DummyController::update
void update(const ros::Time &, const ros::Duration &) override
Definition: hwi_switch_test.cpp:239
SwitchBot::Joint::dummy_
double dummy_
Definition: hwi_switch_test.cpp:74
controller_interface::ControllerBase
DummyControllerLoader::getDeclaredClasses
std::vector< std::string > getDeclaredClasses() override
Definition: hwi_switch_test.cpp:279
hardware_interface::VelocityJointInterface
hardware_interface
joint_command_interface.h
SwitchBot::Joint::Joint
Joint(const std::string &n, hardware_interface::JointStateInterface &iface)
Definition: hwi_switch_test.cpp:79
DummyControllerLoader::add
void add(const std::string type)
Definition: hwi_switch_test.cpp:264
hardware_interface::RobotHW
SwitchBot::Joint::current_
std::string current_
Definition: hwi_switch_test.cpp:76
DummyControllerLoader::DummyController::getHardwareInterfaceType
virtual std::string getHardwareInterfaceType() const
Definition: hwi_switch_test.cpp:257
controller_manager::ControllerManager::switchController
bool switchController(const std::vector< std::string > &start_controllers, const std::vector< std::string > &stop_controllers, const int strictness, bool start_asap=WAIT_FOR_ALL_RESOURCES, double timeout=INFINITE_TIMEOUT)
Switch multiple controllers simultaneously.
Definition: controller_manager.cpp:436
hardware_interface::JointStateHandle
DummyControllerLoader::DummyController::DummyController
DummyController(const std::string &name)
Definition: hwi_switch_test.cpp:238
DummyControllerLoader::DummyControllerLoader
DummyControllerLoader()
Definition: hwi_switch_test.cpp:269
SwitchBot::JointSharedPtr
std::shared_ptr< Joint > JointSharedPtr
Definition: hwi_switch_test.cpp:100
hardware_interface::EffortJointInterface
DummyControllerLoader::classes
std::map< std::string, std::string > classes
Definition: hwi_switch_test.cpp:263
ros::TimerEvent
controller_manager::ControllerLoaderInterface
Abstract Controller Loader Interface.
Definition: controller_loader_interface.h:45
ResourceManager< JointStateHandle >::registerHandle
void registerHandle(const JointStateHandle &handle)
GuardROS
Definition: hwi_switch_test.cpp:296
ros::TimerEvent::current_real
Time current_real
DummyControllerLoader::DummyController::type_name
const std::string type_name
Definition: hwi_switch_test.cpp:236
ROS_FATAL
#define ROS_FATAL(...)
hardware_interface::ControllerInfo
start
ROSCPP_DECL void start()
SwitchBot::Joint::interfaces_
std::set< std::string > interfaces_
Definition: hwi_switch_test.cpp:75
GuardROS::~GuardROS
~GuardROS()
Definition: hwi_switch_test.cpp:299
ros::Time
DummyControllerLoader::reload
void reload() override
Definition: hwi_switch_test.cpp:288
ros::waitForShutdown
ROSCPP_DECL void waitForShutdown()
SwitchBot::checkNotRunning
bool checkNotRunning() const
Definition: hwi_switch_test.cpp:225
SwitchBot::eji_
hardware_interface::EffortJointInterface eji_
Definition: hwi_switch_test.cpp:70
controller_interface::ControllerBaseSharedPtr
std::shared_ptr< ControllerBase > ControllerBaseSharedPtr
SwitchBot::started_
std::vector< std::string > started_
Definition: hwi_switch_test.cpp:111
ROS_ERROR
#define ROS_ERROR(...)
DummyControllerLoader::DummyController::initRequest
bool initRequest(hardware_interface::RobotHW *, ros::NodeHandle &, ros::NodeHandle &controller_nh, ClaimedResources &claimed_resources) override
Definition: hwi_switch_test.cpp:240
hardware_interface::ControllerInfo::name
std::string name
SwitchBot::Joint::registerHandle
void registerHandle(Interface &iface, bool can_switch)
Definition: hwi_switch_test.cpp:84
SwitchBot::stopped_
std::vector< std::string > stopped_
Definition: hwi_switch_test.cpp:112
robot_hw.h
hardware_interface::PositionJointInterface
controller_manager.h
controller_manager::ControllerManager::registerControllerLoader
void registerControllerLoader(ControllerLoaderInterfaceSharedPtr controller_loader)
Register a controller loader.
Definition: controller_manager.cpp:837
hardware_interface::InterfaceResources
intersect
T intersect(const T &v1, const T &v2)
Definition: hwi_switch_test.cpp:48
ros::NodeHandle::createTimer
Timer createTimer(Duration period, const TimerCallback &callback, bool oneshot=false, bool autostart=true) const
SwitchBot::joints_
std::map< std::string, JointSharedPtr > joints_
Definition: hwi_switch_test.cpp:102
ros::Duration
ros::Timer
controller_manager::ControllerManager::update
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)
Update all active controllers.
Definition: controller_manager.cpp:66
TEST
TEST(SwitchInterfacesTest, SwitchInterfaces)
Definition: hwi_switch_test.cpp:306
hardware_interface::InterfaceResources::resources
std::set< std::string > resources
SwitchBot::jsi_
hardware_interface::JointStateInterface jsi_
Definition: hwi_switch_test.cpp:67
ros::NodeHandle
controller_manager::ControllerManager::loadController
bool loadController(const std::string &name)
Load a new controller by name.
Definition: controller_manager.cpp:229


controller_manager
Author(s): Wim Meeussen, Mathias Lüdtke
autogenerated on Fri Nov 3 2023 02:08:02