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

0
pykick/__init__.py Normal file
View File

View File

@@ -19,10 +19,10 @@ if __name__ == '__main__':
ball_min_radius=cfg['ball_min_radius'], ball_min_radius=cfg['ball_min_radius'],
) )
striker.speak('tiger') # striker.speak('tiger')
sleep(4.75) # sleep(4.75)
striker.mover.stand_up(1.0) striker.mover.stand_up(1.0)
sleep(9) # sleep(9)
print('Initialized') print('Initialized')
striker.speak('Initialized') striker.speak('Initialized')
@@ -132,7 +132,7 @@ if __name__ == '__main__':
sleep(0.3) sleep(0.3)
if success: if success:
state = 'kick' state = 'kick'
striker.speak('hasta') # striker.speak('hasta')
except ValueError: except ValueError:
striker.ball_tracking() striker.ball_tracking()
@@ -159,9 +159,9 @@ if __name__ == '__main__':
else: else:
striker.speak('I succeeded, confirmed') striker.speak('I succeeded, confirmed')
sleep(0.5) sleep(0.5)
break else:
striker.speak('I succeeded, presumably')
striker.speak('I succeeded, presumably')
striker.mover.stand_up() striker.mover.stand_up()
sleep(0.5) sleep(0.5)
striker.speak('Nice kick. Lets do the dance') striker.speak('Nice kick. Lets do the dance')

View File

@@ -32,8 +32,8 @@ class NaoMover(object):
# [[(0, 1, 'ShoulderRoll', -70)], 0.5], # [[(0, 1, 'ShoulderRoll', -70)], 0.5],
# lean to the side using the ankle joints # lean to the side using the ankle joints
[[(0, 1, 'AnkleRoll', -11), [[(0, 1, 'AnkleRoll', -12),
(1, 1, 'AnkleRoll', -11)], (1, 1, 'AnkleRoll', -12)],
1], 1],
# lift the foot using the knee joint and the ankle joint # lift the foot using the knee joint and the ankle joint

View File

@@ -39,6 +39,6 @@
] ]
], ],
"cam": 1, "cam": 1,
"ip": "192.168.0.11", "ip": "10.152.246.74",
"port": 9559 "port": 9559
} }

View File

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