コード例 #1
0
def squat(player):
    if player.firstFrame():
        player.isChasing = False
        player.executeMove(SweetMoves.INITIAL_POS)
        player.squatting = True
        if DEBUG:
            player.executeMove(SweetMoves.SAVE_CENTER_DEBUG)
        else:
            player.executeMove(SweetMoves.GOALIE_SQUAT)
    if (player.stateTime >=
        SweetMoves.getMoveTime(SweetMoves.GOALIE_SQUAT) +
        SweetMoves.getMoveTime(SweetMoves.INITIAL_POS)):
        return player.goLater('squatted')
    return player.stay()
コード例 #2
0
def standFromFront(guard):
    if guard.firstFrame():
        guard.brain.player.executeMove(SweetMoves.STAND_UP_FRONT)
        guard.standupMoveTime = SweetMoves.getMoveTime(
            SweetMoves.STAND_UP_FRONT)

    return guard.goLater('standing')
コード例 #3
0
ファイル: GoalieSaveStates.py プロジェクト: thiggins/nbites
def saveRight(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_DIVE_RIGHT)
    if player.stateTime >= SweetMoves.getMoveTime(
            SweetMoves.GOALIE_DIVE_RIGHT):
        return player.goLater('holdRightSave')
    return player.stay()
コード例 #4
0
ファイル: KickingStates.py プロジェクト: yzy244001743/nao-man
def getKickInfo(player):
    """
    Decides which kick to use
    """
    player.inKickingState = True

    if player.firstFrame():
        player.brain.tracker.stopHeadMoves()
        player.kickScan()

        player.kickDecider = KickDecider(player)

    # If scanning, then collect data
    if (player.stateTime < SweetMoves.getMoveTime(HeadMoves.KICK_SCAN)):
        player.kickDecider.collectData(player.brain)
        return player.stay()

    # Done scanning time to act
    player.brain.tracker.trackBall()
    player.kickDecider.calculate()

    if not player.brain.ball.on:
        if player.brain.ball.framesOff < 100: # HACK, should be constant
            return player.stay()
        else :
            player.inKickingState = False
            return player.goLater('scanFindBall')

    return player.goNow('decideKick')
コード例 #5
0
ファイル: BrunswickStates.py プロジェクト: iris-xx/nao-man
def gamePenalized(player):
    if player.firstFrame():
        player.isChasing = False
        player.inKickingState = False
        player.justKicked = False
        if player.squatting:
            player.executeMove(SweetMoves.GOALIE_SQUAT_STAND_UP)
            player.squatting = False
        else:
            player.stopWalking()
        player.penalizeHeads()

    if (player.stateTime >=
        SweetMoves.getMoveTime(SweetMoves.GOALIE_SQUAT_STAND_UP)):
        player.stopWalking()

    return player.stay()
コード例 #6
0
ファイル: KickingStates.py プロジェクト: yzy244001743/nao-man
def kickBallExecute(player):
    if player.firstFrame():
        player.brain.CoA.setRobotGait(player.brain.motion)
        player.brain.tracker.trackBall()
        player.executeMove(player.chosenKick)

        if not player.penaltyMadeFirstKick:
            player.penaltyMadeFirstKick = True
        elif not player.penaltyMadeSecondKick:
            player.penaltyMadeSecondKick = True

    if not player.brain.ball.on and \
            player.brain.ball.framesOff > constants.LOOK_POST_KICK_FRAMES_OFF:
        player.lookPostKick()

    if player.stateTime >= SweetMoves.getMoveTime(player.chosenKick):
        return player.goLater('afterKick')

    return player.stay()
コード例 #7
0
ファイル: KickingStates.py プロジェクト: yzy244001743/nao-man
def kickAtPosition(player):
    """
    Method to simply kick while standing in position
    Used for a very simple goalie behavior
    """
    if player.firstFrame():
        player.brain.tracker.trackBall()
        player.executeStiffness(StiffnessModes.LEFT_FAR_KICK_STIFFNESS)
    if player.counter == 2:
        player.executeMove(SweetMoves.LEFT_FAR_KICK)

    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.LEFT_FAR_KICK):
        player.standup()

        if player.brain.nav.isStopped():
            player.brain.CoA.setRobotGait(player.brain.motion)
            player.currentGait = ChaseBallConstants.FAST_GAIT
            return player.goLater('atPosition')

    return player.stay()
