当前位置: 首页>>代码示例>>Python>>正文


Python GoalieTransitions类代码示例

本文整理汇总了Python中GoalieTransitions的典型用法代码示例。如果您正苦于以下问题:Python GoalieTransitions类的具体用法?Python GoalieTransitions怎么用?Python GoalieTransitions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GoalieTransitions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: positionForGoalieKick

def positionForGoalieKick(player):
    if player.firstFrame():
        player.brain.tracker.lookStraightThenTrack()
        if clearBall.ballSide == RIGHT:
            player.kick = kicks.RIGHT_SHORT_STRAIGHT_KICK
        else:
            player.kick = kicks.LEFT_SHORT_STRAIGHT_KICK
        ball = player.brain.ball
        positionForGoalieKick.kickPose = RelRobotLocation(ball.rel_x - player.kick.setupX,
                                    ball.rel_y - player.kick.setupY,
                                    0)
        print("Kickpose:", positionForGoalieKick.kickPose.relX, positionForGoalieKick.kickPose.relY)
        positionForGoalieKick.speed = nav.GRADUAL_SPEED

        player.brain.nav.goTo(positionForGoalieKick.kickPose,
                                            speed = positionForGoalieKick.speed,
                                            precision = nav.CLOSE_ENOUGH)
    ball = player.brain.ball
    positionForGoalieKick.kickPose = RelRobotLocation(ball.rel_x - player.kick.setupX,
                                    ball.rel_y - player.kick.setupY,
                                    0)
    player.brain.nav.updateDest(positionForGoalieKick.kickPose)

    if GoalieTransitions.ballReadyToKick(player, positionForGoalieKick.kickPose):
        player.brain.nav.stand()
        print("Kickpose:", positionForGoalieKick.kickPose.relX, positionForGoalieKick.kickPose.relY)
        return player.goNow('kickBall')

    return Transition.getNextState(player, positionForGoalieKick)
开发者ID:coryalini,项目名称:nbites,代码行数:29,代码来源:VisualGoalieStates.py

示例2: goalieSave

def goalieSave(player):

    brain = player.brain
    ball = brain.ball

    if player.firstFrame():
        player.stopWalking()
        brain.tracker.trackBall()
        player.isSaving = True

    if helper.shouldSave(player):
        brain.tracker.stopHeadMoves()
        brain.fallController.enableFallProtection(False)
        if TESTING:
            print "Saving because"
            print "Ball.relVelX is" + str(ball.loc.relVelX)
            print "And Ball.heat is" + str(ball.vis.heat)
            if helper.shouldSaveRight(player):
                return player.goNow("testSaveRight")
            elif helper.shouldSaveLeft(player):
                return player.goNow("testSaveLeft")
            else:
                return player.goNow("testSaveCenter")
        else:
            if helper.shouldSaveRight(player):
                return player.goNow("saveRight")
            if helper.shouldSaveLeft(player):
                return player.goNow("saveLeft")
            else:
                return player.goNow("saveCenter")

    return player.stay()
开发者ID:nerkis,项目名称:nbites,代码行数:32,代码来源:GoalieSaveStates.py

示例3: goaliePosition

def goaliePosition(player):
    """
    Have the robot navigate to the position reported to it from playbook
    """
    nav = player.brain.nav
    my = player.brain.my
    ball = player.brain.ball
    heading = None

    if player.firstFrame():
        player.isPositioning = True
        player.isChasing = False
        player.isSaving = False
        nav.positionPlaybook()

    if ball.dist >= goalCon.ACTIVE_LOC_THRESH:
        player.brain.tracker.activeLoc()
    else:
        player.brain.tracker.trackBall() 

    if player.brain.nav.isStopped():
        if goalTran.shouldPositionLeft(player):
            player.goNow('goaliePositionLeft')

        elif goalTran.shouldPositionRight(player):
            player.goNow('goaliePositionRight')

    return player.stay()
开发者ID:bbellon,项目名称:nbites,代码行数:28,代码来源:GoaliePositionStates.py

示例4: testShouldPositionRight

def testShouldPositionRight(player):
    if player.counter % 100 == 0:
        if goalTran.shouldPositionRight(player):
            print "position right"
        elif goalTran.shouldPositionLeft(player):
            print "position left"
        elif goalTran.shouldPositionCenter(player):
            print "postion center"

    return player.stay()
开发者ID:bbellon,项目名称:nbites,代码行数:10,代码来源:GoalieTestStates.py

示例5: goaliePickSave

def goaliePickSave(player): 
    player.brain.fallController.enableFallProtection(False)

    if helper.shouldSaveRight(player):
        return player.goNow('saveRight')
    elif helper.shouldSaveLeft(player):
        return player.goNow('saveLeft')
    elif helper.shouldSaveCenter(player):
        return player.goNow('saveCenter')

    return player.stay()
开发者ID:bbellon,项目名称:nbites,代码行数:11,代码来源:GoalieSaveStates.py

示例6: goaliePositionForSave

