34 '/controller_manager',
35 '/foo/robot/controller_manager1',
36 '/foo/robot/controller_manager2' 49 rospy.wait_for_service(
"/controller_manager/list_controllers", 2.0)
55 self.assertTrue(self.
_ready())
58 self.assertTrue(is_controller_manager(cm))
60 self.assertFalse(is_controller_manager(cm))
63 self.assertTrue(self.
_ready())
66 self.assertEqual(valid_cm, get_controller_managers())
67 self.assertEqual(valid_cm, get_controller_managers(
'/'))
70 nested_cm = [valid_cm[2], valid_cm[3]]
71 self.assertEqual(nested_cm, get_controller_managers(
'/foo'))
72 self.assertEqual(nested_cm, get_controller_managers(
'/foo/robot'))
73 self.assertEqual([
'/controller_manager'],
74 get_controller_managers(
'/controller_manager'))
77 prev_cm = get_controller_managers()
78 self.assertEqual(valid_cm,
79 get_controller_managers(initial_guess=prev_cm))
82 self.assertEqual(valid_cm,
83 get_controller_managers(initial_guess=nested_cm))
88 wrong_cm = get_controller_managers(initial_guess=invalid_cm)
89 self.assertNotEqual(valid_cm, wrong_cm)
90 diff = list(set(wrong_cm) - set(valid_cm))
91 self.assertEqual(2, len(diff))
92 self.assertIn(
'/incomplete', diff)
93 self.assertIn(
'/bad_type', diff)
96 self.assertTrue(self.
_ready())
99 list_cm = ControllerManagerLister()
100 self.assertEqual(valid_cm, list_cm())
103 list_cm_foo = ControllerManagerLister(
'/foo')
104 nested_cm = [valid_cm[2], valid_cm[3]]
105 self.assertEqual(nested_cm, list_cm_foo())
108 self.assertTrue(self.
_ready())
111 list_controllers = ControllerLister()
112 controllers = list_controllers()
113 self.assertEqual(2, len(controllers))
114 self.assertEqual(
'foo_controller', controllers[0].name)
115 self.assertEqual(
'bar_controller', controllers[1].name)
118 list_controllers_ns = ControllerLister(
'/foo')
119 self.assertEqual(0, len(list_controllers_ns()))
123 names_def = get_rosparam_controller_names()
124 self.assertEqual(2, len(names_def))
125 self.assertIn(
'foo_controller', names_def)
126 self.assertIn(
'bar_controller', names_def)
129 names_root = get_rosparam_controller_names(
'/')
130 self.assertEqual(2, len(names_root))
131 self.assertIn(
'foo_controller', names_root)
132 self.assertIn(
'bar_controller', names_root)
135 names_empty = get_rosparam_controller_names(
'')
136 self.assertEqual(2, len(names_empty))
137 self.assertIn(
'foo_controller', names_empty)
138 self.assertIn(
'bar_controller', names_empty)
141 names_ns = get_rosparam_controller_names(
'/ns')
142 self.assertEqual(2, len(names_ns))
143 self.assertIn(
'baz_controller', names_ns)
144 self.assertIn(
'qux_controller', names_ns)
147 names_nss = get_rosparam_controller_names(
'/ns/')
148 self.assertEqual(2, len(names_nss))
149 self.assertIn(
'baz_controller', names_nss)
150 self.assertIn(
'qux_controller', names_nss)
152 if __name__ ==
'__main__':
154 rostest.rosrun(
'controller_manager_msgs',
155 'cm_msgs_utils_rostest',
def test_is_controller_manager(self)
def test_rosparam_controller_names(self)
def test_controller_lister(self)
def test_controller_manager_lister(self)
def test_get_controller_managers(self)