controller_manager_interface_test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import unittest
3 from controller_manager import controller_manager_interface
4 
5 
6 class TestUtils(unittest.TestCase):
7  def test_scripts(self):
8 
9  # load my_controller1.
10  self.assertTrue(controller_manager_interface.load_controller('my_controller1'))
11 
12  # load a non-existent controller.
13  self.assertFalse(controller_manager_interface.load_controller('non_existent_controller'))
14 
15  # start my_controller1.
16  self.assertTrue(controller_manager_interface.start_controller('my_controller1'))
17 
18  # start my_controller3 which hasn't been loaded.
19  self.assertFalse(controller_manager_interface.start_controller('my_controller3'))
20 
21  # stop my_controller1
22  self.assertTrue(controller_manager_interface.stop_controller('my_controller1'))
23 
24  # load my_controller3.
25  self.assertTrue(controller_manager_interface.load_controller('my_controller3'))
26 
27  # start my_controller1 and my_controller3
28  self.assertTrue(controller_manager_interface.start_controllers(('my_controller1', 'my_controller3')))
29 
30  # stop my_controller1 and my_controller3
31  self.assertTrue(controller_manager_interface.stop_controllers(('my_controller1', 'my_controller3')))
32 
33  # reload libraries and restore controllers
34  self.assertTrue(controller_manager_interface.reload_libraries(force_kill=True, restore=True))
35 
36  # unload my_controller1.
37  self.assertTrue(controller_manager_interface.unload_controller('my_controller1'))
38  # unload my_controller2.
39  self.assertTrue(controller_manager_interface.unload_controller('my_controller3'))
40 
41  # load my_controller1.
42  self.assertTrue(controller_manager_interface.load_controller('my_controller1'))
43 
44  # reload librareis when some controllers are loaded.
45  self.assertFalse(controller_manager_interface.reload_libraries(force_kill=False, restore=True))
46 
47  # reload librareis when controllers are loaded with force_kill=True.
48  self.assertTrue(controller_manager_interface.reload_libraries(force_kill=True, restore=False))
49 
50  # reload librareis when no controllers are loaded.
51  self.assertTrue(controller_manager_interface.reload_libraries(force_kill=False, restore=False))
52 
53 
54 if __name__ == '__main__':
55  import rostest
56  rostest.rosrun('controller_manager_msgs',
57  'controller_manager_scripts_rostest',
58  TestUtils)


controller_manager_tests
Author(s): Vijay Pradeep, Adolfo Rodriguez Tsouroukdissian
autogenerated on Mon Apr 20 2020 03:52:10