コード例 #1
0
ファイル: PlayOffBallStates.py プロジェクト: itumanen/nbites
def watchForBall(player):
    """
    The player is at home, waiting for the ball to be within box.
    """
    if player.firstFrame():
        player.brain.tracker.trackBall()
        player.brain.nav.stand()

    if transitions.tooFarFromHome(player, 50, 20):
        return player.goLater('positionAtHome')
コード例 #2
0
ファイル: PlayOffBallStates.py プロジェクト: fsasieta/nbites
def watchForBall(player):
    """
    The player is at home, waiting for the ball to be within box.
    """
    if player.firstFrame():
        player.brain.tracker.trackBall()
        player.brain.nav.stand()

    if transitions.tooFarFromHome(player, 50, 20):
        return player.goLater('positionAtHome')
コード例 #3
0
ファイル: PlayOffBallStates.py プロジェクト: emamanto/nbites
    home = RobotLocation(player.homePosition.x, player.homePosition.y, player.homePosition.h)
    if (player.brain.sharedBall.ball_on and player.brain.sharedBall.reliability >= 2 and 
        role.isDefender(player.role)):
        sharedball = Location(player.brain.sharedBall.x, player.brain.sharedBall.y)
        home.h = player.brain.loc.getRelativeBearing(sharedball)
    elif (player.brain.sharedBall.ball_on and player.brain.sharedBall.reliability >= 1 and 
          role.isCherryPicker(player.role)):
        sharedball = Location(player.brain.sharedBall.x, player.brain.sharedBall.y)
        home.h = player.brain.loc.getRelativeBearing(sharedball)

    player.brain.nav.updateDest(home)

@superState('playOffBall')
@stay
@ifSwitchNow(transitions.tooFarFromHome(20), 'positionAtHome')
def watchForBall(player):
    """
    The player is at home, waiting for the ball to be within it's box (range)
    """
    if player.firstFrame():
        player.brain.nav.stand()

@superState('playOffBall')
@stay
@ifSwitchLater(shared.ballOffForNFrames(120), 'playOffBall')
def positionAsSupporter(player):
    if (role.isChaser(player.role) and role.isChaser(player.roleOfClaimer) and 
        player.brain.ball.distance > hypot(CHASER_DISTANCE, CHASER_DISTANCE)):
        fast = True
    else:
コード例 #4
0
    if player.firstFrame():
        if role.isCherryPicker(player.role):
            player.brain.tracker.repeatWidePan()
        else:
            player.brain.tracker.trackBall()
        fastWalk = role.isCherryPicker(player.role)
        player.brain.nav.goTo(home, precision = nav.HOME,
                              speed = nav.QUICK_SPEED, avoidObstacles = True,
                              fast = fastWalk, pb = False)

    player.brain.nav.updateDest(home)

@superState('playOffBall')
@stay
@ifSwitchNow(transitions.tooFarFromHome(20), 'positionAtHome')
def watchForBall(player):
    """
    The player is at home, waiting for the ball to be within it's box (range)
    """
    if player.firstFrame():
        player.brain.nav.stand()

@superState('playOffBall')
@stay
@ifSwitchLater(shared.ballOffForNFrames(120), 'playOffBall')
def positionAsSupporter(player):
    if (role.isChaser(player.role) and role.isChaser(player.roleOfClaimer) and 
        player.brain.ball.distance > hypot(CHASER_DISTANCE, CHASER_DISTANCE)):
        fast = True
    else: