Skip to content
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sitl_setup/run.sh eol=lf
22 changes: 19 additions & 3 deletions radio/tests/test_mission.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from flask_socketio.test_client import SocketIOTestClient

import pytest

from . import falcon_test
from .helpers import NoDrone

Expand All @@ -28,9 +26,27 @@ def test_getCurrentMission_correctState(

assert socketio_result["name"] == "current_mission" # Correct name emitted

pytest.skip(reason="Sending mission to simulator is currently bugged and fails sometimes")
# pytest.skip(reason="Sending mission to simulator is currently bugged and fails sometimes")
assert socketio_result["args"][0] == {
"mission_items": [
{
"mavpackettype": "MISSION_ITEM_INT",
"target_system": 255,
"target_component": 0,
"seq": 1,
"frame": 3,
"command": 22,
"current": 0,
"autocontinue": 1,
"param1": 0.0,
"param2": 0.0,
"param3": 0.0,
"param4": 0.0,
"x": 0,
"y": 0,
"z": 30.0,
"mission_type": 0,
},
{
"mavpackettype": "MISSION_ITEM_INT",
"target_system": 255,
Expand Down
20 changes: 15 additions & 5 deletions sitl_setup/mission_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@

from pymavlink import mavutil, mavwp

time.sleep(5)

master = mavutil.mavlink_connection("tcp:127.0.0.1:5760", retries=10)

master.wait_heartbeat()
connection_refused_retries = 0
while True:
try:
master = mavutil.mavlink_connection("tcp:127.0.0.1:5760", retries=60)

master.wait_heartbeat()
break
except ConnectionRefusedError:
print("Failed to connect to SITL")
connection_refused_retries += 1
if connection_refused_retries > 20:
print("Failed to connect to SITL after 20 retries")
exit(1)
else:
time.sleep(1)

wp = mavwp.MAVWPLoader()

Expand Down