def nextCommand(self): ''' if self.robot.catcher != "prepared": self.robot.catcher = "prepared" return CommandDict.prepare() ''' # If we need to move to the ball, then get the command and return it # command = self.go_to(self.world.ball.x, self.world.ball.y, speed=75) command = self.go_to_asym(self.world.ball.x, self.world.ball.y, forward=True, max_speed = 70, min_speed=50) distance = self.robot.get_euclidean_distance_to_point(self.world.ball.x, self.world.ball.y) # this is a useful function that tells you how rotation aligns with wanted rotation dot = self.robot.get_dot_to_target(self.world.ball.x, self.world.ball.y) # if very close to ball if distance < DISTANCE_ERROR and dot > 0.96: self.finished = True self.robot.catcher = "closed" self.robot.set_busy_for(1.1) return CommandDict.catch() return command
def catch(self): self.finished = True self.robot.catcher = "closed" #self.robot.set_busy_for(1.1) return CommandDict.catch()