18 This program is a simple script that runs the hand through different given poses. 20 It is a good example on how to use the latching feature of the 21 ros publisher to make sure a data is received even if we don't stream 29 from std_msgs.msg
import Float64
34 controller_type =
"_position_controller" 41 self.
keys = [
'FFJ0',
'FFJ3',
'FFJ4',
42 'MFJ0',
'MFJ3',
'MFJ4',
43 'RFJ0',
'RFJ3',
'RFJ4',
44 'LFJ0',
'LFJ3',
'LFJ4',
'LFJ5',
45 'THJ1',
'THJ2',
'THJ3',
'THJ4',
'THJ5',
49 for joint
in self.
keys]
57 Runs the hand through different predefined position in a given order. 60 start = [0.00, 0.00, 0.00, 0.00,
61 0.00, 0.00, 0.00, 0.00,
62 0.00, 0.00, 0.00, 0.00,
63 0.00, 0.00, 0.00, 0.00, 0.00,
64 0.00, 0.00, 0.00, 0.00, 0.00,
67 fist = [3.14, 1.57, 0.00,
70 3.4, 1.57, 0.00, 0.00,
71 1.33, 0.00, 1.15, 0.26,
74 victory = [0.00, 0.00, -0.35,
77 3.14, 1.57, -0.17, 0.00,
78 1.05, 0.00, 0.87, 0.61,
114 Publish a given pose. 116 for joint, pos
in pose.iteritems():
121 Creates a dictionary of publishers to send the targets to the controllers 122 on /sh_??_??j?_mixed_position_velocity_controller/command 123 or /sh_??_??j?_position_controller/command 127 for joint
in keys_prefixed:
132 hand_pub[joint] = rospy.Publisher(
134 latch=
True, queue_size=1)
140 rospy.init_node(
'sr_latching_example', anonymous=
True)
145 if __name__ ==
'__main__':
def publish_pose(self, pose)
def create_hand_publishers(self, keys_prefixed)