diff --git a/modules/upload_commands.py b/modules/upload_commands.py index ef1dbab..44f44af 100644 --- a/modules/upload_commands.py +++ b/modules/upload_commands.py @@ -5,7 +5,9 @@ import dronekit -def upload_commands(drone: dronekit.Vehicle, commands: "list[dronekit.Command]") -> bool: +def upload_commands(drone: dronekit.Vehicle, + commands: "list[dronekit.Command]", + timeout: int) -> bool: """ Add the list of commands to the drone’s command sequence, and upload them. If the list is empty, does not upload anything. @@ -29,7 +31,7 @@ def upload_commands(drone: dronekit.Vehicle, commands: "list[dronekit.Command]") # This is to avoid duplicate or conflicting commands command_sequence = drone.commands command_sequence.download() - command_sequence.wait_ready() + command_sequence.wait_ready(timeout = timeout) command_sequence.clear() # Adds new commands to command sequence diff --git a/path_2024.py b/path_2024.py index b7724de..ca5e5da 100644 --- a/path_2024.py +++ b/path_2024.py @@ -23,6 +23,7 @@ KML_FILE_PREFIX = "waypoints_log" DELAY = 0.1 # seconds MAXIMUM_FLIGHT_TIME = 1800 # seconds +TIMEOUT = 30 # seconds # Required for checks @@ -76,7 +77,7 @@ def run() -> int: print("Error: add_takeoff_and_landing_command") return -1 - result = upload_commands.upload_commands(drone, takeoff_landing_commands) + result = upload_commands.upload_commands(drone, takeoff_landing_commands, timeout = TIMEOUT) if not result: print("Error: upload_commands") return -1