示例#1
0
    def determineChaseTime(self):
        """
        Attempt to define a time in seconds to get to the ball.
        Can give penalties in certain situations.
        @ return: returns a time in seconds with penalties.
        Note: Don't give bonuses. It can result in negative chase times
              which can screw up the math later on. --Wils (06/25/11)
        """
        ballLocation = Location(self.brain.ball.x, self.brain.ball.y)
        headingBallToGoal = ballLocation.headingTo(OPP_GOAL)

        relLocToBall = RelRobotLocation(self.brain.ball.rel_x,
                                        self.brain.ball.rel_y,
                                        headingBallToGoal)

        time = self.determineTimeToDest(relLocToBall)

        # Give a penalty for not seeing the ball if we aren't in a kickingState
        if (self.brain.ball.vis.frames_off > 45 and # TODO: unify this constant with shouldFindBall
            not self.brain.player.inKickingState):
            time += BALL_OFF_PENALTY

        if DEBUG_DETERMINE_DEST_TIME:
            print "\tChase time after ball on bonus " + str(time)

        return time
示例#2
0
文件: SubRoles.py 项目: nerkis/nbites
def pLeftDeepBack(team, workingPlay):
    """position deep right back"""
    workingPlay.setSubRole(PBConstants.LEFT_DEEP_BACK)
    dest = Location(PBConstants.DEEP_BACK_X, PBConstants.LEFT_DEEP_BACK_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.DEEP_BACK_X, PBConstants.LEFT_DEEP_BACK_Y, h)
    workingPlay.setPosition(pos)
示例#3
0
def pRightDeepBack(team, workingPlay):
    """position deep left back"""
    workingPlay.setSubRole(PBConstants.RIGHT_DEEP_BACK)
    dest = Location(PBConstants.DEEP_BACK_X,
                             PBConstants.RIGHT_DEEP_BACK_Y)
    h = dest.headingTo(Location(team.brain.ball.x, team.brain.ball.y))
    pos = (PBConstants.DEEP_BACK_X, PBConstants.RIGHT_DEEP_BACK_Y,h)
    workingPlay.setPosition(pos)
示例#4
0
def pLeftDeepBack(team, workingPlay):
    """position deep right back"""
    workingPlay.setSubRole(PBConstants.LEFT_DEEP_BACK)
    dest = Location(PBConstants.DEEP_BACK_X,
                             PBConstants.LEFT_DEEP_BACK_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.DEEP_BACK_X, PBConstants.LEFT_DEEP_BACK_Y,h)
    workingPlay.setPosition(pos)
示例#5
0
文件: SubRoles.py 项目: nerkis/nbites
def pOffensiveMiddie(team, workingPlay):
    workingPlay.setSubRole(PBConstants.OFFENSIVE_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_MIDDIE_Y, PBConstants.MAX_MIDDIE_Y)
    dest = Location(PBConstants.OFFENSIVE_MIDDIE_X, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (PBConstants.OFFENSIVE_MIDDIE_X, y, h)
    workingPlay.setPosition(pos)
示例#6
0
文件: SubRoles.py 项目: nerkis/nbites
def pDubDMiddie(team, workingPlay):
    """middie for when in dubD"""
    workingPlay.setSubRole(PBConstants.DUB_D_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_MIDDIE_Y, PBConstants.MAX_MIDDIE_Y)
    x = PBConstants.OFFENSIVE_MIDDIE_X
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#7
0
def pPicker(team, workingPlay):
    """position picker"""
    workingPlay.setSubRole(PBConstants.PICKER)
    x = PBConstants.PICKER_X
    y = PBConstants.PICKER_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x,y,h)
    workingPlay.setPosition(pos)
