Skip to content

Commit 04a9740

Browse files
committed
fix image none bug (maybe)
1 parent b15a848 commit 04a9740

22 files changed

+29
-142
lines changed

.OutlineViewer/outlineviewer-window.json

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

.OutlineViewer/outlineviewer.json

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

PiSideCode/camera/camera.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,13 @@ def want_new_frames(self):
156156
self.new_data_index = (self.new_data_index + 1) % 2
157157

158158
def _read_frame(self, identifier):
159+
# eventlet.sleep(0.1) # FIXME cam returns None sometimes, delay could help???
160+
# [ WARN:[email protected]] global cap_v4l.cpp:1048 tryIoctl VIDEOIO(V4L2 select() timeout.
159161
cam_info = self.info[identifier]
160162
ret, img = False, None
161163
before = time.perf_counter()
162164

163165
try:
164-
# with cam_info.setting_lock:
165166
ret, img = cam_info.cam.read()
166167
except Exception as e:
167168
Cameras.logger.error(f"Failed to read frame", exc_info=e)

PiSideCode/processing/tag_processing.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TagProcessor:
88
logger = logging.getLogger(__name__)
99
MIN_TAG = 1
10-
MAX_TAG = 16
10+
MAX_TAG = 22
1111

1212
# Create a pose estimator
1313
def __init__(self):
@@ -22,7 +22,6 @@ def __init__(self):
2222
aruco_params.cornerRefinementMethod = cv2.aruco.CORNER_REFINE_SUBPIX # Can use CORNER_REFINE_APRILTAG
2323
aruco_params.cornerRefinementMinAccuracy = 0.1
2424
aruco_params.cornerRefinementMaxIterations = 30
25-
aruco_params.useAruco3Detection = True # FIXME TEST!!!
2625
self.aruco_detector.setDetectorParameters(aruco_params)
2726

2827
def get_tags(self, img: np.ndarray, valid_tags: np.ndarray, draw: bool):
@@ -47,7 +46,7 @@ def get_tags(self, img: np.ndarray, valid_tags: np.ndarray, draw: bool):
4746
ids = ids[mask]
4847
corners = np.asarray(corners)[mask]
4948

50-
if len(corners.shape) == 5:
49+
if len(corners.shape) == 5 and len(corners) > 0:
5150
corners = corners[0]
5251

5352
if len(corners) > 0:

PiSideCode/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Flask
33
flask[async]
44
flask-socketio
55
eventlet
6-
numpy < 2 # wpimath segfaults with numpy 2
6+
numpy #< 2 # wpimath segfaults with numpy 2
77
opencv-python >= 4.11.0
88
matplotlib
99
Pillow >= 10.3

PiSideCode/state.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@ def set_web_img_info(
162162
identifier
163163
] = f"Poses: \n\
164164
T1: ({round(a.X(), 2)}, {round(a.Y(), 2)}, {round(a.Z(), 2)}) \n\
165-
R1: ({round(a.rotation().X(), 2)}, {round(a.rotation().Y(), 2)}\n\n\
166-
T2: {round(a.rotation().Z(), 2)})]\n({round(b.X(), 2)}, {round(b.Y(), 2)}, {round(b.Z(), 2)}) \n\
165+
R1: ({round(a.rotation().X(), 2)}, {round(a.rotation().Y(), 2)}, {round(a.rotation().Z(), 2)})\n\n\
166+
T2: ({round(b.X(), 2)}, {round(b.Y(), 2)}, {round(b.Z(), 2)}) \n\
167167
R2: ({round(b.rotation().X(), 2)}, {round(b.rotation().Y(), 2)}, {round(b.rotation().Z(), 2)})"
168168

169169
elif len(info) > 0:
170170
display = []
171171
corners = np.asarray(info[1]).tolist()
172172

173173
for tag_id, c in zip(info[0], corners):
174-
display.append(f"\n[{tag_id}]: {", ".join([str(round(cx, 2), round(cy, 2)) for (cx, cy) in c])}")
174+
display.append(f"[{tag_id}]: {", ".join([str((round(cx, 3), round(cy, 3))) for (cx, cy) in c])}")
175175

176-
self.img_info[identifier] = f"Tag corners: {display}"
176+
self.img_info[identifier] = f"Tag corners: \n{"\n".join(display)}"
177177

178178
# Return the file path names for each camera
179179
def get_cal_file_paths(self):

PiSideCode/web_interface/image_streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def output(self):
3232
b"--frame\r\n"
3333
b"Content-Type: image/jpeg\r\n\r\n" + self.output_frame + b"\r\n"
3434
)
35-
eventlet.sleep(0.3)
35+
eventlet.sleep(0.1)
3636

3737

3838
class LivePlotBuffer(Buffer):
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"files": {
33
"main.css": "/static/css/main.39e485e8.css",
4-
"main.js": "/static/js/main.0302c7b1.js",
4+
"main.js": "/static/js/main.6ace6947.js",
55
"static/media/bootstrap-icons.woff?": "/static/media/bootstrap-icons.39795c0b4513de014cf8.woff",
66
"static/media/bootstrap-icons.woff2?": "/static/media/bootstrap-icons.b7bcc075b395c14ce8c2.woff2",
77
"index.html": "/index.html",
88
"main.39e485e8.css.map": "/static/css/main.39e485e8.css.map",
9-
"main.0302c7b1.js.map": "/static/js/main.0302c7b1.js.map"
9+
"main.6ace6947.js.map": "/static/js/main.6ace6947.js.map"
1010
},
1111
"entrypoints": [
1212
"static/css/main.39e485e8.css",
13-
"static/js/main.0302c7b1.js"
13+
"static/js/main.6ace6947.js"
1414
]
1515
}

PiSideCode/web_interface/walleye/build/index.html

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="WallEYE web interface"/><title>WallEYE</title><script defer="defer" src="/static/js/main.0302c7b1.js"></script><link href="/static/css/main.39e485e8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="WallEYE web interface"/><title>WallEYE</title><script defer="defer" src="/static/js/main.6ace6947.js"></script><link href="/static/css/main.39e485e8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

PiSideCode/web_interface/walleye/build/static/css/main.39e485e8.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)