@@ -67,24 +67,17 @@ def run(
67
67
# ============
68
68
69
69
# If the drone is halted and not at the destination, move the drone to destination
70
- if report .status == drone_status .DroneStatus .HALTED and report .destination != self .waypoint :
71
- command = commands .Command .create_set_relative_destination_command (
72
- self .waypoint .location_x , self .waypoint .location_y
73
- )
74
- # if the drone is at the destination and halted land the drone
75
- elif (
76
- report .status == drone_status .DroneStatus .HALTED and report .destination == self .waypoint
77
- ):
78
- command = commands .Command .create_land_command ()
79
-
80
- # Case handling to ensure that the drone tries to land again if it lands outside of the acceptance radius
81
- if (
82
- report .status == drone_status .DroneStatus .LANDED
83
- and (report .position - report .destination ) > self .acceptance_radius
84
- ):
85
- command = commands .Command .create_set_relative_destination_command (
86
- self .waypoint .location_x , self .waypoint .location_y
87
- )
70
+ if report .status == drone_status .DroneStatus .HALTED :
71
+ if (report .destination - self .waypoint ) < self .acceptance_radius :
72
+ command = commands .Command .create_set_relative_destination_command (
73
+ abs (self .waypoint .location_x ), abs (self .waypoint .location_y )
74
+ )
75
+ # if the drone is at the destination and halted land the drone
76
+ elif (
77
+ (report .destination - self .waypoint ) < self .acceptance_radius
78
+ ):
79
+ command = commands .Command .create_land_command ()
80
+
88
81
# Do something based on the report and the state of this class...
89
82
90
83
# ============
0 commit comments