22 def __init__(self, grasp_from, grasp_to="current"):
24 interpolate from one grasp to another 27 grasp_from -- goes from this grasp 28 grasp_to -- to this grasp (if not defined, then consider 29 the current position of the hand as a grasp) 39 for joint
in self.grasp_from.joints_and_positions.keys():
41 self.from_grasp1_to_grasp2.update({
42 joint: [self.grasp_from.joints_and_positions.get(joint),
43 self.grasp_to.joints_and_positions.get(joint)]})
47 move to a given percentage between grasp1 and grasp2 50 percentage -- must be between 0 and 100 53 positions_to_send = {}
55 for joint
in self.from_grasp1_to_grasp2.iteritems():
56 new_target = percentage / 100.0 * (joint[1][1] - joint[1][0])
57 positions_to_send.update({joint[0]: new_target})
59 return positions_to_send
63 for name, position
in self.grasp_to.joints_and_positions.items():
64 if name
in self.grasp_from.joints_and_positions.keys():
65 pos_from = self.grasp_from.joints_and_positions[name]
67 position_to_send[name] = pos_from + (
68 pos_to - pos_from) * (percentage / 100.0)
69 return position_to_send
def set_percentage_grasp1_to_grasp2(self, percentage)
def interpolate(self, percentage)
def __init__(self, grasp_from, grasp_to="current")