diff --git a/pykick/__main__.py b/pykick/__main__.py index e6cb476..052146f 100644 --- a/pykick/__main__.py +++ b/pykick/__main__.py @@ -161,7 +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) + sleep(4) break finally: striker.close() diff --git a/pykick/detection_demo.py b/pykick/detection_demo.py index 887dec4..e68ba38 100644 --- a/pykick/detection_demo.py +++ b/pykick/detection_demo.py @@ -111,6 +111,11 @@ if __name__ == '__main__': ball = ball_finder.find(ball_frame) goal = goal_finder.find(goal_frame) + if goal is not None: + print(goal) + print('LR post', goal_finder.left_right_post(goal)) + print('----') + ball_frame = ball_finder.draw(ball_frame, ball) goal_frame = goal_finder.draw(goal_frame, goal) diff --git a/pykick/finders.py b/pykick/finders.py index 0b16ca5..36fe4e4 100644 --- a/pykick/finders.py +++ b/pykick/finders.py @@ -118,7 +118,7 @@ class GoalFinder(object): return goal def left_right_post(self, contour): - return contour[:,0].min(), contour[:,0].max() + return contour[...,0].min(), contour[...,0].max() def goal_center(self, contour): l, r = self.left_right_post(contour) diff --git a/pykick/nao_defaults.json b/pykick/nao_defaults.json index 01210be..3743da1 100644 --- a/pykick/nao_defaults.json +++ b/pykick/nao_defaults.json @@ -11,19 +11,19 @@ 255 ] ], + "cam": 1, "goal": [ [ 0, 0, - 114 + 100 ], [ 180, - 49, + 65, 255 ] ], - "fps": 10, "res": 2, "ball_min_radius": 0.01, "field": [ @@ -38,7 +38,7 @@ 255 ] ], - "cam": 1, + "fps": 10, "ip": "192.168.0.11", "port": 9559 } \ No newline at end of file diff --git a/pykick/striker.py b/pykick/striker.py index 72ffe6a..d90b3db 100644 --- a/pykick/striker.py +++ b/pykick/striker.py @@ -294,6 +294,7 @@ class Striker(object): self.speak("Turn to ball") self.turn_to_ball(x, y, tol=0.15) self.speak('Trying to find the goal') + sleep(0.2) goal_center_x = self.goal_search() self.speak('Goal found')