Skip to content

Commit

Permalink
fixed the spin goal by removing i
Browse files Browse the repository at this point in the history
  • Loading branch information
Isopod00 authored and jmblixt3 committed Jul 3, 2024
1 parent 333cd7c commit a072989
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ def execute_callback(self, goal_handle: ServerGoalHandle):
self.get_logger().error("Nav2 service not available")
return result

for i in range(1, 3):
spin_attempts = 2
for i in range(spin_attempts):
# Spin around to find the apriltag
spin_goal = Spin.Goal(target_yaw=(i * math.pi))
spin_goal = Spin.Goal(target_yaw=math.pi)
spin_request = self.cli_spin.send_goal_async(spin_goal)
rclpy.spin_until_future_complete(self, spin_request)
spin_handle: ClientGoalHandle = spin_request.result()
Expand All @@ -69,7 +70,7 @@ def execute_callback(self, goal_handle: ServerGoalHandle):
self.future_spin.cancel()
rclpy.spin_until_future_complete(self, self.future_spin)
break
elif i == 2:
elif i == spin_attempts-1:
self.get_logger().error("Failed to find apriltag")
return result

Expand Down

0 comments on commit a072989

Please sign in to comment.