feat: 增加雙lane服務端,修改hanoi動作以應對放置在圍擋上的問題

This commit is contained in:
bmy
2024-07-13 15:21:21 +08:00
parent ac6e055c42
commit 5b6ca482e5
3 changed files with 71 additions and 49 deletions

View File

@@ -8,9 +8,14 @@ import variable as var
class main_task():
def __init__(self,by_cmd):
# lane infer server
self.context = zmq.Context()
self.socket = self.context.socket(zmq.REQ)
self.socket.connect("tcp://localhost:6666")
# lane infer server1
self.context1 = zmq.Context()
self.socket1 = self.context.socket(zmq.REQ)
self.socket1.connect("tcp://localhost:6669")
# 赛道回归相关
self.x = 0
@@ -97,10 +102,9 @@ class main_task():
# logger.debug(f"err={self.lane_error}, pwm out={pid_out}")
self.by_cmd.send_speed_omega(pid_out)
if var.switch_lane_model:
self.socket.send_string("1")
self.socket1.send_string("")
resp = self.socket1.recv_pyobj()
else:
self.socket.send_string("")
resp = self.socket.recv_pyobj()
var.switch_lane_model = False
return
self.socket.send_string("")
resp = self.socket.recv_pyobj()
self.parse_data(resp)