示例#8
0
def pOffensiveMiddie(team, workingPlay):
    workingPlay.setSubRole(PBConstants.OFFENSIVE_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y,
                    PBConstants.MIN_MIDDIE_Y,
                    PBConstants.MAX_MIDDIE_Y)
    dest = Location(PBConstants.OFFENSIVE_MIDDIE_X, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (PBConstants.OFFENSIVE_MIDDIE_X, y, h)
    workingPlay.setPosition(pos)
示例#9
0
文件: SubRoles.py 项目: nerkis/nbites
def pStopper(team, workingPlay):
    """position stopper"""
    workingPlay.setSubRole(PBConstants.STOPPER)
    x = PBConstants.STOPPER_X
    y = MyMath.clip(team.brain.ball.loc.y, PBConstants.MIN_STOPPER_Y, PBConstants.MAX_STOPPER_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#10
0
文件: SubRoles.py 项目: nerkis/nbites
def pGoalieSave(team, workingPlay):
    """ goalie saving """
    workingPlay.setSubRole(PBConstants.GOALIE_SAVE)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#11
0
文件: SubRoles.py 项目: nerkis/nbites
def pGoalieCenter(team, workingPlay):
    """normal goalie position in the center of the goal"""
    workingPlay.setSubRole(PBConstants.GOALIE_CENTER)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#12
0
文件: SubRoles.py 项目: nerkis/nbites
def pCenterBack(team, workingPlay):
    """position center back"""
    workingPlay.setSubRole(PBConstants.CENTER_BACK)
    x, y = team.getPointBetweenBallAndGoal(team.brain.ball, PBConstants.DEFENDER_BALL_DIST)
    x = MyMath.clip(x, PBConstants.SWEEPER_X, PBConstants.STOPPER_X)
    y = MyMath.clip(y, PBConstants.MIN_CENTER_BACK_Y, PBConstants.MAX_CENTER_BACK_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#13
0
文件: SubRoles.py 项目: nerkis/nbites
def pSweeper(team, workingPlay):
    """position sweeper"""
    workingPlay.setSubRole(PBConstants.SWEEPER)
    x = PBConstants.SWEEPER_X
    y = PBConstants.SWEEPER_Y
    y += PBConstants.SWEEPER_Y_OFFSET * MyMath.sign(team.brain.ball.loc.y - NogginConstants.CENTER_FIELD_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#14
0
    def strategize(self, play):
        """
        creates a play, picks the strategy to run, returns the play after
        it is modified by Strategies
        """
        currentGCState = self.brain.player.gameState
        # We don't control anything in initial or finished
        if (currentGCState == 'gameInitial' or
            currentGCState == 'gameFinished'):
            play.setRole(PBConstants.INIT_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Have a separate strategy to easily deal with being penalized
        elif not self.me.active:
            play.setRole(PBConstants.PENALTY_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Special case for the goalie
        if (self.me.isDefaultGoalie()):
            # Make sure the goalie's role is set
            play.setRole(PBConstants.GOALIE)
            dest = Location(PBConstants.GOALIE_HOME_X,
                            PBConstants.GOALIE_HOME_Y)
            h = dest.headingTo(Location(self.brain.ball.x, self.brain.ball.y))
            pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)
            play.setPosition(pos)
            return

        # Have a separate ready section to make things simpler
        if (currentGCState == 'gameReady' or currentGCState =='gameSet'):
            if (currentGCState == 'gameReady'):
                self.lastBallX = -1
                self.lastBallY = -1
            self.readyPosition(play)
            return

        # Update the current grid square that the ball is.
        self.ballUpdate()

        test = False
        # Check test cases
        if (PBConstants.TEST_DEFENDER or PBConstants.TEST_OFFENDER
            or PBConstants.TEST_MIDDIE or PBConstants.TEST_CHASER):
            test = True

        # Use the playbook table to determine position.
        self.priorityPositions(
            self.tableLookup(self.lastBallX, self.lastBallY, test) , play)
示例#15
0
文件: GoTeam.py 项目: suthumb/nbites
    def strategize(self, play):
        """
        creates a play, picks the strategy to run, returns the play after
        it is modified by Strategies
        """
        currentGCState = self.brain.player.gameState
        # We don't control anything in initial or finished
        if (currentGCState == 'gameInitial' or
            currentGCState == 'gameFinished'):
            play.setRole(PBConstants.INIT_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Have a separate strategy to easily deal with being penalized
        elif not self.me.active:
            play.setRole(PBConstants.PENALTY_ROLE)

            self.lastBallX = -1
            self.lastBallY = -1
            return

        # Special case for the goalie
        if (self.me.isDefaultGoalie()):
            # Make sure the goalie's role is set
            play.setRole(PBConstants.GOALIE)
            dest = Location(PBConstants.GOALIE_HOME_X,
                            PBConstants.GOALIE_HOME_Y)
            h = dest.headingTo(Location(self.brain.ball.x, self.brain.ball.y))
            pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)
            play.setPosition(pos)
            return

        # Have a separate ready section to make things simpler
        if (currentGCState == 'gameReady' or currentGCState =='gameSet'):
            if (currentGCState == 'gameReady'):
                self.lastBallX = -1
                self.lastBallY = -1
            self.readyPosition(play)
            return

        # Update the current grid square that the ball is.
        self.ballUpdate()

        test = False
        # Check test cases
        if (PBConstants.TEST_DEFENDER or PBConstants.TEST_OFFENDER
            or PBConstants.TEST_MIDDIE or PBConstants.TEST_CHASER):
            test = True

        # Use the playbook table to determine position.
        self.priorityPositions(
            self.tableLookup(self.lastBallX, self.lastBallY, test) , play)
示例#16
0
文件: SubRoles.py 项目: nerkis/nbites
def pRightWing(team, workingPlay):
    """position right winger"""
    workingPlay.setSubRole(PBConstants.RIGHT_WING)
    midpoint = (PBConstants.WING_MAX_X - PBConstants.WING_MIN_X) * 0.5
    scale = (PBConstants.WING_MAX_X - midpoint) / (PBConstants.PICKER_X_THRESH - midpoint)
    x = -1 * scale * (team.brain.ball.loc.x - midpoint)
    y = PBConstants.RIGHT_WING_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#17
0
文件: SubRoles.py 项目: nerkis/nbites
def pGoalieChaser(team, workingPlay):
    """goalie is being a chaser, presumably in/near goalbox not intended for
        pulling the goalie situations"""
    workingPlay.setSubRole(PBConstants.GOALIE_CHASER)
    dest = Location(PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#18
0
def pStopper(team, workingPlay):
    """position stopper"""
    workingPlay.setSubRole(PBConstants.STOPPER)
    x = PBConstants.STOPPER_X
    y = MyMath.clip(team.brain.ball.loc.y,
                    PBConstants.MIN_STOPPER_Y,
                    PBConstants.MAX_STOPPER_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#19
0
def pDubDMiddie(team, workingPlay):
    """middie for when in dubD"""
    workingPlay.setSubRole(PBConstants.DUB_D_MIDDIE)
    y = MyMath.clip(team.brain.ball.loc.y,
                    PBConstants.MIN_MIDDIE_Y,
                    PBConstants.MAX_MIDDIE_Y)
    x = PBConstants.OFFENSIVE_MIDDIE_X
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#20
0
def pSweeper(team, workingPlay):
    """position sweeper"""
    workingPlay.setSubRole(PBConstants.SWEEPER)
    x = PBConstants.SWEEPER_X
    y = PBConstants.SWEEPER_Y
    y += PBConstants.SWEEPER_Y_OFFSET * \
        MyMath.sign(team.brain.ball.loc.y-NogginConstants.CENTER_FIELD_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#21
0
def pGoalieSave(team, workingPlay):
    """ goalie saving """
    workingPlay.setSubRole(PBConstants.GOALIE_SAVE)
    dest = Location(PBConstants.GOALIE_HOME_X,
                             PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
        pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#22
0
def pGoalieCenter(team, workingPlay):
    """normal goalie position in the center of the goal"""
    workingPlay.setSubRole(PBConstants.GOALIE_CENTER)
    dest = Location(PBConstants.GOALIE_HOME_X,
                             PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
       pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#23
0
def pLeftWing(team, workingPlay):
    """position left winger"""
    workingPlay.setSubRole(PBConstants.LEFT_WING)
    midpoint = (PBConstants.WING_MAX_X - PBConstants.WING_MIN_X)*.5
    scale = (PBConstants.WING_MAX_X - midpoint)/(PBConstants.PICKER_X_THRESH -
                                                 midpoint)
    x = -1*scale*(team.brain.ball.x - midpoint)
    y = PBConstants.LEFT_WING_Y
    dest = Location(x, y)
    h = dest.headingTo(Location(team.brain.ball.x, team.brain.ball.y))

    pos = (x,y,h)
    workingPlay.setPosition(pos)
示例#24
0
def pGoalieChaser(team, workingPlay):
    """goalie is being a chaser, presumably in/near goalbox not intended for
        pulling the goalie situations"""
    workingPlay.setSubRole(PBConstants.GOALIE_CHASER)
    dest = Location(PBConstants.GOALIE_HOME_X,
                             PBConstants.GOALIE_HOME_Y)
    h = dest.headingTo(team.brain.ball.loc)
    pos = (PBConstants.GOALIE_HOME_X, PBConstants.GOALIE_HOME_Y, h)

    if PBConstants.USE_FANCY_GOALIE:
       pos = team.fancyGoaliePosition()

    workingPlay.setPosition(pos)
示例#25
0
def pForward(team, workingPlay):
    """position forward"""
    workingPlay.setSubRole(PBConstants.FORWARD)
    x = PBConstants.FORWARD_X
    if team.brain.ball.loc.y < NogginConstants.CENTER_FIELD_Y:
        y = PBConstants.LEFT_FORWARD_Y
    else:
        y = PBConstants.RIGHT_FORWARD_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#26
0
def pStriker(team, workingPlay):
    """position striker"""
    workingPlay.setSubRole(PBConstants.STRIKER)
    x = PBConstants.STRIKER_X
    if team.brain.ball.loc.y < NogginConstants.CENTER_FIELD_Y:
        y = PBConstants.LEFT_STRIKER_Y
    else:
        y = PBConstants.RIGHT_STRIKER_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#27
0
def pRightWing(team, workingPlay):
    """position right winger"""
    workingPlay.setSubRole(PBConstants.RIGHT_WING)
    midpoint = (PBConstants.WING_MAX_X - PBConstants.WING_MIN_X)*.5
    scale = (PBConstants.WING_MAX_X - midpoint)/(PBConstants.PICKER_X_THRESH -
                                                 midpoint)
    x = -1*scale*(team.brain.ball.loc.x - midpoint)
    y = PBConstants.RIGHT_WING_Y
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#28
0
def pKickoffStriker(team, workingPlay):
    """position kickoff striker"""
    workingPlay.setSubRole(PBConstants.KICKOFF_STRIKER)
    x = PBConstants.KICKOFF_OFFENDER_X

    if team.kickoffFormation == 0:
        y = PBConstants.KICKOFF_OFFENDER_0_Y
    else:
        y = PBConstants.KICKOFF_OFFENDER_1_Y

    # We want to face the center (where the ball is, from our location)
    dest = Location(x,y)
    h = dest.headingTo(PBConstants.CENTER_FIELD)

    pos = (x,y,h)
    workingPlay.setPosition(pos)
示例#29
0
def pCenterBack(team, workingPlay):
    """position center back"""
    workingPlay.setSubRole(PBConstants.CENTER_BACK)
    x,y = team.getPointBetweenBallAndGoal(team.brain.ball,
                                          PBConstants.DEFENDER_BALL_DIST)
    x = MyMath.clip(x,
                    PBConstants.SWEEPER_X,
                    PBConstants.STOPPER_X)
    y = MyMath.clip(y,
                    PBConstants.MIN_CENTER_BACK_Y,
                    PBConstants.MAX_CENTER_BACK_Y)
    dest = Location(x, y)
    h = dest.headingTo(team.brain.ball.loc)

    pos = (x, y, h)
    workingPlay.setPosition(pos)
示例#30
0
def pReadyChaser(team, workingPlay):
    workingPlay.setSubRole(PBConstants.READY_CHASER)
    kickOff = team.brain.gameController.ownKickOff
    if kickOff:
        x = PBConstants.READY_KICKOFF_CHASER_X
        y = PBConstants.READY_KICKOFF_CHASER_Y
    else:
        x = PBConstants.READY_NON_KICKOFF_CHASER_X
        if team.kickoffFormation == 0:
            y = PBConstants.READY_NON_KICKOFF_CHASER_0_Y
        else:
            y = PBConstants.READY_NON_KICKOFF_CHASER_1_Y

    dest = Location(x, y)
    h = dest.headingTo(PBConstants.CENTER_FIELD)

    pos = (x,y,h)
    workingPlay.setPosition(pos)
示例#31
0
    def determineChaseTime(self):
        """
        Attempt to define a time in seconds to get to the ball.
        Can give penalties in certain situations.
        @ return: returns a time in seconds with penalties.
        Note: Don't give bonuses. It can result in negative chase times
              which can screw up the math later on. --Wils (06/25/11)
        """
        ballLocation = Location(self.brain.ball.x, self.brain.ball.y)
        headingBallToGoal = ballLocation.headingTo(OPP_GOAL)

        relLocToBall = RelRobotLocation(self.brain.ball.rel_x,
                                        self.brain.ball.rel_y,
                                        headingBallToGoal)

        time = self.determineTimeToDest(relLocToBall)

        # Give a penalty for not seeing the ball if we aren't in a kickingState
        if (self.brain.ball.vis.frames_off > 45
                and  # TODO: unify this constant with shouldFindBall
                not self.brain.player.inKickingState):
            time += BALL_OFF_PENALTY

        if DEBUG_DETERMINE_DEST_TIME:
            print "\tChase time after ball on bonus " + str(time)

        # HACK RoboCup 2013
        if PBConstants.HACK_D1 or PBConstants.HACK_D2:
            if self.brain.ball.x > PBConstants.DEFENDER_BOX_LIMIT_X:
                time += 15000

        if PBConstants.HACK_O:
            if self.brain.ball.distance > PBConstants.OFFENDER_DISTANCE_LIMIT:
                time += 15000

        return time
示例#32
0
def orbitBall(player):
    """
    State to orbit the ball
    """
    if player.firstFrame():
        if hackKick.DEBUG_KICK_DECISION:
            print "Orbiting at angle: ", player.kick.h

        if player.kick.h == 0:
            return player.goNow("positionForKick")

        elif player.kick.h < 0:
            # set y vel at 50% speed
            print "Turn to left, move right"
            player.brain.nav.walk(0, -0.7, 0.25)

        elif player.kick.h > 0:
            # set y vel at 50% speed in opposite direction
            print "Turn to right, move left"
            player.brain.nav.walk(0, 0.7, -0.25)

    elif player.brain.nav.isStopped():
        player.shouldOrbit = False
        player.kick.h = 0
        player.kick = kicks.chooseAlignedKickFromKick(player, player.kick)
        return player.goNow("positionForKick")

    # all of this is basically the same as in shoot() in hackKickInformation
    goalCenter = Location(nogginConstants.FIELD_WHITE_RIGHT_SIDELINE_X, nogginConstants.CENTER_FIELD_Y)
    ballLocation = Location(player.brain.ball.x, player.brain.ball.y)
    headingBallToGoalCenter = ballLocation.headingTo(goalCenter)
    bearingForKick = headingBallToGoalCenter - player.brain.loc.h

    # the kick was chosen before we came into orbitBall()
    if player.kick.isStraightKick():
        orbitBall.desiredHeading = 0 - bearingForKick
    elif player.kick == kicks.RIGHT_SIDE_KICK:
        orbitBall.desiredHeading = 70 - bearingForKick
    elif player.kick == kicks.LEFT_SIDE_KICK:
        orbitBall.desiredHeading = -70 - bearingForKick
    elif player.kick.isBackKick():
        if bearingForKick < -125:
            orbitBall.desiredHeading = -180 - bearingForKick
        else:
            orbitBall.desiredHeading = 180 - bearingForKick

    # #debugging
    # if player.counter%20 == 0:
    #     print "desiredHeading is:  | ", orbitBall.desiredHeading
    #     print "ball to goal center:| ", headingBallToGoalCenter
    #     print "player heading:     | ", player.brain.loc.h
    #     print "bearing for kick:   | ", bearingForKick
    #     print "walk is:            |  (",player.brain.nav.getXSpeed(),",",player.brain.nav.getYSpeed(),",",player.brain.nav.getHSpeed(),")"
    #     print "=====================++++++++++"

    # our in-house heading checker is of the opinion that we're pointed in the right direction
    if orbitBall.desiredHeading > -10 and orbitBall.desiredHeading < 10:
        player.stopWalking()
        print "Done orbiting, going to positionForKick"
        player.shouldOrbit = False
        player.kick.h = 0
        player.kick = kicks.chooseAlignedKickFromKick(player, player.kick)
        return player.goNow("positionForKick")

    if player.stateTime > 8:
        print "In state orbitBall for too long, switching to chase"
        player.shouldOrbit = False
        player.stopWalking()
        player.inKickingState = False
        return player.goLater("chase")

    # These next three if statements might need some fine tuning
    # ATM that doesn't appear to be the case
    if constants.ORBIT_BALL_DISTANCE < player.brain.ball.distance - 7:
        # We're too far away
        player.brain.nav.setXSpeed(0.15)

    if constants.ORBIT_BALL_DISTANCE > player.brain.ball.distance + 1:
        # We're too close
        player.brain.nav.setXSpeed(-0.15)

    if (
        constants.ORBIT_BALL_DISTANCE > player.brain.ball.distance - 1
        and constants.ORBIT_BALL_DISTANCE < player.brain.ball.distance + 1
    ):
        # print "We're at a good distance"
        player.brain.nav.setXSpeed(0)

    if transitions.shouldFindBallKick(player) or transitions.shouldCancelOrbit(player):
        player.inKickingState = False
        return player.goLater("chase")

    if player.kick.h > 0:  # Orbiting clockwise
        if player.brain.ball.rel_y > 2:
            player.brain.nav.setHSpeed(0)
            # print "turn clockwise SLOWER"
        elif player.brain.ball.rel_y < 2:
            player.brain.nav.setHSpeed(-0.35)
            # print "turn clockwise FASTER"
        else:
            player.brain.nav.setHSpeed(-0.25)
            # print "turn clockwise NORMAL"
    else:  # Orbiting counter-clockwise
        if player.brain.ball.rel_y > 2:
            player.brain.nav.setHSpeed(0.35)
            # print "turn counterclockwise FASTER"
        elif player.brain.ball.rel_y < 2:
            player.brain.nav.setHSpeed(0)
            # print "turn counterclockwise SLOWER"
        else:
            player.brain.nav.setHSpeed(0.25)
            # print "turn clockwise NORMAL"

    return player.stay()