Skip to content

Commit 1c8a9a4

Browse files
authored
Add files via upload
1 parent baa426f commit 1c8a9a4

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

decision_waypoint_landing_pads.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class DecisionWaypointLandingPads(base_decision.BaseDecision):
2727
def __init__(self, waypoint: location.Location, acceptance_radius: float) -> None:
2828
"""
2929
Initialize all persistent variables here with self.
30+
31+
Args:
32+
waypoint (location.Location): The waypoint location to travel to.
33+
acceptance_radius (float): The radius within which the waypoint is considered reached.
3034
"""
3135
self.waypoint = waypoint
3236
print(f"Waypoint: {waypoint}")
@@ -37,49 +41,42 @@ def __init__(self, waypoint: location.Location, acceptance_radius: float) -> Non
3741
# ↓ BOOTCAMPERS MODIFY BELOW THIS COMMENT ↓
3842
# ============
3943

40-
print(str(waypoint.location_x)+str(waypoint.location_y))
44+
print(str(waypoint.location_x) + str(waypoint.location_y))
4145

4246
self.has_sent_landing_command = False
43-
4447
self.find_nearest_landing_pad = False
45-
4648
self.reached_waypoint = False
47-
4849
self.moving_to_landing_pad = False
49-
5050
self.counter = 0
5151

52-
def at_point(self, current_x: float, current_y: float):
52+
def at_point(self, current_x: float, current_y: float) -> bool:
53+
"""
54+
Check if the current position is within the acceptance radius of the waypoint.
5355
56+
Args:
57+
current_x (float): The current x-coordinate of the drone.
58+
current_y (float): The current y-coordinate of the drone.
5459
60+
Returns:
61+
bool: True if the drone is within the acceptance radius, False otherwise.
62+
"""
5563
distance_squared = (self.waypoint.location_x - current_x) ** 2 + (
5664
self.waypoint.location_y - current_y
5765
) ** 2
5866
return distance_squared <= self.acceptance_radius ** 2
5967

60-
61-
62-
# ============
63-
# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
64-
# ============
65-
6668
def run(
6769
self, report: drone_report.DroneReport, landing_pad_locations: "list[location.Location]"
6870
) -> commands.Command:
6971
"""
7072
Make the drone fly to the waypoint and then land at the nearest landing pad.
7173
72-
You are allowed to create as many helper methods as you want,
73-
as long as you do not change the __init__() and run() signatures.
74-
75-
This method will be called in an infinite loop, something like this:
74+
Args:
75+
report (drone_report.DroneReport): Current status report of the drone.
76+
landing_pad_locations (list[location.Location]): List of available landing pad locations.
7677
77-
```py
78-
while True:
79-
report, landing_pad_locations = get_input()
80-
command = Decision.run(report, landing_pad_locations)
81-
put_output(command)
82-
```
78+
Returns:
79+
commands.Command: The command for the drone to execute.
8380
"""
8481
# Default command
8582
command = commands.Command.create_null_command()

detect_landing_pad.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ def run(self, image: np.ndarray) -> "tuple[list[bounding_box.BoundingBox], np.nd
129129
if not success:
130130
continue
131131

132+
132133
return [], image_annotated
133134

134135

135136
# ============
136137
# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
137-
# ============
138+
# ============

0 commit comments

Comments
 (0)