20 import dynamic_reconfigure.client
 
   21 from std_msgs.msg 
import UInt8
 
   25         rospy.loginfo(
"Wait reconfig server...")
 
   27                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_shoulder_fixed_part_pan_joint"}, \
 
   28                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_shoulder_revolute_part_tilt_joint"}, \
 
   29                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_upper_arm_revolute_part_twist_joint"}, \
 
   30                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_upper_arm_revolute_part_rotate_joint"}, \
 
   31                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_lower_arm_fixed_part_joint"}, \
 
   32                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_lower_arm_revolute_part_joint"}, \
 
   33                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_wrist_joint"}, \
 
   34                             {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_gripper_finger_a_joint"}, \
 
   40             self.
preset_init.append( { 
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 } )
 
   44                             { 
"name":
"crane_x7_shoulder_fixed_part_pan_joint",          
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   45                             { 
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",      
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   46                             { 
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",    
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   47                             { 
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",   
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   48                             { 
"name":
"crane_x7_lower_arm_fixed_part_joint",             
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   49                             { 
"name":
"crane_x7_lower_arm_revolute_part_joint",          
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   50                             { 
"name":
"crane_x7_wrist_joint",                            
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   51                             { 
"name":
"crane_x7_gripper_finger_a_joint",                 
"p_gain": 10, 
"i_gain": 0, 
"d_gain": 0 },\
 
   56                             { 
"name":
"crane_x7_shoulder_fixed_part_pan_joint",          
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   57                             { 
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",      
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   58                             { 
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",    
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   59                             { 
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",   
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   60                             { 
"name":
"crane_x7_lower_arm_fixed_part_joint",             
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   61                             { 
"name":
"crane_x7_lower_arm_revolute_part_joint",          
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   62                             { 
"name":
"crane_x7_wrist_joint",                            
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   63                             { 
"name":
"crane_x7_gripper_finger_a_joint",                 
"p_gain": 400, 
"i_gain": 0, 
"d_gain": 0 },\
 
   68                             { 
"name":
"crane_x7_shoulder_fixed_part_pan_joint",          
"p_gain": 5, 
"i_gain": 0, 
"d_gain": 0 },\
 
   69                             { 
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",      
"p_gain": 5, 
"i_gain": 0, 
"d_gain": 0 },\
 
   70                             { 
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",    
"p_gain": 5, 
"i_gain": 0, 
"d_gain": 0 },\
 
   71                             { 
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",   
"p_gain": 5, 
"i_gain": 0, 
"d_gain": 0 },\
 
   72                             { 
"name":
"crane_x7_lower_arm_fixed_part_joint",             
"p_gain": 1, 
"i_gain": 0, 
"d_gain": 0 },\
 
   73                             { 
"name":
"crane_x7_lower_arm_revolute_part_joint",          
"p_gain": 1, 
"i_gain": 0, 
"d_gain": 0 },\
 
   74                             { 
"name":
"crane_x7_wrist_joint",                            
"p_gain": 1, 
"i_gain": 0, 
"d_gain": 0 },\
 
   75                             { 
"name":
"crane_x7_gripper_finger_a_joint",                 
"p_gain": 1, 
"i_gain": 0, 
"d_gain": 0 },\
 
   80                             { 
"name":
"crane_x7_shoulder_fixed_part_pan_joint",          
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   81                             { 
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",      
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   82                             { 
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",    
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   83                             { 
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",   
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   84                             { 
"name":
"crane_x7_lower_arm_fixed_part_joint",             
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   85                             { 
"name":
"crane_x7_lower_arm_revolute_part_joint",          
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   86                             { 
"name":
"crane_x7_wrist_joint",                            
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
   87                             { 
"name":
"crane_x7_gripper_finger_a_joint",                 
"p_gain": 800, 
"i_gain": 0, 
"d_gain": 0 },\
 
  100             self.
reconfigure.append( {
"client":dynamic_reconfigure.client.Client( joint[
"control"]+
"/"+joint[
"joint"],timeout=10 ), \
 
  101                                       "joint:":joint[
"joint"]} )
 
  102         rospy.loginfo(
"Wait sub...")
 
  104         rospy.loginfo(
"Init finished.")
 
  110             conf[
"client"].update_configuration( {
"position_p_gain":self.
preset_list[no.data][joint_no][
"p_gain"],
"position_i_gain":self.
preset_list[no.data][joint_no][
"i_gain"],
"position_d_gain":self.
preset_list[no.data][joint_no][
"d_gain"]} )
 
  111             joint_no = joint_no + 1
 
  114 if __name__ == 
'__main__':
 
  115     rospy.init_node(
'preset_reconfigure')