Browse Source

1.更新PLC反馈通信协议
2.147车位点矫正
3.手动位移速度增大
4.存取车子流程可获取执行结果

gf 1 year ago
parent
commit
7f5f1a32e2
3 changed files with 44 additions and 42 deletions
  1. 1 1
      RobotData.py
  2. 1 1
      count.json
  3. 42 40
      test.py

+ 1 - 1
RobotData.py

@@ -461,7 +461,7 @@ class Robot(MqttAsync):
         channel = grpc.insecure_channel(self.rpc_ipport_)
         stub = msg_rpc.NavExcutorStub(channel)
         response = stub.Start(cmd)
-        return False
+        return True
 
     def IsClampClosed(self):
         if self.timedRobotStatu_.timeout() == False:

+ 1 - 1
count.json

@@ -1 +1 @@
-{"load_count": 876, "single_count": 2692}
+{"load_count": 885, "single_count": 2722}

+ 42 - 40
test.py

@@ -328,11 +328,7 @@ class MainWindow(QMainWindow):
         trans_x += wheel_base / 2 * math.cos(trans_a)
         trans_y += wheel_base / 2 * math.sin(trans_a)
 
-        threadPool = ThreadPoolExecutor(2)
-        features = [threadPool.submit(control1.robot_.SwitchMoveMode, 0, wheel_base),
-                    threadPool.submit(control2.robot_.SwitchMoveMode, 0, wheel_base)]
-        if self.asyncExecute(features) == False:
-            print(" Park Failed ")
+        if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
             return False
 
         # # 双单车入库-----------------------------------------------------
@@ -363,7 +359,8 @@ class MainWindow(QMainWindow):
 
         print(" input entrance completed!!!!")
 
-        controlMain.robot_.SwitchMoveMode(1, wheel_base)
+        if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
+            return False
         controlMain.robot_.ClampClose()
 
         # 整车入库---------------------------------
@@ -383,9 +380,8 @@ class MainWindow(QMainWindow):
         threadPool = ThreadPoolExecutor(1)
         threadPool.submit(controlMain.robot_.ClampOpen)
         threadPool.shutdown(wait=True)
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.SwitchMoveMode, 0, wheel_base)
-        threadPool.shutdown(wait=True)
+        if (controlMain.robot_.SwitchMoveMode(0, wheel_base) == False):
+            return False
 
         # 双单车出库
         self.ReLoadMap(frontMap, "./map.json")
@@ -455,10 +451,8 @@ class MainWindow(QMainWindow):
         control2.WheelBaseEdit.setText(str(wheel_base))
 
         # 双单车入库
-        threadPool = ThreadPoolExecutor(2)
-        threadPool.submit(control1.robot_.SwitchMoveMode, 0, wheel_base)
-        threadPool.submit(control2.robot_.SwitchMoveMode, 0, wheel_base)
-        threadPool.shutdown(wait=True)
+        if(controlMain.robot_.SwitchMoveMode(0, wheel_base)==False):
+            return False
 
         self.ReLoadMap(frontMap, "./map.json")
         self.updateMap_pick(export_id, frontMap)
@@ -476,20 +470,19 @@ class MainWindow(QMainWindow):
 
         autoDirect = True
         threadPool = ThreadPoolExecutor(2)
-        threadPool.submit(control1.robot_.Navigatting,
-                          label, space_id, autoDirect, wheel_base)
-        threadPool.submit(control2.robot_.Navigatting,
-                          label, space_id, autoDirect, wheel_base)
-        threadPool.shutdown(wait=True)
+        features=[threadPool.submit(control1.robot_.Navigatting,label, space_id, autoDirect, wheel_base),
+                    threadPool.submit(control2.robot_.Navigatting,label, space_id, autoDirect, wheel_base)]
+        if self.asyncExecute(features) == False:
+            print(" Pick Failed ")
+            return False
 
         # 整车夹持------------------------------------
         print(" input space completed!!!!")
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.SwitchMoveMode, 1, wheel_base)
-        threadPool.shutdown(wait=True)
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.ClampClose)
-        threadPool.shutdown(wait=True)
+        if (controlMain.robot_.SwitchMoveMode(1, wheel_base) == False):
+            return False
+        if controlMain.robot_.ClampClose()==False:
+            return False
+
 
         # 整车到出口---------------------------------
         map_name = "Front"
@@ -501,22 +494,31 @@ class MainWindow(QMainWindow):
         controlMain.robot_.GeneratePath(space_id, export_id, map_name)
         print("Total: begin:%s   target:%s    wheelBase:%f" % (space_id, export_id, wheel_base))
 
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.Navigatting,
-                          space_id, export_id, True, wheel_base)
-        threadPool.shutdown(wait=True)
+
+        if controlMain.robot_.Navigatting(space_id, export_id, True, wheel_base)==False:
+            return False
 
         # 整车松夹池------------------------------------
 
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.ClampOpen)
-        threadPool.shutdown(wait=True)
-        threadPool = ThreadPoolExecutor(1)
-        threadPool.submit(controlMain.robot_.SwitchMoveMode, 0, wheel_base)
-        threadPool.shutdown(wait=True)
+        if controlMain.robot_.ClampOpen()==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"
+        self.ReLoadMap(map_name, "./map.json")
+        self.updateMap_pick(export_id, map_name)
+        streetNode= "F_exportLink" if map_name=="Front" else "B_exportLink"
+        controlMain.robot_.GeneratePath(export_id, streetNode, map_name)
+        if controlMain.robot_.Navigatting(export_id,streetNode,True,wheel_base)==False:
+            return False
+
 
         # 双单车出库
-        controlMain, control1, control2 = self.GetMainFrontBackAGV()
+        '''controlMain, control1, control2 = self.GetMainFrontBackAGV()
         self.ReLoadMap(frontMap, "./map.json")
         self.updateMap_pick(export_id, frontMap)
         control1.robot_.GeneratePath(export_id, "F_exportLink", frontMap)
@@ -526,11 +528,11 @@ class MainWindow(QMainWindow):
         control2.robot_.GeneratePath(export_id, "B_exportLink", backMap)
 
         threadPool = ThreadPoolExecutor(2)
-        threadPool.submit(control1.robot_.Navigatting,
-                          export_id, "F_exportLink", True, wheel_base)
-        threadPool.submit(control2.robot_.Navigatting,
-                          export_id, "B_exportLink", True, wheel_base)
-        threadPool.shutdown(wait=True)
+        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)]
+        if self.asyncExecute(features) == False:
+            print(" Pick Failed ")
+            return False'''
 
         # 反馈
         self.g_rabbitmq.publish("command_ex", "agv_pick_command_response_port",