Skip to content

Commit

Permalink
Changed the default pathing to find the next closest landing pad
Browse files Browse the repository at this point in the history
  • Loading branch information
passman300 committed Jan 27, 2025
1 parent e28e212 commit b1c7ac1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions modules/bootcamp/decision_waypoint_landing_pads.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,16 @@ def run(
):
command = commands.Command.create_land_command()

# move the drone to the waypoint
elif not self.within_accepepted_radius(report.position, self.waypoint):
distance_x = self.waypoint.location_x - report.position.location_x
distance_y = self.waypoint.location_y - report.position.location_y
command = commands.Command.create_set_relative_destination_command(
distance_x, distance_y
)

# find the next closest landing pad
elif self.within_accepepted_radius(report.position, self.waypoint):
else:
shortest_distance = float("inf")

for landing_pad in landing_pad_locations:
Expand All @@ -120,12 +128,7 @@ def run(

self.waypoint_reached = True

else:
distance_x = self.waypoint.location_x - report.position.location_x
distance_y = self.waypoint.location_y - report.position.location_y
command = commands.Command.create_set_relative_destination_command(
distance_x, distance_y
)

# ============
# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
# ============
Expand Down

0 comments on commit b1c7ac1

Please sign in to comment.