Fixed critical bug in goal center detection
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user