some minor bugfixes

This commit is contained in:
2018-11-12 13:28:47 +01:00
parent 24f9515565
commit 71241908a1
5 changed files with 16 additions and 16 deletions

View File

@@ -185,21 +185,21 @@ class Striker(object):
def distance_to_ball(self):
camera = 'upper'
angles = self.get_ball_angles_from_camera(self.upper_camera)
if angles == None:
if angles is None:
camera = 'lower'
angles = self.get_ball_angles_from_camera(self.lower_camera)
if angles == None:
if angles is None:
raise ValueError('No ball in sight')
y_angle = angles[1]
y_angle = pi/2 - y_angle - radians(15) - (radians(39)
if camera == 'lower'
else 0)
y_angle = pi/2 - y_angle - radians(16.5) - (radians(39)
if camera == 'lower'
else 0)
print('Ball distance through', camera, 'camera')
print('Angles', angles)
return 0.5 * tan(y_angle)
def walking_direction(self, lr, d, hypo):
return (asin(0.40 / d) if hypo == 'bdist' else atan(0.2 / d)) * lr
return (asin(0.43 / d) if hypo == 'bdist' else atan(0.23 / d)) * lr
def ball_tracking(self, soll=0, tol=0.15):
"""Track the ball using the feed from top and bottom camera.