Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- balls = bot.get_balls()
- position = bot.get_position()
- ball = balls[3]
- #ball_angle = math.atan2(ball[1] - position[1], ball[0] - position[0])
- ball_angle = math.atan2(ball[1] - position[1], ball[0] - position[0])
- ball_angle = math.degrees(ball_angle)
- ball_angle = round(ball_angle, 1)
- angle = round(position[2], 1)
- print("ball: ", ball_angle, "angle: ", angle)
- if angle != ball_angle and angle != ball_angle - 0.1 and angle != ball_angle + 0.1 and not found:
- #bot.set_motors(0.01, 0.01)
- bot.set_motors(0.01, -0.01)
- else:
- #print("==")
- found = True
- bot.set_motors(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement