From 6d9d522692d951ac6afc855bb5aad857a4605c61 Mon Sep 17 00:00:00 2001 From: Pavel Lutskov Date: Sat, 30 Jun 2018 16:16:19 +0200 Subject: [PATCH] The run from the videos --- pykick/__main__.py | 5 +++-- pykick/striker.py | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pykick/__main__.py b/pykick/__main__.py index 28deee4..e6cb476 100644 --- a/pykick/__main__.py +++ b/pykick/__main__.py @@ -63,7 +63,7 @@ if __name__ == '__main__': elif state == 'tracking': # start ball approach when ball is visible print('Soll angle') - striker.ball_tracking(tol=0.05) + striker.ball_tracking(tol=0.15) # break if approach_steps < 2: state = 'ball_approach' @@ -74,7 +74,7 @@ if __name__ == '__main__': bil = striker.get_ball_angles_from_camera( striker.lower_camera ) # Ball in lower - print(bil) + print('Ball in lower!', bil) if bil is not None and bil[1] > 0.15: striker.speak('Ball is close enough, stop approach') striker.mover.stop_moving() @@ -161,6 +161,7 @@ if __name__ == '__main__': striker.mover.kick(fancy=True, foot='L') ##striker.speak("Nice kick. Let's do a dance") #striker.mover.dance() + sleep(2) break finally: striker.close() diff --git a/pykick/striker.py b/pykick/striker.py index 22ec683..72ffe6a 100644 --- a/pykick/striker.py +++ b/pykick/striker.py @@ -29,17 +29,17 @@ class Striker(object): nao_ip, port=nao_port, res=res, fps=10, cam_id=0, ) self.lower_camera = NaoImageReader( - nao_ip, port=nao_port, res=res, fps=10, cam_id=1, + nao_ip, port=nao_port, res=1, fps=10, cam_id=1, ) # POV self.upper_pov = NaoImageReader( - nao_ip, port=nao_port, res=1, fps=15, cam_id=0, + nao_ip, port=nao_port, res=1, fps=10, cam_id=0, video_file='./cam0_' + self.run_id + '.avi' ) self.lower_pov = NaoImageReader( - nao_ip, port=nao_port, res=1, fps=15, cam_id=1, + nao_ip, port=nao_port, res=1, fps=10, cam_id=1, video_file='./cam1_' + self.run_id + '.avi' ) self.pov_thread = Thread(target=self._pov) @@ -81,13 +81,14 @@ class Striker(object): while not self.is_over: while self.speach_queue: self.speaker.say(self.speach_queue.pop()) - sleep(0.1) + sleep(0.5) def _pov(self): while not self.is_over: try: self.upper_pov.get_frame() self.lower_pov.get_frame() + sleep(0.1) except RuntimeError as e: print(e) continue