Skip to content

Commit 77f8cd2

Browse files
authored
Merge branch 'main' into fawwaz/precision-hover
2 parents a7ac9ae + 81f9092 commit 77f8cd2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+721
-2594
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[submodule "third_party/yolov5"]
2-
path = third_party/yolov5
3-
url = https://github.com/ultralytics/yolov5
4-
[submodule "dep/labeller"]
5-
path = dep/labeller
6-
url = git@github.com:uaarg/labeller.git
71
[submodule "src/modules/mavctl"]
82
path = src/modules/mavctl
93
url = git@github.com:uaarg/mavctl-python.git

dep/labeller

Lines changed: 0 additions & 1 deletion
This file was deleted.

landing_nano.pt

-3.65 MB
Binary file not shown.

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ typing_extensions==4.9.0
2929
yapf==0.40.1
3030
zipp==3.17.0
3131
ultralytics==8.3.128
32+
websockets==15.0.1

samples/emu_connection.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from src.modules.emu import Emu
2+
import time
3+
import json
4+
5+
emu = Emu("res")
6+
7+
# def onConnect():
8+
# loadCurrent = {
9+
# "type": "load",
10+
# "uavStatus": {
11+
# "connection": "no",
12+
# "mode": "test",
13+
# "imageCount": "2",
14+
# "timeSinceMessage": "3"
15+
# },
16+
# "imageName": "res/sample1.jpg"
17+
# }
18+
# emu.send_msg(json.dumps(loadCurrent))
19+
20+
21+
# emu.set_on_connect(onConnect)
22+
emu.start_comms()
23+
time.sleep(2)
24+
25+
# test different logs
26+
for i in range(6):
27+
print(f"sending log {i}")
28+
if i % 3 == 0: severity = "normal"
29+
elif i % 3 == 1: severity = "warning"
30+
else: severity = "error"
31+
emu.send_log(f"log text {i}", severity)
32+
time.sleep(1)
33+
34+
while True:
35+
print("sending image")
36+
emu.send_log("sending image")
37+
emu.send_image("test-image.jpeg")
38+
time.sleep(2)

samples/oakd.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
from PIL import Image
2+
from src.modules.emu import Emu
3+
import time
4+
import json
5+
import threading
6+
7+
from src.modules.imaging.camera import DepthCapture, OakdCamera
8+
9+
emu = Emu("tmp")
10+
i = 0
11+
12+
def print_conn():
13+
print("connecton made")
14+
15+
emu.set_on_connect(print_conn)
16+
latest_capture: DepthCapture | None = None
17+
18+
emu.start_comms()
19+
time.sleep(2)
20+
21+
camera = OakdCamera()
22+
23+
camera_thread = threading.Thread(target=camera.start(), daemon=True)
24+
camera_thread.start()
25+
26+
def send_img(message):
27+
global latest_capture, i
28+
29+
msg = json.loads(message)
30+
31+
if msg["type"] == "image" and msg["message"] == "capture":
32+
print("sending image")
33+
latest_capture = camera.capture_with_depth()
34+
im = Image.fromarray(latest_capture.rgb)
35+
36+
im.save(f"./tmp/{i}.jpeg")
37+
emu.send_image(f"{i}.jpeg")
38+
39+
i += 1
40+
41+
def measure(message):
42+
global latest_capture
43+
44+
msg = json.loads(message)
45+
46+
if msg["type"] == "getDistance":
47+
print("getting distance")
48+
points = msg["message"]
49+
50+
p1 = points["p1"]
51+
p2 = points["p2"]
52+
53+
if latest_capture is not None:
54+
distance = latest_capture.distance_between_points(p1["x"], p1["y"], p2["x"], p2["y"])
55+
send = {
56+
"type": "distance",
57+
"message": distance
58+
}
59+
emu.send_msg(json.dumps(send))
60+
print(f"distance sent: {send}")
61+
62+
63+
emu.subscribe(send_img)
64+
emu.subscribe(measure)
65+
time.sleep(500)

src/aeac2024/task1.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/aeac2024/task1_real.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/aeac2024/task2.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/aeac2025/camera_log.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)