Skip to content

Commit f56847a

Browse files
committed
Removes fancy stuff
1 parent 18408be commit f56847a

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/detect.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,15 @@ def object_detection_loop(camera: CameraInterface, model: ModelInterface, args):
3838
if args.droneport:
3939
TIMEOUT = 30
4040
print(f"Connecting to drone... ({TIMEOUT}s timeout)")
41-
attempt = mavutil.mavlink_connection(
41+
master = mavutil.mavlink_connection(
4242
"udpout:127.0.0.1:14550"
4343
) # adjust for actual drone connection
4444

45-
# make sure it is connected
46-
for _ in tqdm(
47-
range(TIMEOUT // 5), desc="Connecting to drone", unit="s", leave=False
48-
):
49-
if attempt.wait_heartbeat(timeout=5):
50-
print("✅ Drone connected!")
51-
master = attempt
52-
break
53-
if mavprocess.poll():
54-
print("MAVProxy process terminated unexpectedly.")
55-
break
45+
if not master.wait_heartbeat(timeout=TIMEOUT):
46+
print("Drone connection failed.")
47+
master = None
48+
else:
49+
print("✅ Drone connected!")
5650

5751
stream = Stream("picam", size=(640, 640), fps=3, quality=100)
5852
server = MjpegServer("0.0.0.0", 8080)

0 commit comments

Comments
 (0)