00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 import rospy;
00021 from pr2_mechanism_msgs.srv import *
00022
00023 class MockHand(object):
00024 """
00025 A ros node to look enough like a shadowhand for these tests.
00026
00027 List controller service so it looks like a ethercat hand to HandCommander.
00028 """
00029
00030 def __init__(self, ):
00031 """
00032 @brief Construct a new MockHand, setting up ros connections.
00033 """
00034 self.list_srv = rospy.Service('pr2_controller_manager/list_controllers',
00035 ListControllers, self.list_controllers_cb)
00036 rospy.loginfo("Started MockHand")
00037
00038 def list_controllers_cb(self, req):
00039 res = ListControllersResponse()
00040 res.controllers = ['sh_ffj0_position_controller', 'sh_ffj3_position_controller', 'sh_ffj4_position_controller', 'sh_lfj0_position_controller', 'sh_lfj3_position_controller', 'sh_lfj4_position_controller', 'sh_lfj5_position_controller', 'sh_mfj0_position_controller', 'sh_mfj3_position_controller', 'sh_mfj4_position_controller', 'sh_rfj0_position_controller', 'sh_rfj3_position_controller', 'sh_rfj4_position_controller', 'sh_thj1_position_controller', 'sh_thj2_position_controller', 'sh_thj3_position_controller', 'sh_thj4_position_controller', 'sh_thj5_position_controller', 'sh_wrj1_position_controller', 'sh_wrj2_position_controller']
00041 res.state = ['running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running']
00042 return res
00043
00044
00045 if __name__ == "__main__":
00046 try:
00047 rospy.init_node("mock_hand")
00048 node = MockHand()
00049 rospy.spin();
00050 except rospy.ROSInterruptException:
00051 pass
00052