本文整理汇总了Python中ChaseBallTransitions.shouldDecelerate方法的典型用法代码示例。如果您正苦于以下问题:Python ChaseBallTransitions.shouldDecelerate方法的具体用法?Python ChaseBallTransitions.shouldDecelerate怎么用?Python ChaseBallTransitions.shouldDecelerate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChaseBallTransitions
的用法示例。
在下文中一共展示了ChaseBallTransitions.shouldDecelerate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: walkToWayPoint
# 需要导入模块: import ChaseBallTransitions [as 别名]
# 或者: from ChaseBallTransitions import shouldDecelerate [as 别名]
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()
示例2: approachBall
# 需要导入模块: import ChaseBallTransitions [as 别名]
# 或者: from ChaseBallTransitions import shouldDecelerate [as 别名]
def approachBall(player):
if player.brain.nav.dodging:
return player.stay()
if player.firstFrame():
player.buffBoxFiltered = CountTransition(playOffTransitions.ballNotInBufferedBox,
0.8, 10)
player.brain.tracker.trackBall()
if player.shouldKickOff:
if player.inKickOffPlay:
return player.goNow('giveAndGo')
else:
return player.goNow('positionAndKickBall')
elif player.penaltyKicking:
return player.goNow('prepareForPenaltyKick')
else:
player.brain.nav.chaseBall(MAX_SPEED, fast = True)
if (transitions.shouldPrepareForKick(player) or
player.brain.nav.isAtPosition()):
return player.goNow('positionAndKickBall')
elif transitions.shouldDecelerate(player):
player.brain.nav.chaseBall(MIN_SPEED, fast = True)
else:
player.brain.nav.chaseBall(MAX_SPEED, fast = True)
示例3: walkToWayPoint
# 需要导入模块: import ChaseBallTransitions [as 别名]
# 或者: from ChaseBallTransitions import shouldDecelerate [as 别名]
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()