6 import dynamic_reconfigure.client
7 from std_msgs.msg
import UInt8
11 rospy.loginfo(
"Wait reconfig server...")
13 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_shoulder_fixed_part_pan_joint"}, \
14 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_shoulder_revolute_part_tilt_joint"}, \
15 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_upper_arm_revolute_part_twist_joint"}, \
16 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_upper_arm_revolute_part_rotate_joint"}, \
17 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_lower_arm_fixed_part_joint"}, \
18 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_lower_arm_revolute_part_joint"}, \
19 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_wrist_joint"}, \
20 {
"control":
"/crane_x7/crane_x7_control",
"joint":
"crane_x7_gripper_finger_a_joint"}, \
26 self.preset_init.append( {
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 } )
30 {
"name":
"crane_x7_shoulder_fixed_part_pan_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
31 {
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
32 {
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
33 {
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
34 {
"name":
"crane_x7_lower_arm_fixed_part_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
35 {
"name":
"crane_x7_lower_arm_revolute_part_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
36 {
"name":
"crane_x7_wrist_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
37 {
"name":
"crane_x7_gripper_finger_a_joint",
"p_gain": 10,
"i_gain": 0,
"d_gain": 0 },\
42 {
"name":
"crane_x7_shoulder_fixed_part_pan_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
43 {
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
44 {
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
45 {
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
46 {
"name":
"crane_x7_lower_arm_fixed_part_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
47 {
"name":
"crane_x7_lower_arm_revolute_part_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
48 {
"name":
"crane_x7_wrist_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
49 {
"name":
"crane_x7_gripper_finger_a_joint",
"p_gain": 400,
"i_gain": 0,
"d_gain": 0 },\
54 {
"name":
"crane_x7_shoulder_fixed_part_pan_joint",
"p_gain": 5,
"i_gain": 0,
"d_gain": 0 },\
55 {
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",
"p_gain": 5,
"i_gain": 0,
"d_gain": 0 },\
56 {
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",
"p_gain": 5,
"i_gain": 0,
"d_gain": 0 },\
57 {
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",
"p_gain": 5,
"i_gain": 0,
"d_gain": 0 },\
58 {
"name":
"crane_x7_lower_arm_fixed_part_joint",
"p_gain": 1,
"i_gain": 0,
"d_gain": 0 },\
59 {
"name":
"crane_x7_lower_arm_revolute_part_joint",
"p_gain": 1,
"i_gain": 0,
"d_gain": 0 },\
60 {
"name":
"crane_x7_wrist_joint",
"p_gain": 1,
"i_gain": 0,
"d_gain": 0 },\
61 {
"name":
"crane_x7_gripper_finger_a_joint",
"p_gain": 1,
"i_gain": 0,
"d_gain": 0 },\
66 {
"name":
"crane_x7_shoulder_fixed_part_pan_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
67 {
"name":
"crane_x7_shoulder_revolute_part_tilt_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
68 {
"name":
"crane_x7_upper_arm_revolute_part_twist_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
69 {
"name":
"crane_x7_upper_arm_revolute_part_rotate_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
70 {
"name":
"crane_x7_lower_arm_fixed_part_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
71 {
"name":
"crane_x7_lower_arm_revolute_part_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
72 {
"name":
"crane_x7_wrist_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
73 {
"name":
"crane_x7_gripper_finger_a_joint",
"p_gain": 800,
"i_gain": 0,
"d_gain": 0 },\
79 self.preset_list.append( self.
preset_1 )
80 self.preset_list.append( self.
preset_2 )
81 self.preset_list.append( self.
preset_3 )
82 self.preset_list.append( self.
preset_4 )
86 self.reconfigure.append( {
"client":dynamic_reconfigure.client.Client( joint[
"control"]+
"/"+joint[
"joint"],timeout=10 ), \
87 "joint:":joint[
"joint"]} )
88 rospy.loginfo(
"Wait sub...")
90 rospy.loginfo(
"Init finished.")
96 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"]} )
97 joint_no = joint_no + 1
100 if __name__ ==
'__main__':
101 rospy.init_node(
'preset_reconfigure')