本文整理匯總了Python中man.motion.SweetMoves類的典型用法代碼示例。如果您正苦於以下問題:Python SweetMoves類的具體用法?Python SweetMoves怎麽用?Python SweetMoves使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SweetMoves類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: squat
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: getKickInfo
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')
示例3: gamePenalized
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()
示例4: kickBallExecute
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()
示例5: chasePrepare
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()
示例6: kickAtPosition
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()
示例7: scanFindBall
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()
示例8: standFromFront
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')
示例9: getTimeRemainingEst
def getTimeRemainingEst(self):
if (self.currentState == "notFallen" or
self.currentState == "doneStanding"):
return 0
else:
return SweetMoves.getMoveTime(SweetMoves.STAND_UP_FRONT)
示例10: saveCenter
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()
示例11: saveLeft
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()
示例12: shouldSpinFindBall
def shouldSpinFindBall(player):
"""
Should spin if we already tried scanning
"""
return (player.stateTime >=
SweetMoves.getMoveTime(HeadMoves.HIGH_SCAN_BALL))
示例13: saveLeft
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()
示例14: saveRight
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()
示例15: saveRight
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()