Example #1
0
 def setUpClass(self):
     self.session = qi.Session()
     self.session.connect('tcp://192.168.1.101:9559')
     self.motion = self.session.service('ALMotion')
     self.posture = self.session.service("ALRobotPosture")
     self.animation_player = AnimationPlayer(self.session,
                                             motion=self.motion)
     self.motion.setCollisionProtectionEnabled('Arms', False)
     self.motion.setExternalCollisionProtectionEnabled('All', False)
     rest_position(session=self.session)
Example #2
0
 def point_to_position(self, x, y):
     if y == 2:
         self.motion_service.setStiffnesses("RHand", 1.0)
         self.motion_service.setStiffnesses("RArm", 1.0)
         self.motion_service.closeHand("RHand")
         self.motion_service.setAngles("RHand", 0.0, self.fractionMaxSpeed)
         self.motion_service.setAngles(self.namesR, self.angles[x][y],
                                       self.fractionMaxSpeed)
         self.motion_service.setAngles("RHand", 1.0, self.fractionMaxSpeed)
         time.sleep(3.0)
         self.motion_service.setAngles("RHand", 0.0, self.fractionMaxSpeed)
     else:
         self.motion_service.setStiffnesses("LHand", 1.0)
         self.motion_service.setStiffnesses("LArm", 1.0)
         self.motion_service.setAngles("LHand", 0.0, self.fractionMaxSpeed)
         self.motion_service.setAngles(self.namesL, self.angles[x][y],
                                       self.fractionMaxSpeed)
         self.motion_service.setAngles("LHand", 1.0, self.fractionMaxSpeed)
         time.sleep(3.0)
         self.motion_service.setAngles("LHand", 0.0, self.fractionMaxSpeed)
     rest_position(self.session)
 def test_point_to_upper_right(self):
     print 'pointing to upper left'
     self.move_motors.point_to_position(0, 2)
     rest_position(self.session)
 def test_point_to_middle_left(self):
     print 'pointing to middle left'
     self.move_motors.point_to_position(1, 0)
     rest_position(self.session)
 def test_point_to_lower_left(self):
     print 'pointing to lower left'
     self.move_motors.point_to_position(2, 0)
     rest_position(self.session)
 def test_sleep_position(self):
     rest_position(self.session)
Example #7
0
 def reaction_draw(self):
     self.animation_service.run(self.animation_path +
                                'Gestures/IDontKnow_1')
     rest_position(session=self.session)
     return True
Example #8
0
 def reaction_lost(self):
     self.animation_service.run(self.animation_path +
                                'Emotions/Neutral/Embarrassed_1')
     rest_position(session=self.session)
     return True
Example #9
0
 def reaction_won(self):
     self.animation_service.run(self.animation_path +
                                'Emotions/Positive/Happy_4')
     rest_position(session=self.session)
     return True
Example #10
0
    def __init__(self, session):
        self.session = session
        self.motion_service = session.service("ALMotion")
        self.namesL = [
            "LShoulderRoll", "LShoulderPitch", "LElbowYaw", "LElbowRoll",
            "LHand"
        ]
        self.namesR = [
            "RShoulderRoll", "RShoulderPitch", "RElbowYaw", "RElbowRoll",
            "RHand"
        ]
        hand_closed = 0.0
        shoulder_safe_distance = 40 * almath.TO_RAD
        height_top_row = -52 * almath.TO_RAD
        height_middle_row = -45 * almath.TO_RAD
        height_bottom_row = -30 * almath.TO_RAD
        width_yaw = 8 * almath.TO_RAD
        width_left = -58 * almath.TO_RAD
        width_middle = -88 * almath.TO_RAD
        width_right = 58 * almath.TO_RAD

        angles_top = [[
            shoulder_safe_distance, height_top_row, width_yaw, width_left,
            hand_closed
        ],
                      [
                          shoulder_safe_distance, height_top_row, width_yaw,
                          width_middle, hand_closed
                      ],
                      [
                          -shoulder_safe_distance,
                          height_top_row + 15 * almath.TO_RAD, width_yaw,
                          width_right, hand_closed
                      ]]
        angles_middle = [[
            shoulder_safe_distance, height_middle_row, width_yaw, width_left,
            hand_closed
        ],
                         [
                             shoulder_safe_distance, height_middle_row,
                             width_yaw, width_middle, hand_closed
                         ],
                         [
                             -shoulder_safe_distance,
                             height_middle_row + 15 * almath.TO_RAD, width_yaw,
                             width_right, hand_closed
                         ]]
        angles_bottom = [[
            shoulder_safe_distance, height_bottom_row, width_yaw, width_left,
            hand_closed
        ],
                         [
                             shoulder_safe_distance, height_bottom_row,
                             width_yaw, width_middle, hand_closed
                         ],
                         [
                             -shoulder_safe_distance,
                             height_bottom_row + 15 * almath.TO_RAD, width_yaw,
                             width_right, hand_closed
                         ]]
        self.angles = [angles_top, angles_middle, angles_bottom]
        self.return_angle = [
            40 * almath.TO_RAD, 90 * almath.TO_RAD, 8 * almath.TO_RAD,
            -58 * almath.TO_RAD, hand_closed
        ]
        self.return_angleR = [
            -40 * almath.TO_RAD, 90 * almath.TO_RAD, 8 * almath.TO_RAD,
            58 * almath.TO_RAD, hand_closed
        ]
        self.fractionMaxSpeed = 0.2
        rest_position(self.session)