controller_manager_interface_test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import unittest
00003 from controller_manager import controller_manager_interface
00004 
00005 
00006 class TestUtils(unittest.TestCase):
00007     def test_scripts(self):
00008 
00009         # load my_controller1.
00010         self.assertTrue(controller_manager_interface.load_controller('my_controller1'))
00011 
00012         # load a non-existent controller.
00013         self.assertFalse(controller_manager_interface.load_controller('non_existent_controller'))
00014 
00015         # start my_controller1.
00016         self.assertTrue(controller_manager_interface.start_controller('my_controller1'))
00017 
00018         # start my_controller3 which hasn't been loaded.
00019         self.assertFalse(controller_manager_interface.start_controller('my_controller3'))
00020 
00021         # stop my_controller1
00022         self.assertTrue(controller_manager_interface.stop_controller('my_controller1'))
00023 
00024         # load my_controller3.
00025         self.assertTrue(controller_manager_interface.load_controller('my_controller3'))
00026 
00027         # start my_controller1 and my_controller3
00028         self.assertTrue(controller_manager_interface.start_controllers(('my_controller1', 'my_controller3')))
00029 
00030         # stop my_controller1 and my_controller3
00031         self.assertTrue(controller_manager_interface.stop_controllers(('my_controller1', 'my_controller3')))
00032 
00033         # reload libraries and restore controllers
00034         self.assertTrue(controller_manager_interface.reload_libraries(force_kill=True, restore=True))
00035 
00036         # unload my_controller1.
00037         self.assertTrue(controller_manager_interface.unload_controller('my_controller1'))
00038         # unload my_controller2.
00039         self.assertTrue(controller_manager_interface.unload_controller('my_controller3'))
00040 
00041         # load my_controller1.
00042         self.assertTrue(controller_manager_interface.load_controller('my_controller1'))
00043 
00044         # reload librareis when some controllers are loaded.
00045         self.assertFalse(controller_manager_interface.reload_libraries(force_kill=False, restore=True))
00046 
00047         # reload librareis when controllers are loaded with force_kill=True.
00048         self.assertTrue(controller_manager_interface.reload_libraries(force_kill=True, restore=False))
00049 
00050         # reload librareis when no controllers are loaded.
00051         self.assertTrue(controller_manager_interface.reload_libraries(force_kill=False, restore=False))
00052 
00053 
00054 if __name__ == '__main__':
00055     import rostest
00056     rostest.rosrun('controller_manager_msgs',
00057                    'controller_manager_scripts_rostest',
00058                    TestUtils)


controller_manager_tests
Author(s): Vijay Pradeep
autogenerated on Sat Jun 8 2019 20:09:25