From 11769f16813e76e2f1fc7c8cd206d1543a16f1ef Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 4 Jun 2018 12:46:05 +0200 Subject: [PATCH] rotate head to the left and to the right if the ball is not in the view --- scripts/ball_approach.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/ball_approach.py b/scripts/ball_approach.py index 1186c90..9c2c126 100644 --- a/scripts/ball_approach.py +++ b/scripts/ball_approach.py @@ -44,9 +44,15 @@ class BallFollower(object): x, y = self.video_bot.to_relative(x, y) #print('Low camera') except TypeError: + print("Ball is not in the view\n") + head_angles=self.mover.get_head_angles() + if head_angles[0]==-0.5: + self.mover.set_head_angles(0.5,0,0.05) + else: + self.mover.set_head_angles(-0.5,0,0.05) return #print(x, y) - #self.process_coordinates(x, y) + self.process_coordinates(x, y) def process_coordinates(self, x, y): x_diff = x - 0.5