20 def __init__(self, grasp_from, grasp_to="current"):
22 interpolate from one grasp to another 25 grasp_from -- goes from this grasp 26 grasp_to -- to this grasp (if not defined, then consider 27 the current position of the hand as a grasp) 37 for joint
in self.
grasp_from.joints_and_positions.keys():
40 joint: [self.
grasp_from.joints_and_positions.get(joint),
41 self.
grasp_to.joints_and_positions.get(joint)]})
45 move to a given percentage between grasp1 and grasp2 48 percentage -- must be between 0 and 100 51 positions_to_send = {}
54 new_target = percentage / 100.0 * (joint[1][1] - joint[1][0])
55 positions_to_send.update({joint[0]: new_target})
57 return positions_to_send
61 for name, position
in self.
grasp_to.joints_and_positions.items():
62 if name
in self.
grasp_from.joints_and_positions.keys():
63 pos_from = self.
grasp_from.joints_and_positions[name]
65 position_to_send[name] = pos_from + (
66 pos_to - pos_from) * (percentage / 100.0)
67 return position_to_send
def set_percentage_grasp1_to_grasp2(self, percentage)
def interpolate(self, percentage)
def __init__(self, grasp_from, grasp_to="current")