Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added timeout variable to path_2024.py #45

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/upload_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion path_2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
KML_FILE_PREFIX = "waypoints_log"
DELAY = 0.1 # seconds
MAXIMUM_FLIGHT_TIME = 1800 # seconds
TIMEOUT = 30 # seconds


# Required for checks
Expand Down Expand Up @@ -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
Expand Down
Loading