$search
00001 #!/usr/bin/env python 00002 00003 import roslib; roslib.load_manifest('pi_tracker') 00004 import rospy 00005 import sys 00006 00007 from ax12_controller_core.srv import SetSpeed 00008 00009 class SetArmSpeed(): 00010 def __init__(self, speed): 00011 rospy.init_node('set_arm_speed') 00012 00013 rospy.loginfo("Setting arm speed to " + str(speed)) 00014 00015 max_speed = 0.7 00016 if speed > max_speed: 00017 speed = max_speed 00018 00019 self.servo_speed = dict() 00020 ax12_namespace = '/ax12_controller' 00021 dynamixels = rospy.get_param(ax12_namespace+'/dynamixels', dict()) 00022 for name in sorted(dynamixels): 00023 rospy.wait_for_service(ax12_namespace+'/'+name+'_controller/set_speed') 00024 self.servo_speed[name] = rospy.ServiceProxy(ax12_namespace+'/'+name+'_controller/set_speed', SetSpeed) 00025 try: 00026 self.servo_speed[name](speed) 00027 except: 00028 pass 00029 00030 if __name__ == '__main__': 00031 try: 00032 SetArmSpeed(float(sys.argv[1])) 00033 except rospy.ROSInterruptException: 00034 pass