@@ -27,6 +27,10 @@ class DecisionWaypointLandingPads(base_decision.BaseDecision):
27
27
def __init__ (self , waypoint : location .Location , acceptance_radius : float ) -> None :
28
28
"""
29
29
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.
30
34
"""
31
35
self .waypoint = waypoint
32
36
print (f"Waypoint: { waypoint } " )
@@ -37,49 +41,42 @@ def __init__(self, waypoint: location.Location, acceptance_radius: float) -> Non
37
41
# ↓ BOOTCAMPERS MODIFY BELOW THIS COMMENT ↓
38
42
# ============
39
43
40
- print (str (waypoint .location_x )+ str (waypoint .location_y ))
44
+ print (str (waypoint .location_x ) + str (waypoint .location_y ))
41
45
42
46
self .has_sent_landing_command = False
43
-
44
47
self .find_nearest_landing_pad = False
45
-
46
48
self .reached_waypoint = False
47
-
48
49
self .moving_to_landing_pad = False
49
-
50
50
self .counter = 0
51
51
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.
53
55
56
+ Args:
57
+ current_x (float): The current x-coordinate of the drone.
58
+ current_y (float): The current y-coordinate of the drone.
54
59
60
+ Returns:
61
+ bool: True if the drone is within the acceptance radius, False otherwise.
62
+ """
55
63
distance_squared = (self .waypoint .location_x - current_x ) ** 2 + (
56
64
self .waypoint .location_y - current_y
57
65
) ** 2
58
66
return distance_squared <= self .acceptance_radius ** 2
59
67
60
-
61
-
62
- # ============
63
- # ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
64
- # ============
65
-
66
68
def run (
67
69
self , report : drone_report .DroneReport , landing_pad_locations : "list[location.Location]"
68
70
) -> commands .Command :
69
71
"""
70
72
Make the drone fly to the waypoint and then land at the nearest landing pad.
71
73
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.
76
77
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.
83
80
"""
84
81
# Default command
85
82
command = commands .Command .create_null_command ()
0 commit comments