コード例 #8
0
def chasePrepare(player):
    if player.firstFrame():
        player.brain.tracker.trackBall()
        player.isChasing = False

        if player.squatting:
            if DEBUG:
                pass
            else:
                player.executeMove(SweetMoves.GOALIE_SQUAT_STAND_UP)
        else:
            player.isChasing = True
            return player.goNow('chase')
    elif (player.stateTime >=
        SweetMoves.getMoveTime(SweetMoves.GOALIE_SQUAT_STAND_UP)):
        player.isChasing = True
        player.squatting = False
        return player.goNow('chase')

    return player.stay()
コード例 #9
0
ファイル: ChaseBallStates.py プロジェクト: burst/nao-man
def scanFindBall(player):
    '''
    State to move the head to find the ball. If we find the ball, we
    move to align on it. If we don't find it, we spin to keep looking
    '''
    if player.firstFrame() or  player.brain.ball.framesOff > FRAMES_OFF_THRESH:
        player.printf("First frame or havent seen the ball in abit")
        player.brain.tracker.switchTo('scanBall')
        player.stopWalking()
    if player.brain.ball.on:
        player.brain.tracker.trackBall()

    player.printf("ball.frames on" +str(player.brain.ball.framesOn) +
                  " dist:" + str(player.brain.ball.dist))

    if player.brain.ball.framesOn > FRAMES_ON_THRESH:
        return player.goNow('rotAlignOnBall')

    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.SCAN_BALL):
        return player.goNow('spinFindBall')
    return player.stay()
コード例 #10
0
ファイル: GoalieSaveStates.py プロジェクト: nerkis/nbites
def saveLeft(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_DIVE_LEFT)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.GOALIE_DIVE_LEFT):
        return player.goLater("holdLeftSave")
    return player.stay()
コード例 #11
0
ファイル: ChaseBallTransitions.py プロジェクト: Rkfire/nbites
def shouldSpinFindBall(player):
    """
    Should spin if we already tried scanning
    """
    return (player.stateTime >=
            SweetMoves.getMoveTime(HeadMoves.HIGH_SCAN_BALL))
コード例 #12
0
def shouldSpinFindBall(player):
    """
    Should spin if we already tried searching
    """
    return (player.stateTime >= SweetMoves.getMoveTime(
        HeadMoves.HIGH_SCAN_BALL))
コード例 #13
0
def saveCenter(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_SQUAT)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.GOALIE_SQUAT):
        return player.goLater('holdCenterSave')
    return player.stay()
コード例 #14
0
ファイル: GoalieSaveStates.py プロジェクト: nglennon/nbites
def saveRight(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.SAVE_RIGHT_DEBUG)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.SAVE_RIGHT_DEBUG):
        return player.goLater("holdRightSave")
    return player.stay()
コード例 #15
0
ファイル: FallStates.py プロジェクト: hchapman/nao-man
def standFromFront(guard):
    if guard.firstFrame():
        guard.brain.player.executeMove(SweetMoves.STAND_UP_FRONT)
        guard.standupMoveTime = SweetMoves.getMoveTime(SweetMoves.STAND_UP_FRONT)

    return guard.goLater('standing')
コード例 #16
0
ファイル: GoalieSaveStates.py プロジェクト: nerkis/nbites
def saveCenter(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_SQUAT)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.GOALIE_SQUAT):
        return player.goLater("holdCenterSave")
    return player.stay()
コード例 #17
0
ファイル: GoalieSaveStates.py プロジェクト: gnmerritt/nbites
def saveRight(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.GOALIE_DIVE_RIGHT)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.GOALIE_DIVE_RIGHT):
        return player.goLater('holdRightSave')
    return player.stay()
コード例 #18
0
ファイル: FallController.py プロジェクト: bbellon/nbites
 def getTimeRemainingEst(self):
     if (self.currentState == "notFallen" or
         self.currentState == "doneStanding"):
         return 0
     else:
         return SweetMoves.getMoveTime(SweetMoves.STAND_UP_FRONT)
コード例 #19
0
def saveLeft(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.SAVE_LEFT_DEBUG)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.SAVE_LEFT_DEBUG):
        return player.goLater('holdLeftSave')
    return player.stay()
コード例 #20
0
 def getTimeRemainingEst(self):
     if (self.currentState == "notFallen"
             or self.currentState == "doneStanding"):
         return 0
     else:
         return SweetMoves.getMoveTime(SweetMoves.STAND_UP_FRONT)
コード例 #21
0
ファイル: GoalieSaveStates.py プロジェクト: dmcavoy/nao-man
def saveCenter(player):
    if player.firstFrame():
        player.executeMove(SweetMoves.SAVE_CENTER_DEBUG)
    if player.stateTime >= SweetMoves.getMoveTime(SweetMoves.SAVE_CENTER_DEBUG):
        return player.goLater('holdCenterSave')
    return player.stay()