Skip to content

Commit

Permalink
fix bounce by adding in random direction when cornered
Browse files Browse the repository at this point in the history
  • Loading branch information
misko committed Jan 29, 2024
1 parent 0851451 commit 8eb8042
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spf/grbl/grbl_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,16 @@ def bounce(self, current_p, total_bounces=-1):
to_points, new_direction = self.single_bounce(
self.current_direction, current_p
)
logging.info(f"{str(self)},{str(to_points[0])},{str(to_points[-1])}")
logging.info(
f"{str(self)},{str(to_points[0])},{str(to_points[-1])},{str(new_direction)},{len(to_points)}"
)
assert len(to_points) > 0
yield from to_points
current_p = to_points[-1]
self.current_direction = new_direction
if len(to_points) == 1:
self.current_direction = self.random_direction()
else:
self.current_direction = new_direction
n_bounce += 1
logging.info("Exiting bounce")

Expand Down

0 comments on commit 8eb8042

Please sign in to comment.