def goaliePositionForSave(player):
    if player.firstFrame():
        player.stopWalking()
        player.brain.tracker.trackBall()

    strafeDir = helper.strafeDirForSave(player)
    if strafeDir == -1:
        helper.strafeRightSpeed(player)
    elif strafeDir == 1:
        helper.strafeLeftSpeed(player)
    else:
        player.stopWalking()

    return player.stay()
开发者ID:dmcavoy,项目名称:nao-man,代码行数:14,代码来源:GoaliePositionStates.py

示例7: squatPosition

def squatPosition(player):
    brain = player.brain
    position = brain.play.getPosition()
    nav = brain.nav
    my = brain.my

    if player.firstFrame():
        player.changeOmniGoToCounter = 0
        player.isChasing = False
        player.squatting = False

    if brain.ball.x >= constants.ACTIVE_LOC_THRESH:
        brain.tracker.activeLoc()
    else:
        brain.tracker.trackBall()

    useOmni = helper.useOmni(player)
    changedOmni = False

    ball = brain.ball
    bearing = None

    if (not nav.atDestinationGoalie() or
        not nav.atHeading()):
        if not useOmni:
            nav.goTo((PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y,\
                          NogginConstants.OPP_GOAL_HEADING))
        else:
            nav.omniGoTo((PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y,\
                              NogginConstants.OPP_GOAL_HEADING))
    else:
        player.stopWalking()
        return player.goLater("squat")

    return player.stay()
开发者ID:dmcavoy,项目名称:nao-man,代码行数:35,代码来源:SquatPositionStates.py

示例8: testSaveDecision

def testSaveDecision(player):
    ball = player.brain.ball

    if goalTran.shouldSave(player):
        return player.goNow('goalieSave')

    return player.stay()
开发者ID:hoangtuananh,项目名称:nbites,代码行数:7,代码来源:GoalieTestStates.py

示例9: holdRightSave

def holdRightSave(player):
    if helper.shouldHoldSave(player):
        return player.stay()
    else:
        return player.goLater('rollOutRight')

    return player.stay()
开发者ID:gnmerritt,项目名称:nbites,代码行数:7,代码来源:GoalieSaveStates.py

示例10: approachBall

def approachBall(player):
    """
    Once we are aligned with the ball, approach it
    """
    # Switch to other states if we should
    if player.penaltyKicking and \
           player.brain.ball.inOppGoalBox():
        return player.goNow('penaltyBallInOppGoalbox')
    elif player.brain.tracker.activeLocOn:
        if transitions.shouldScanFindBallActiveLoc(player):
            return player.goLater('scanFindBall')
    elif transitions.shouldScanFindBall(player):
        return player.goLater('scanFindBall')
    elif player.brain.play.isRole(GOALIE) and goalTran.dangerousBall(player):
        return player.goNow('approachDangerousBall')
    elif transitions.shouldDribble(player):
        return player.goNow('dribble')
    elif transitions.shouldSpinToBallClose(player):
        return player.goNow('spinToBallClose')
    elif transitions.shouldStopBeforeKick(player):
        return player.goNow('stopBeforeKick')
    elif transitions.shouldPositionForKick(player):
        return player.goNow('decideKick')

    if player.firstFrame():
        player.brain.nav.chaseBall()
        player.hasAlignedOnce = False

    player.brain.tracker.trackBall()

    return player.stay()
开发者ID:bbellon,项目名称:nbites,代码行数:31,代码来源:ChaseBallStates.py

示例11: testSaveCenter

def testSaveCenter(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_TEST_CENTER_SAVE)
    if player.counter > goalCon.TEST_SAVE_WAIT and not helper.shouldHoldSave(player):
        player.executeMove(SweetMoves.INITIAL_POS)
        return player.goNow("doneSaving")
    return player.stay()
开发者ID:nerkis,项目名称:nbites,代码行数:7,代码来源:GoalieSaveStates.py

示例12: holdLeftSave

def holdLeftSave(player):
    if helper.shouldHoldSave(player):
        return player.stay()
    else:
        return player.goLater("rollOutLeft")

    return player.stay()
开发者ID:nerkis,项目名称:nbites,代码行数:7,代码来源:GoalieSaveStates.py

示例13: holdCenterSave

def holdCenterSave(player):
    if helper.shouldHoldSave(player):
        return player.stay()
    else:
        return player.goLater("postCenterSave")

    return player.stay()
开发者ID:nerkis,项目名称:nbites,代码行数:7,代码来源:GoalieSaveStates.py

示例14: testDangerousBall

def testDangerousBall(player):
    if player.counter % 100 == 0:
        if goalTran.dangerousBall(player):
            print "dangerous"
        else:
            print "not dangerous"

    return player.stay()
开发者ID:hoangtuananh,项目名称:nbites,代码行数:8,代码来源:GoalieTestStates.py

示例15: testSaveLeft

def testSaveLeft(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_TEST_DIVE_LEFT)
    if(player.counter > goalCon.TEST_SAVE_WAIT and
        not helper.shouldHoldSave(player)):
        player.executeMove(SweetMoves.INITIAL_POS)
        return player.goNow('doneSaving')
    return player.stay()
开发者ID:gnmerritt,项目名称:nbites,代码行数:8,代码来源:GoalieSaveStates.py


注:本文中的GoalieTransitions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。