Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 import rospy
00029 from controller_manager_msgs.srv import *
00030
00031
00032 class ControllerManagerDummy:
00033 """
00034 Dummy controller manager instance.
00035
00036 Creates the expected controller manager ROS interface, with a simple
00037 default behavior that can be overridden by modifying its members.
00038 """
00039 def __init__(self, ns="/controller_manager"):
00040
00041 cm_ns = ns
00042 if not cm_ns or cm_ns[-1] != '/':
00043 cm_ns += '/'
00044
00045
00046 self.list_ctrl_resp = ListControllersResponse()
00047 self.list_types_resp = ListControllerTypesResponse()
00048 self.load_ctrl_resp = LoadControllerResponse(ok=True)
00049 self.unload_ctrl_resp = UnloadControllerResponse(ok=True)
00050 self.switch_ctrl_resp = SwitchControllerResponse(ok=True)
00051 self.reload_libs_resp = ReloadControllerLibrariesResponse(ok=True)
00052
00053
00054 self.list_ctrl = rospy.Service(cm_ns + 'list_controllers',
00055 ListControllers,
00056 self._list_ctrl_cb)
00057 self.list_types = rospy.Service(cm_ns + 'list_controller_types',
00058 ListControllerTypes,
00059 self._list_types_cb)
00060 self.load_ctrl = rospy.Service(cm_ns + 'load_controller',
00061 LoadController,
00062 self._load_ctrl_cb)
00063 self.unload_ctrl = rospy.Service(cm_ns + 'unload_controller',
00064 UnloadController,
00065 self._unload_ctrl_cb)
00066 self.switch_ctrl = rospy.Service(cm_ns + 'switch_controller',
00067 SwitchController,
00068 self._switch_ctrl_cb)
00069 self.reload_libs = rospy.Service(cm_ns + 'reload_controller_libraries',
00070 ReloadControllerLibraries,
00071 self._reload_libs_cb)
00072
00073 def _list_ctrl_cb(self, req):
00074 return self.list_ctrl_resp
00075
00076 def _list_types_cb(self, req):
00077 return self.list_types_resp
00078
00079 def _load_ctrl_cb(self, req):
00080 return self.load_ctrl_resp
00081
00082 def _unload_ctrl_cb(self, req):
00083 return self.unload_ctrl_resp
00084
00085 def _switch_ctrl_cb(self, req):
00086 return self.switch_ctrl_resp
00087
00088 def _reload_libs_cb(self, req):
00089 return self.reload_libs_resp