添加调试信息
This commit is contained in:
@@ -27,7 +27,7 @@ HOST = "0.0.0.0"
|
|||||||
PORT = 65444
|
PORT = 65444
|
||||||
|
|
||||||
# TODO: 帧率控制配置
|
# TODO: 帧率控制配置
|
||||||
PERIOD = 0.1
|
PERIOD = 1
|
||||||
|
|
||||||
|
|
||||||
class VisionMode(enum.Enum):
|
class VisionMode(enum.Enum):
|
||||||
|
@@ -203,6 +203,7 @@ class Presenter:
|
|||||||
try:
|
try:
|
||||||
server.accept_client()
|
server.accept_client()
|
||||||
while True:
|
while True:
|
||||||
|
start = time.time()
|
||||||
# TODO: next_time 记录时钟控制帧率
|
# TODO: next_time 记录时钟控制帧率
|
||||||
next_time = time.perf_counter() + PERIOD
|
next_time = time.perf_counter() + PERIOD
|
||||||
try:
|
try:
|
||||||
@@ -210,9 +211,6 @@ class Presenter:
|
|||||||
tcp_rec_buf = server.recv_data()
|
tcp_rec_buf = server.recv_data()
|
||||||
if tcp_rec_buf:
|
if tcp_rec_buf:
|
||||||
self.rec_tcp_data_handle(tcp_rec_buf)
|
self.rec_tcp_data_handle(tcp_rec_buf)
|
||||||
elif not tcp_rec_buf:
|
|
||||||
print("Client disconnected gracefully")
|
|
||||||
continue
|
|
||||||
except ConnectionResetError:
|
except ConnectionResetError:
|
||||||
print("Warring: clietn force disconnect!!! ")
|
print("Warring: clietn force disconnect!!! ")
|
||||||
break
|
break
|
||||||
@@ -241,7 +239,13 @@ class Presenter:
|
|||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
print(f"JSON encode failed: {e}")
|
print(f"JSON encode failed: {e}")
|
||||||
tcp_send_buf = b"{}"
|
tcp_send_buf = b"{}"
|
||||||
|
|
||||||
|
print(f"DEBUG:{self.pkt}")
|
||||||
|
|
||||||
server.send_data(tcp_send_buf)
|
server.send_data(tcp_send_buf)
|
||||||
|
end = time.time()
|
||||||
|
duration_ms = (end - start) * 1000
|
||||||
|
print(f"[INFO] 每帧耗时: {duration_ms:.2f} ms")
|
||||||
|
|
||||||
# TODO: 控制帧率
|
# TODO: 控制帧率
|
||||||
now = time.perf_counter()
|
now = time.perf_counter()
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
from open3d import re
|
|
||||||
|
|
||||||
|
|
||||||
class TcpServer:
|
class TcpServer:
|
||||||
def __init__(self, host="0.0.0.0", port=65444) -> None:
|
def __init__(self, host="0.0.0.0", port=65444) -> None:
|
||||||
|
Reference in New Issue
Block a user