Skip to content

Commit

Permalink
average direction implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Phobos97 committed May 21, 2022
1 parent c03642d commit 403aed1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Main/bounce.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def bounce(rendering):

# initialize state
state = 'stand'
average_direction = 0

# main loop
try:
Expand All @@ -62,9 +63,16 @@ def bounce(rendering):
direction, fire = detector.check_for_object(frame.array, show_video=show_video)
state = direction

if direction == "right":
average_direction += 1
else:
average_direction -= 1

if fire:
bb.activate_solenoid(0.2)

final_turn_angle = 20 if average_direction > 0 else -20

if state == 'stand':
# bb.move(0)
pass
Expand Down

0 comments on commit 403aed1

Please sign in to comment.