예제 #1
0
def larm_joints(in_degrees = True):
    if in_degrees:
        gain = 180.0/math.pi
    else:
        gain = 1.0     
    lajd = PyPR2.getArmJointPositions(True)
    return(gain*gen_larm_joint_vector_from_dic(lajd))
예제 #2
0
def twist_forearm(angle = 180.0, is_left_arm = True):
        if is_left_arm:
            joint_name = 'l_forearm_roll_joint'
        else:
            joint_name = 'r_forearm_roll_joint'
            
        jd   = PyPR2.getArmJointPositions(is_left_arm)
        jd[joint_name] = jd[joint_name] + angle*math.pi/180.0
        PyPR2.moveArmWithJointPos(**jd)    
예제 #3
0
def rarm_elbow_flex_joint(in_degrees = True):
    '''
    returns the current angle of the shoulder pan joint of the right arm
    '''
    if in_degrees:
        gain = 180.0/math.pi
    else:
        gain = 1.0     
    rajd = PyPR2.getArmJointPositions(False)
    return(gain*rajd['r_elbow_flex_joint'])
예제 #4
0
def larm_elbow_flex_joint(in_degrees = True):
    '''
    returns the current angle of the shoulder pan joint of the left arm
    '''
    if in_degrees:
        gain = 180.0/math.pi
    else:
        gain = 1.0     
    lajd = PyPR2.getArmJointPositions(True)
    return(gain*lajd['l_elbow_flex_joint'])
예제 #5
0
def larm_shoulder_lift_joint(in_degrees = True):
    '''
    returns the current angle of the shoulder lift joint of the left arm
    '''
    if in_degrees:
        gain = 180.0/math.pi
    else:
        gain = 1.0     
    rajd = PyPR2.getArmJointPositions(True)
    return(gain*rajd['l_shoulder_lift_joint'])
예제 #6
0
    def play(self):
        if not self.action_finishes:
            print "still playing action '%s'." % self.name
            return

        myaction = PyPR2.getArmJointPositions(self.isleft)
        myaction['time_to_reach'] = 1.0

        rot = 0.0
        if self.clockwise:
            rot = math.pi / 2.0
        else:
            rot = -math.pi / 2.0

        if self.isleft == True:
            myaction[
                'l_wrist_roll_joint'] = myaction['l_wrist_roll_joint'] + rot
        else:
            myaction[
                'r_wrist_roll_joint'] = myaction['r_wrist_roll_joint'] + rot

        PyPR2.moveArmWithJointPos(**myaction)
        self.action_finishes = False
예제 #7
0
    def finishsArmAction(self, is_left):
        self.count = self.count + 1
        if self.count == self.revolution * 4:
            self.count = 0
            self.action_finishes = True
            return

        myaction = PyPR2.getArmJointPositions(self.isleft)
        myaction['time_to_reach'] = 1.0

        rot = 0.0
        if self.clockwise:
            rot = math.pi / 2.0
        else:
            rot = -math.pi / 2.0

        if self.isleft == True:
            myaction[
                'l_wrist_roll_joint'] = myaction['l_wrist_roll_joint'] + rot
        else:
            myaction[
                'r_wrist_roll_joint'] = myaction['r_wrist_roll_joint'] + rot

        PyPR2.moveArmWithJointPos(**myaction)
예제 #8
0
def twist_rg(angle = 180.0):
        jd   = PyPR2.getArmJointPositions(False)
        jd['r_wrist_roll_joint'] = jd['r_wrist_roll_joint'] + angle*math.pi/180.0
        PyPR2.moveArmWithJointPos(**jd)