添加调试信息

This commit is contained in:
zzh
2025-06-04 12:17:16 +08:00
parent 268d0d6993
commit 1e6f8c7442
3 changed files with 9 additions and 7 deletions

View File

@@ -27,7 +27,7 @@ HOST = "0.0.0.0"
PORT = 65444
# TODO: 帧率控制配置
PERIOD = 0.1
PERIOD = 1
class VisionMode(enum.Enum):

View File

@@ -203,6 +203,7 @@ class Presenter:
try:
server.accept_client()
while True:
start = time.time()
# TODO: next_time 记录时钟控制帧率
next_time = time.perf_counter() + PERIOD
try:
@@ -210,9 +211,6 @@ class Presenter:
tcp_rec_buf = server.recv_data()
if tcp_rec_buf:
self.rec_tcp_data_handle(tcp_rec_buf)
elif not tcp_rec_buf:
print("Client disconnected gracefully")
continue
except ConnectionResetError:
print("Warring: clietn force disconnect!!! ")
break
@@ -241,7 +239,13 @@ class Presenter:
except TypeError as e:
print(f"JSON encode failed: {e}")
tcp_send_buf = b"{}"
print(f"DEBUG:{self.pkt}")
server.send_data(tcp_send_buf)
end = time.time()
duration_ms = (end - start) * 1000
print(f"[INFO] 每帧耗时: {duration_ms:.2f} ms")
# TODO: 控制帧率
now = time.perf_counter()

View File

@@ -1,7 +1,5 @@
import socket
from open3d import re
class TcpServer:
def __init__(self, host="0.0.0.0", port=65444) -> None: