|
@@ -77,8 +77,8 @@ class MainWindow(QMainWindow):
|
|
|
self.basic()
|
|
|
self.showMaximized()
|
|
|
self.count_frame_ = ControllWidget.CountFrame()
|
|
|
- self.isLocalTest = False
|
|
|
- self.isAutoDispatchOnline = True
|
|
|
+ self.isLocalTest = True
|
|
|
+ self.isAutoDispatchOnline = False
|
|
|
|
|
|
self.Cancel_ = False
|
|
|
|
|
@@ -202,7 +202,6 @@ class MainWindow(QMainWindow):
|
|
|
[id, x, y] = self.ComputeStreetNode("Front", entrance_id, trans_x, trans_y, trans_a)
|
|
|
self.mapManager.maps["Front"].ResetVertexValue(mp.StreetNode(id, x, y))
|
|
|
|
|
|
-
|
|
|
self.mapManager.ResetMap("Back", 0, -wheelbase / 2)
|
|
|
[trans_x, trans_y, trans_a] = pose
|
|
|
self.mapManager.maps["Back"].ResetVertexValue(mp.SpaceNode(entrance_id, trans_x, trans_y, trans_a))
|
|
@@ -210,7 +209,6 @@ class MainWindow(QMainWindow):
|
|
|
[id, x, y] = self.ComputeStreetNode("Back", entrance_id, trans_x, trans_y, trans_a)
|
|
|
self.mapManager.maps["Back"].ResetVertexValue(mp.StreetNode(id, x, y))
|
|
|
|
|
|
-
|
|
|
def asyncExecute(self, tasks):
|
|
|
results = [feature.result() for feature in concurrent.futures.as_completed(tasks)]
|
|
|
print("==========================\n")
|
|
@@ -272,6 +270,7 @@ class MainWindow(QMainWindow):
|
|
|
|
|
|
def AutoParkTask(self, park_table: message.park_table = None):
|
|
|
print("AutoParkTask:---------------------\n")
|
|
|
+ task_flag = 1 # 存车
|
|
|
|
|
|
[controlMain, control1, control2] = self.GetMainFrontBackAGV()
|
|
|
mainMap, frontMap, backMap = ["Base", "Front", "Back"]
|
|
@@ -300,63 +299,68 @@ class MainWindow(QMainWindow):
|
|
|
trans_x += wheel_base / 2 * math.cos(trans_a)
|
|
|
trans_y += wheel_base / 2 * math.sin(trans_a)
|
|
|
|
|
|
+ # # # 双单车入库-----------------------------------------------------
|
|
|
+ # if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
+ # return False
|
|
|
+ # autoDirect = True
|
|
|
+ # self.updateMap_park(entrance_id, [trans_x, trans_y, trans_a], wheel_base)
|
|
|
+ #
|
|
|
+ # cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
+ # [label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
+ # control1.robot_.GeneratePath(label, entrance_id, frontMap)
|
|
|
+ # print("Front: begin:%s target:%s wheelBase:%f" % (label, entrance_id, wheel_base))
|
|
|
+ #
|
|
|
+ # cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
+ # [label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
+ # control2.robot_.GeneratePath(label, entrance_id, backMap)
|
|
|
+ # print("Back: begin:%s target:%s wheelBase:%f" % (label, entrance_id, wheel_base))
|
|
|
+ #
|
|
|
+ # threadPool = ThreadPoolExecutor(2)
|
|
|
+ # features = [
|
|
|
+ # threadPool.submit(control1.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base, task_flag),
|
|
|
+ # threadPool.submit(control2.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base, task_flag)
|
|
|
+ # ]
|
|
|
+ #
|
|
|
+ # if self.asyncExecute(features) == False:
|
|
|
+ # print(" Park Failed ")
|
|
|
+ # return False
|
|
|
+
|
|
|
+ # # ------------------------------------------
|
|
|
+ # # 双单车驶至入口前巷道点
|
|
|
+ self.updateMap_park(entrance_id, [trans_x, trans_y, trans_a], wheel_base)
|
|
|
+ entrance_streetNode = entrance_id.replace("S_", "R_")
|
|
|
if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
return False
|
|
|
- autoDirect = True
|
|
|
- # # 双单车入库-----------------------------------------------------
|
|
|
- self.updateMap_park(entrance_id, [trans_x, trans_y, trans_a], wheel_base)
|
|
|
-
|
|
|
cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
[label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
- control1.robot_.GeneratePath(label, entrance_id, frontMap)
|
|
|
- print("Front: begin:%s target:%s wheelBase:%f" % (label, entrance_id, wheel_base))
|
|
|
+ control1.robot_.GeneratePath(label, entrance_streetNode, frontMap)
|
|
|
+ print("Front: begin:%s target:%s wheelBase:%f" % (label, entrance_streetNode, wheel_base))
|
|
|
|
|
|
cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
[label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
- control2.robot_.GeneratePath(label, entrance_id, backMap)
|
|
|
- print("Back: begin:%s target:%s wheelBase:%f" % (label, entrance_id, wheel_base))
|
|
|
+ control2.robot_.GeneratePath(label, entrance_streetNode, backMap)
|
|
|
+ print("Back: begin:%s target:%s wheelBase:%f" % (label, entrance_streetNode, wheel_base))
|
|
|
|
|
|
+ autoDirect = True
|
|
|
threadPool = ThreadPoolExecutor(2)
|
|
|
- features = [threadPool.submit(control1.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base),
|
|
|
- threadPool.submit(control2.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base)]
|
|
|
-
|
|
|
+ features = [
|
|
|
+ threadPool.submit(control1.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base, task_flag),
|
|
|
+ threadPool.submit(control2.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base, task_flag)
|
|
|
+ ]
|
|
|
if self.asyncExecute(features) == False:
|
|
|
print(" Park Failed ")
|
|
|
return False
|
|
|
|
|
|
- # # ------------------------------------------
|
|
|
- # # 双单车驶至入口前巷道点
|
|
|
- # streetNode = entrance_id.replace("S_", "R_")
|
|
|
- # if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
- # return False
|
|
|
- # cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
- # [label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
- # control1.robot_.GeneratePath(label, streetNode, frontMap)
|
|
|
- # print("Front: begin:%s target:%s wheelBase:%f" % (label, streetNode, wheel_base))
|
|
|
- #
|
|
|
- # cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
- # [label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
- # control2.robot_.GeneratePath(label, streetNode, backMap)
|
|
|
- # print("Back: begin:%s target:%s wheelBase:%f" % (label, streetNode, wheel_base))
|
|
|
- #
|
|
|
- # autoDirect = True
|
|
|
- # threadPool = ThreadPoolExecutor(2)
|
|
|
- # features = [threadPool.submit(control1.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base),
|
|
|
- # threadPool.submit(control2.robot_.Navigatting, label, entrance_id, autoDirect, wheel_base)]
|
|
|
- # if self.asyncExecute(features) == False:
|
|
|
- # print(" Pick Failed ")
|
|
|
- # return False
|
|
|
- #
|
|
|
- # # 整车驶进入口---------------------------------
|
|
|
- # if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
|
|
|
- # return False
|
|
|
- #
|
|
|
- # map_name = "Front"
|
|
|
- # if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
- # map_name = "Back"
|
|
|
- # controlMain.robot_.GeneratePath(streetNode, entrance_id, map_name)
|
|
|
- # if controlMain.robot_.Navigatting(streetNode, entrance_id, True, wheel_base) == False:
|
|
|
- # return False
|
|
|
+ # 整车驶进入口---------------------------------
|
|
|
+ if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
|
|
|
+ return False
|
|
|
+
|
|
|
+ map_name = "Front"
|
|
|
+ if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
+ map_name = "Back"
|
|
|
+ controlMain.robot_.GeneratePath(entrance_streetNode, entrance_id, map_name)
|
|
|
+ if controlMain.robot_.Navigatting(entrance_streetNode, entrance_id, True, wheel_base, task_flag) == False:
|
|
|
+ return False
|
|
|
# # ---------------------------------
|
|
|
|
|
|
print(" input entrance completed!!!!")
|
|
@@ -365,16 +369,33 @@ class MainWindow(QMainWindow):
|
|
|
controlMain.robot_.ClampClose()
|
|
|
|
|
|
# 整车去车位---------------------------------
|
|
|
+ # map_name = "Front"
|
|
|
+ # if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
+ # map_name = "Back"
|
|
|
+ # controlMain.robot_.GeneratePath(entrance_id, target_id, map_name)
|
|
|
+ # print("begin:%s target:%s wheelBase:%f" % (entrance_id, target_id, wheel_base))
|
|
|
+ # controlMain.robot_.Navigatting(entrance_id, target_id, autoDirect, wheel_base, task_flag)
|
|
|
+
|
|
|
+ # 整车驶离入口到入口航道点
|
|
|
+ map_name = "Front"
|
|
|
+ if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
+ map_name = "Back"
|
|
|
+ controlMain.robot_.GeneratePath(entrance_id, entrance_streetNode, map_name)
|
|
|
+ print("begin:%s target:%s wheelBase:%f" % (entrance_id, entrance_streetNode, wheel_base))
|
|
|
+ controlMain.robot_.Navigatting(entrance_id, entrance_streetNode, autoDirect, wheel_base, task_flag)
|
|
|
+
|
|
|
+ # 整车从入口航道点到车位
|
|
|
map_name = "Front"
|
|
|
if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
map_name = "Back"
|
|
|
- controlMain.robot_.GeneratePath(entrance_id, target_id, map_name)
|
|
|
- print("begin:%s target:%s wheelBase:%f" % (entrance_id, target_id, wheel_base))
|
|
|
- controlMain.robot_.Navigatting(entrance_id, target_id, autoDirect, wheel_base)
|
|
|
+ controlMain.robot_.GeneratePath(entrance_streetNode, target_id, map_name)
|
|
|
+ print("begin:%s target:%s wheelBase:%f" % (entrance_streetNode, target_id, wheel_base))
|
|
|
+ controlMain.robot_.Navigatting(entrance_streetNode, target_id, autoDirect, wheel_base, task_flag)
|
|
|
+
|
|
|
|
|
|
print("-------------------------")
|
|
|
# 整车松夹池------------------------------------
|
|
|
- if controlMain.robot_.ClampOpen()==False:
|
|
|
+ if controlMain.robot_.ClampOpen() == False:
|
|
|
return False
|
|
|
|
|
|
map_name = "Front"
|
|
@@ -387,9 +408,9 @@ class MainWindow(QMainWindow):
|
|
|
self.updateMap_park(entrance_id, [trans_x, trans_y, trans_a], temp_wheel_base)
|
|
|
if (controlMain.robot_.SwitchMoveMode(1, temp_wheel_base) == False):
|
|
|
return False
|
|
|
- streetNode = target_id.replace("S_", "R_")
|
|
|
- controlMain.robot_.GeneratePath(target_id, streetNode, map_name)
|
|
|
- if controlMain.robot_.Navigatting(target_id, streetNode, True, temp_wheel_base) == False:
|
|
|
+ entrance_streetNode = target_id.replace("S_", "R_")
|
|
|
+ controlMain.robot_.GeneratePath(target_id, entrance_streetNode, map_name)
|
|
|
+ if controlMain.robot_.Navigatting(target_id, entrance_streetNode, True, temp_wheel_base, task_flag) == False:
|
|
|
return False
|
|
|
|
|
|
#
|
|
@@ -404,9 +425,9 @@ class MainWindow(QMainWindow):
|
|
|
#
|
|
|
# threadPool = ThreadPoolExecutor(2)
|
|
|
# threadPool.submit(control1.robot_.Navigatting,
|
|
|
- # target_id, end_street, autoDirect, wheel_base)
|
|
|
+ # target_id, end_street, autoDirect, wheel_base, task_flag)
|
|
|
# threadPool.submit(control2.robot_.Navigatting,
|
|
|
- # target_id, end_street, autoDirect, wheel_base)
|
|
|
+ # target_id, end_street, autoDirect, wheel_base, task_flag)
|
|
|
# threadPool.shutdown(wait=True)
|
|
|
|
|
|
# 反馈
|
|
@@ -421,6 +442,7 @@ class MainWindow(QMainWindow):
|
|
|
|
|
|
def AutoPickTask(self, pick_table: message.pick_table = None):
|
|
|
print("AutoPickTask:---------------------\n")
|
|
|
+ task_flag = 2 # 取车
|
|
|
|
|
|
controlMain, control1, control2 = self.GetMainFrontBackAGV()
|
|
|
mainMap, frontMap, backMap = ["Main", "Front", "Back"]
|
|
@@ -433,61 +455,65 @@ class MainWindow(QMainWindow):
|
|
|
wheel_base = pick_table.actually_measure_info.measure_info_to_plc_forward.wheelbase
|
|
|
control1.WheelBaseEdit.setText(str(wheel_base))
|
|
|
control2.WheelBaseEdit.setText(str(wheel_base))
|
|
|
+
|
|
|
+ # # 双单车入库 -------------------------
|
|
|
+ # self.updateMap_pick(wheel_base)
|
|
|
+ # if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
+ # return False
|
|
|
+ # cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
+ # [label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
+ # control1.robot_.GeneratePath(label, space_id, frontMap)
|
|
|
+ # print("Front: begin:%s target:%s wheelBase:%f" % (label, space_id, wheel_base))
|
|
|
+ #
|
|
|
+ # cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
+ # [label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
+ # control2.robot_.GeneratePath(label, space_id, backMap)
|
|
|
+ # print("Back: begin:%s target:%s wheelBase:%f" % (label, space_id, wheel_base))
|
|
|
+ #
|
|
|
+ # autoDirect = True
|
|
|
+ # threadPool = ThreadPoolExecutor(2)
|
|
|
+ # features = [threadPool.submit(control1.robot_.Navigatting, label, space_id, autoDirect, wheel_base, task_flag),
|
|
|
+ # threadPool.submit(control2.robot_.Navigatting, label, space_id, autoDirect, wheel_base, task_flag)]
|
|
|
+ # if self.asyncExecute(features) == False:
|
|
|
+ # print(" Pick Failed ")
|
|
|
+ # return False
|
|
|
+
|
|
|
+ # # ------------------------------------------
|
|
|
+ # # 双单车驶至车位前巷道点
|
|
|
self.updateMap_pick(wheel_base)
|
|
|
- # 双单车入库
|
|
|
+ space_streetNode = space_id.replace("S_", "R_")
|
|
|
if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
return False
|
|
|
cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
[label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
- control1.robot_.GeneratePath(label, space_id, frontMap)
|
|
|
- print("Front: begin:%s target:%s wheelBase:%f" % (label, space_id, wheel_base))
|
|
|
+ control1.robot_.GeneratePath(label, space_streetNode, frontMap)
|
|
|
+ print("Front: begin:%s target:%s wheelBase:%f" % (label, space_streetNode, wheel_base))
|
|
|
|
|
|
cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
[label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
- control2.robot_.GeneratePath(label, space_id, backMap)
|
|
|
- print("Back: begin:%s target:%s wheelBase:%f" % (label, space_id, wheel_base))
|
|
|
+ control2.robot_.GeneratePath(label, space_streetNode, backMap)
|
|
|
+ print("Back: begin:%s target:%s wheelBase:%f" % (label, space_streetNode, wheel_base))
|
|
|
|
|
|
autoDirect = True
|
|
|
threadPool = ThreadPoolExecutor(2)
|
|
|
- features = [threadPool.submit(control1.robot_.Navigatting, label, space_id, autoDirect, wheel_base),
|
|
|
- threadPool.submit(control2.robot_.Navigatting, label, space_id, autoDirect, wheel_base)]
|
|
|
+ features = [
|
|
|
+ threadPool.submit(control1.robot_.Navigatting, label, space_streetNode, autoDirect, wheel_base, task_flag),
|
|
|
+ threadPool.submit(control2.robot_.Navigatting, label, space_streetNode, autoDirect, wheel_base, task_flag)
|
|
|
+ ]
|
|
|
if self.asyncExecute(features) == False:
|
|
|
print(" Pick Failed ")
|
|
|
return False
|
|
|
|
|
|
- # # ------------------------------------------
|
|
|
- # # 双单车驶至车位前巷道点
|
|
|
- # streetNode = space_id.replace("S_", "R_")
|
|
|
- # if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
|
|
|
- # return False
|
|
|
- # cur_pose1 = control1.robot_.timedRobotStatu_.statu
|
|
|
- # [label, pt] = self.mapManager.findNeastNode(frontMap, [cur_pose1.x, cur_pose1.y])
|
|
|
- # control1.robot_.GeneratePath(label, streetNode, frontMap)
|
|
|
- # print("Front: begin:%s target:%s wheelBase:%f" % (label, streetNode, wheel_base))
|
|
|
- #
|
|
|
- # cur_pose2 = control2.robot_.timedRobotStatu_.statu
|
|
|
- # [label, pt] = self.mapManager.findNeastNode(backMap, [cur_pose2.x, cur_pose2.y])
|
|
|
- # control2.robot_.GeneratePath(label, streetNode, backMap)
|
|
|
- # print("Back: begin:%s target:%s wheelBase:%f" % (label, streetNode, wheel_base))
|
|
|
- #
|
|
|
- # autoDirect = True
|
|
|
- # threadPool = ThreadPoolExecutor(2)
|
|
|
- # features = [threadPool.submit(control1.robot_.Navigatting, label, streetNode, autoDirect, wheel_base),
|
|
|
- # threadPool.submit(control2.robot_.Navigatting, label, streetNode, autoDirect, wheel_base)]
|
|
|
- # if self.asyncExecute(features) == False:
|
|
|
- # print(" Pick Failed ")
|
|
|
- # return False
|
|
|
- #
|
|
|
- # # 整车驶进车位---------------------------------
|
|
|
- # if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
|
|
|
- # return False
|
|
|
- #
|
|
|
- # map_name = "Front"
|
|
|
- # if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
- # map_name = "Back"
|
|
|
- # controlMain.robot_.GeneratePath(streetNode, space_id, map_name)
|
|
|
- # if controlMain.robot_.Navigatting(streetNode, space_id, True, wheel_base) == False:
|
|
|
- # return False
|
|
|
+ # 整车驶进车位---------------------------------
|
|
|
+ if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
|
|
|
+ return False
|
|
|
+
|
|
|
+ map_name = "Front"
|
|
|
+ if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
+ map_name = "Back"
|
|
|
+ controlMain.robot_.GeneratePath(space_streetNode, space_id, map_name)
|
|
|
+ if controlMain.robot_.Navigatting(space_streetNode, space_id, True, wheel_base, task_flag) == False:
|
|
|
+ return False
|
|
|
# # ---------------------------------
|
|
|
|
|
|
# 整车夹持------------------------------------
|
|
@@ -503,7 +529,7 @@ class MainWindow(QMainWindow):
|
|
|
map_name = "Back"
|
|
|
controlMain.robot_.GeneratePath(space_id, export_id, map_name)
|
|
|
print("Total: begin:%s target:%s wheelBase:%f" % (space_id, export_id, wheel_base))
|
|
|
- if controlMain.robot_.Navigatting(space_id, export_id, True, wheel_base) == False:
|
|
|
+ if controlMain.robot_.Navigatting(space_id, export_id, True, wheel_base, task_flag) == False:
|
|
|
return False
|
|
|
|
|
|
# 整车松夹池------------------------------------
|
|
@@ -520,9 +546,9 @@ class MainWindow(QMainWindow):
|
|
|
if controlMain.robot_.timedRobotStatu_.statu.theta < 0:
|
|
|
map_name = "Back"
|
|
|
|
|
|
- streetNode = export_id.replace("S_", "R_")
|
|
|
- controlMain.robot_.GeneratePath(export_id, streetNode, map_name)
|
|
|
- if controlMain.robot_.Navigatting(export_id, streetNode, True, temp_wheel_base) == False:
|
|
|
+ space_streetNode = export_id.replace("S_", "R_")
|
|
|
+ controlMain.robot_.GeneratePath(export_id, space_streetNode, map_name)
|
|
|
+ if controlMain.robot_.Navigatting(export_id, space_streetNode, True, temp_wheel_base, task_flag) == False:
|
|
|
return False
|
|
|
|
|
|
# 双单车出库
|
|
@@ -536,8 +562,10 @@ class MainWindow(QMainWindow):
|
|
|
# control2.robot_.GeneratePath(export_id, "B_exportLink", backMap)
|
|
|
#
|
|
|
# threadPool = ThreadPoolExecutor(2)
|
|
|
- # features=[threadPool.submit(control1.robot_.Navigatting,export_id, "F_exportLink", True, wheel_base),
|
|
|
- # threadPool.submit(control2.robot_.Navigatting,export_id, "B_exportLink", True, wheel_base)]
|
|
|
+ # features=[
|
|
|
+ # threadPool.submit(control1.robot_.Navigatting,export_id, "F_exportLink", True, wheel_base, task_flag),
|
|
|
+ # threadPool.submit(control2.robot_.Navigatting,export_id, "B_exportLink", True, wheel_base, task_flag)
|
|
|
+ # ]
|
|
|
# if self.asyncExecute(features) == False:
|
|
|
# print(" Pick Failed ")
|
|
|
# return False
|