def spinToFaceBall(player): if player.firstFrame(): facingDest = RelRobotLocation(0.0, 0.0, 0.0) if player.brain.ball.loc.bearing < 0.0: facingDest.relH = -90 else: facingDest.relH = 90 player.brain.nav.goTo(facingDest, nav.CLOSE_ENOUGH, nav.CAREFUL_SPEED) return Transition.getNextState(player, spinToFaceBall)
def spinToFaceBall(player): if player.firstFrame(): facingDest = RelRobotLocation(0.0, 0.0, 0.0) if player.brain.ball.bearing_deg < 0.0: facingDest.relH = -90 else: facingDest.relH = 90 player.brain.nav.goTo(facingDest, nav.CLOSE_ENOUGH, nav.CAREFUL_SPEED) return Transition.getNextState(player, spinToFaceBall)
def spinToFaceBall(player): facingDest = RelRobotLocation(0.0, 0.0, 0.0) if player.brain.ball.bearing_deg < 0.0: player.side = RIGHT facingDest.relH = -90 else: player.side = LEFT facingDest.relH = 90 player.brain.nav.goTo(facingDest, nav.CLOSE_ENOUGH, nav.CAREFUL_SPEED) if player.counter > 180: return player.goLater('spinAtGoal') return Transition.getNextState(player, spinToFaceBall)
def spinToFaceBall(player): if player.firstFrame(): facingDest = RelRobotLocation(0.0, 0.0, 0.0) if player.brain.ball.bearing_deg < 0.0: player.side = RIGHT facingDest.relH = -90 else: player.side = LEFT facingDest.relH = 90 player.brain.nav.goTo(facingDest, nav.CLOSE_ENOUGH, nav.CAREFUL_SPEED) if player.counter > 180: return player.goLater('spinAtGoal') return Transition.getNextState(player, spinToFaceBall)
def faceBall(player): if player.firstFrame(): player.brain.tracker.trackBall() print("ball at ", player.brain.ball.bearing_deg) facingDest = RelRobotLocation(0.0, 0.0, 0.0) facingDest.relH = player.brain.ball.bearing_deg if player.inPosition == constants.FAR_LEFT_POSITION: facingDest.relH += 10.0 player.brain.nav.walkTo(facingDest, speed=nav.FAST_SPEED) if player.counter > 300 or player.brain.ball.vis.frames_off > 10: return player.goLater('watch') return Transition.getNextState(player, faceBall)
def faceBall(player): if player.firstFrame(): player.brain.tracker.trackBall() print("ball at ", player.brain.ball.bearing_deg) facingDest = RelRobotLocation(0.0, 0.0, 0.0) facingDest.relH = player.brain.ball.bearing_deg if player.inPosition == constants.FAR_LEFT_POSITION: facingDest.relH += 10.0 player.brain.nav.walkTo(facingDest, speed = nav.FAST_SPEED) if player.counter > 300 or player.brain.ball.vis.frames_off > 10: return player.goLater('watch') return Transition.getNextState(player, faceBall)
def spinToFaceBall(player): facingDest = RelRobotLocation(0.0, 0.0, 0.0) # if player.brain.ball.bearing_deg < 0.0: # player.side = RIGHT # facingDest.relH = -90 # else: # player.side = LEFT # facingDest.relH = 90 # player.brain.interface.motionRequest.reset_odometry = True # player.brain.interface.motionRequest.timestamp = int(player.brain.time * 1000) facingDest.relH = player.brain.ball.bearing_deg player.brain.nav.goTo(facingDest, nav.CLOSE_ENOUGH, nav.CAREFUL_SPEED) # if player.counter > 180: # return player.goLater('spinAtGoal') return Transition.getNextState(player, spinToFaceBall)