trying smoother ball alignment
This commit is contained in:
@@ -237,15 +237,14 @@ class Striker(object):
|
|||||||
x, y = ball_angles
|
x, y = ball_angles
|
||||||
goal_x, goal_y = 0.095, 0.30
|
goal_x, goal_y = 0.095, 0.30
|
||||||
dx, dy = goal_x - x, goal_y - y
|
dx, dy = goal_x - x, goal_y - y
|
||||||
if abs(dx) < 0.05 and abs(dy) < 0.05:
|
|
||||||
print(x, y)
|
dx = -dx * 0.2 if abs(dx) > 0.05 else 0
|
||||||
|
dy = dy * 0.3 if abs(dy) > 0.05 else 0
|
||||||
|
if dx == 0 and dy == 0:
|
||||||
return True
|
return True
|
||||||
if abs(dx) > 0.05:
|
print('Moving to dxdy', dx, dy)
|
||||||
self.mover.move_to_fast(0, -dx * 0.2, 0)
|
self.mover.move_to(dy, dx, 0)
|
||||||
self.mover.wait()
|
self.mover.wait()
|
||||||
if abs(dy) > 0.05:
|
|
||||||
self.mover.move_to_fast(dy * 0.3, 0, 0)
|
|
||||||
self.mover.wait()
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def align_to_goal(self):
|
def align_to_goal(self):
|
||||||
@@ -412,7 +411,7 @@ if __name__ == '__main__':
|
|||||||
# (see diagram above)
|
# (see diagram above)
|
||||||
else:
|
else:
|
||||||
try: # Hit Ctrl-C to stop, cleanup and exit
|
try: # Hit Ctrl-C to stop, cleanup and exit
|
||||||
state = 'tracking'
|
state = 'align'
|
||||||
init_soll = 0.0
|
init_soll = 0.0
|
||||||
align_start = 0.15
|
align_start = 0.15
|
||||||
curve_start = -0.1
|
curve_start = -0.1
|
||||||
@@ -472,8 +471,9 @@ if __name__ == '__main__':
|
|||||||
striker.speak('I am going. To kick ass')
|
striker.speak('I am going. To kick ass')
|
||||||
state = 'kick'
|
state = 'kick'
|
||||||
except ValueError:
|
except ValueError:
|
||||||
striker.mover.set_head_angles(0, 0, 0.3)
|
pass
|
||||||
state = 'tracking'
|
# striker.mover.set_head_angles(0, 0, 0.3)
|
||||||
|
# state = 'tracking'
|
||||||
|
|
||||||
elif state == 'simple_kick':
|
elif state == 'simple_kick':
|
||||||
striker.mover.set_head_angles(0,0.25,0.3)
|
striker.mover.set_head_angles(0,0.25,0.3)
|
||||||
|
|||||||
Reference in New Issue
Block a user