35 CONTROLLER_NAME =
"quick_effort_controller_%08d" % random.randint(0,10**8-1)
40 roslib.load_manifest(
'robot_mechanism_controllers')
43 from pr2_controller_manager
import pr2_controller_manager_interface
48 pr2_controller_manager_interface.stop_controller(CONTROLLER_NAME)
49 pr2_controller_manager_interface.unload_controller(CONTROLLER_NAME)
50 if prev_handler
is not None:
54 rospy.set_param(CONTROLLER_NAME+
'/type',
'JointEffortController')
55 rospy.set_param(CONTROLLER_NAME+
'/joint', joint_name)
59 print "Usage: effort.py <joint>" 62 rospy.init_node(
'effort', anonymous=
True)
66 prev_handler = signal.getsignal(signal.SIGINT)
67 signal.signal(signal.SIGINT, shutdown)
70 pr2_controller_manager_interface.load_controller(CONTROLLER_NAME)
71 pr2_controller_manager_interface.start_controller(CONTROLLER_NAME)
73 pub = rospy.Publisher(
"%s/command" % CONTROLLER_NAME, Float64)
75 print "Enter efforts:" 76 while not rospy.is_shutdown():
77 effort = float(sys.stdin.readline().strip())
78 pub.publish(Float64(effort))
80 if __name__ ==
'__main__':
def load_joint_config(joint_name)
def shutdown(sig, stackframe)