Esempio n. 1
0
def walkToWayPoint(player):
    if player.brain.nav.dodging:
        return player.stay()    

    if player.firstFrame():
        player.decider = KickDecider.KickDecider(player.brain)
        player.brain.tracker.trackBall()
    
    player.kick = player.decider.decidingStrategy()
    relH = player.decider.normalizeAngle(player.kick.setupH - player.brain.loc.h)

    ball = player.brain.ball

    if transitions.shouldDecelerate(player):
        speed = MIN_SPEED
    else:
        speed = MAX_SPEED

    if fabs(relH) <= constants.MAX_BEARING_DIFF:
        wayPoint = RobotLocation(ball.x - constants.WAYPOINT_DIST*cos(radians(player.kick.setupH)),
                                ball.y - constants.WAYPOINT_DIST*sin(radians(player.kick.setupH)),
                                player.brain.loc.h)

        player.brain.nav.goTo(wayPoint, Navigator.CLOSE_ENOUGH, speed, True, fast = True)

        if transitions.shouldSpinToKickHeading(player):
            return player.goNow('spinToKickHeading')

    else:
        player.brain.nav.chaseBall(speed, fast = True)

        if transitions.shouldPrepareForKick(player):
            return player.goLater('positionAndKickBall')

    return player.stay()
Esempio n. 2
0
def walkToWayPoint(player):
    if player.brain.nav.dodging:
        return player.stay()

    if player.firstFrame():
        player.decider = KickDecider.KickDecider(player.brain)
        player.brain.tracker.trackBall()

    player.kick = player.decider.new2016KickStrategy()
    relH = player.decider.normalizeAngle(player.kick.setupH -
                                         player.brain.loc.h)

    ball = player.brain.ball

    # print "In walkToWayPoint"

    if transitions.shouldDecelerate(player):
        # print "I should decelerate"
        speed = speeds.SPEED_SIX
    else:
        speed = speeds.SPEED_EIGHT

    if fabs(relH) <= 50:  #constants.MAX_BEARING_DIFF:
        wayPoint = RobotLocation(
            ball.x -
            constants.WAYPOINT_DIST * cos(radians(player.kick.setupH)),
            ball.y -
            constants.WAYPOINT_DIST * sin(radians(player.kick.setupH)),
            player.brain.loc.h)

        # print("Going to waypoint")
        player.brain.nav.goTo(wayPoint,
                              Navigator.GENERAL_AREA,
                              speed,
                              True,
                              fast=True)

        if transitions.shouldSpinToKickHeading(player):
            return player.goNow('spinToKickHeading')

    else:
        player.brain.nav.chaseBall(speed, fast=True)

        if transitions.shouldPrepareForKick(player):
            return player.goLater('dribble')

    return player.stay()
Esempio n. 3
0
def walkToWayPoint(player):
    if player.brain.nav.dodging:
        return player.stay()

    if player.firstFrame():
        player.decider = KickDecider.KickDecider(player.brain)
        player.brain.tracker.trackBall()

    player.kick = player.decider.decidingStrategy()
    relH = player.decider.normalizeAngle(player.kick.setupH -
                                         player.brain.loc.h)

    ball = player.brain.ball

    if transitions.shouldDecelerate(player):
        speed = MIN_SPEED
    else:
        speed = MAX_SPEED

    if fabs(relH) <= constants.MAX_BEARING_DIFF:
        wayPoint = RobotLocation(
            ball.x -
            constants.WAYPOINT_DIST * cos(radians(player.kick.setupH)),
            ball.y -
            constants.WAYPOINT_DIST * sin(radians(player.kick.setupH)),
            player.brain.loc.h)

        player.brain.nav.goTo(wayPoint,
                              Navigator.CLOSE_ENOUGH,
                              speed,
                              True,
                              fast=True)

        if transitions.shouldSpinToKickHeading(player):
            return player.goNow('spinToKickHeading')

    else:
        player.brain.nav.chaseBall(speed, fast=True)

        if transitions.shouldPrepareForKick(player):
            return player.goLater('positionAndKickBall')

    return player.stay()
Esempio n. 4
0
def walkToWayPoint(player):
    if player.brain.nav.dodging:
        return player.stay()

    if player.firstFrame():
        player.decider = KickDecider.KickDecider(player.brain)
        player.brain.tracker.trackBall()
    
    player.kick = player.decider.new2016KickStrategy()
    relH = player.decider.normalizeAngle(player.kick.setupH - player.brain.loc.h)

    ball = player.brain.ball

    # print "In walkToWayPoint"

    if transitions.shouldDecelerate(player):
        # print "I should decelerate"
        speed = speeds.SPEED_SIX
    else:
        speed = speeds.SPEED_EIGHT

    if fabs(relH) <= 50: #constants.MAX_BEARING_DIFF:
        wayPoint = RobotLocation(ball.x - constants.WAYPOINT_DIST*cos(radians(player.kick.setupH)),
                                 ball.y - constants.WAYPOINT_DIST*sin(radians(player.kick.setupH)),
                                 player.brain.loc.h)

        # print("Going to waypoint")
        player.brain.nav.goTo(wayPoint, Navigator.GENERAL_AREA, speed, True, fast = True)

        if transitions.shouldSpinToKickHeading(player):
            return player.goNow('spinToKickHeading')

    else:
        player.brain.nav.chaseBall(speed, fast = True)

        if transitions.shouldPrepareForKick(player):
            return player.goLater('dribble')

    return player.stay()