Skip to content

Commit

Permalink
Some debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Northern Bites committed Apr 21, 2012
1 parent 41da878 commit 65231f2
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/man/noggin/players/GaurdianStates.py
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
import time import time
from objects import RelRobotLocation from objects import RelRobotLocation
from ..navigator import Navigator from ..navigator import Navigator
from ..kickDecider import kicks


import man.motion.SweetMoves as SweetMoves import man.motion.SweetMoves as SweetMoves
import man.motion.HeadMoves as HeadMoves import man.motion.HeadMoves as HeadMoves
Expand All @@ -13,7 +14,6 @@ def gameInitial(player):
player.gainsOn() player.gainsOn()
player.zeroHeads() player.zeroHeads()
player.GAME_INITIAL_satDown = False player.GAME_INITIAL_satDown = False
player.iFell = False


elif (player.brain.nav.isStopped() and not player.GAME_INITIAL_satDown elif (player.brain.nav.isStopped() and not player.GAME_INITIAL_satDown
and not player.motion.isBodyActive()): and not player.motion.isBodyActive()):
Expand Down Expand Up @@ -47,9 +47,6 @@ def gamePenalized(player):
return player.stay() return player.stay()


def fallen(player): def fallen(player):
if player.firstFrame():
player.iFell = True

return player.stay() return player.stay()


def gameFinished(player): def gameFinished(player):
Expand All @@ -67,8 +64,7 @@ def gamePlaying(player):
player.brain.tracker.trackBall() player.brain.tracker.trackBall()


# Came from penalized? Fell recently? Become a chaser! # Came from penalized? Fell recently? Become a chaser!
if player.lastDiffState == 'gamePenalized' or \ if player.lastDiffState == 'gamePenalized':
player.iFell:
print "become a chaser!" #/* ** */ ADD CHASER CODE print "become a chaser!" #/* ** */ ADD CHASER CODE


return player.goLater('gaurd') return player.goLater('gaurd')
Expand Down Expand Up @@ -101,7 +97,7 @@ def omniApproach(player):
return player.goLater('omniPositionForKick') return player.goLater('omniPositionForKick')


# If lost the ball, stop and chill. # If lost the ball, stop and chill.
if transitions.shouldFindBall(): if transitions.shouldFindBall(player):
return player.goLater('gaurd') return player.goLater('gaurd')


# Approach with all speed! # Approach with all speed!
Expand All @@ -124,7 +120,7 @@ def omniPositionForKick(player):
player.brain.nav.updateDest(getKickPosition(player)) player.brain.nav.updateDest(getKickPosition(player))


# Did we lose the ball? # Did we lose the ball?
if transitions.shouldFindBall(): if transitions.shouldFindBall(player):
return player.goLater('gaurd') return player.goLater('gaurd')


# At position? # At position?
Expand All @@ -133,16 +129,18 @@ def omniPositionForKick(player):
position.relY < constants.BALL_Y_OFFSET and position.relY < constants.BALL_Y_OFFSET and
position.relH < constants.GOOD_ENOUGH_H): position.relH < constants.GOOD_ENOUGH_H):
print "kicking!" # KICK IT!!!$@%&!! print "kicking!" # KICK IT!!!$@%&!!
player.brain.nav.stop()
player.executeMove(kicks.BIG_STRAIGHT_KICK.sweetMove) #check this @!
else: else:
print "orbiting!" # ORBIT print "orbiting!" # ORBIT


return player.stay() return player.stay()


def getKickPosition(player): def getKickPosition(player):
kick = player.brain.kickDecider.kicks.LEFT_DYNAMIC_STRAIGHT_KICK #check this @! kick = kicks.BIG_STRAIGHT_KICK #check this @!
ballLoc = player.brain.ball.loc ballLoc = player.brain.ball.loc
(kick_x, kick_y, kick_heading) = kick.getPosition() (kick_x, kick_y, kick_heading) = kick.getPosition()
dest = relRobotLocation(ballLoc.relX - kick_x, dest = RelRobotLocation(ballLoc.relX - kick_x,
ballLoc.relY - kick_y, ballLoc.relY - kick_y,
0) 0)
return dest return dest

0 comments on commit 65231f2

Please sign in to comment.