コード例 #1
0
ファイル: NAOCalibration.py プロジェクト: baudvix/roboteams
 def changeBodyOrientation(self, orientation):
     if(orientation == "init"):
         self.bodyOrientation = "init"
         self.naoCameraHeight = 50
         config.walkPoseInit(self.motionProxy)
     elif(orientation == "knee"):
         self.bodyOrientation = "knee"
         self.naoCameraHeight = 41
         config.calibrationPoseInit(self.motionProxy)
     elif(orientation == "zero"):
         self.bodyOrientation = "zero"
         self.naoCameraHeight = 52
         config.poseZero(self.motionProxy)
コード例 #2
0
def main(pChainName = "LArm"):
    ''' Example showing the effect of collision detection
        Nao bumps his chest with his left arm with collision detection enabled
        or disabled.
    '''

    ##################
    # Initialization #
    ##################

    motionProxy = config.loadProxy("ALMotion")
    # Set NAO in stiffness On.
    config.StiffnessOn(motionProxy)

    # Send robot to Pose Init.
    config.poseZero(motionProxy)

    # Get the robot configuration.
    robotConfig = motionProxy.getRobotConfig()
    robotName = ""
    for i in range(len(robotConfig[0])):
        if (robotConfig[0][i] == "Model Type"):
            robotName = robotConfig[1][i]

    ###############################
    # Arm motion bumping on torso #
    ###############################

    # Disable collision detection on chainName.
    pEnable = True
    success = motionProxy.setCollisionProtectionEnabled(pChainName, pEnable)
    if (not success):
        print("Failed to disable collision protection")
    time.sleep(1.0)
    config.poseZero(motionProxy)
    moveHead.moveHead(motionProxy, "HeadYaw", 45)
    moveHead.moveHead(motionProxy, "HeadPitch", 45)
    moveHand.moveHand(motionProxy, "RHand", 45)
    moveLegs.moveLegs(motionProxy, "RHipYawPitch", 45)
    moveLegs.moveLegs(motionProxy, "LHipYawPitch", 45)
    moveFoot.moveFoot(motionProxy, "RAnklePitch", 45)
    time.sleep(3.0)
    # Make NAO's arm move so that it bumps its torso.
    #moveArm(motionProxy, robotName, pChainName, [0, 40, 0, 0])
    #moveArm(motionProxy, robotName, "LArm", [0, 40, 0, 0])
    #time.sleep(2.0)
    i = 0

#    while i < 3:
#        moveArm(motionProxy, robotName, pChainName, [10, 0, -90, -50], 0.3)
#        moveArm(motionProxy, robotName, "LArm", [10, 10, -90, -50], 0.3)
#        time.sleep(1.0)
#        moveArm(motionProxy, robotName, pChainName, [10, -10, -40, -50], 0.3)
#        moveArm(motionProxy, robotName, "LArm", [10, -10, -40, -50], 0.3)
#        time.sleep(1.0)
#        i += 1
    # Go back to pose init.
    config.poseZero(motionProxy)