Browse Source

20221116, huli test

yct 2 years ago
parent
commit
8566479e11

+ 4 - 4
入口引导提示节点/ui_config.json

@@ -1,8 +1,8 @@
 {
   "db": {"ip": "192.168.1.233","port": 3306,"database": "ct_project","user": "zx","password": "zx123456"},
   "rabbitmq": {"ip":"192.168.1.233","port":5672,"user":"zx","password":"zx123456"},
-  "led": {"ip": "192.168.1.161","port": 5005},
-  "entrance_id": 2,
+  "led": {"ip": "192.168.1.160","port": 5005},
+  "entrance_id": 1,
   "unit":1,
-  "prj": {"ip": "192.168.1.191","port": 4352,"type": 0}
-}
+  "prj": {"ip": "192.168.1.190","port": 4352,"type": 1}
+}

+ 18 - 4
出口单片机节点/DatabaseSearchPickCmd.py

@@ -1,6 +1,8 @@
 import time
 import pymysql as psql
 import message_pb2 as message
+import threading
+
 class DBSeacherPickCmd():
     def __init__(self,ip,port,database,user,password):
         self.ip=ip
@@ -16,6 +18,8 @@ class DBSeacherPickCmd():
                                charset="utf8",
                                user=user,
                                passwd=password)
+        self._lock = threading.Lock()
+
 
     def close(self):
         self._close=True
@@ -25,20 +29,30 @@ class DBSeacherPickCmd():
         self.conn.begin()
         cursor=self.conn.cursor()
         SQL="select * from command_queue where statu=2 "    #寻找已到出口的取车指令
+        self._lock.acquire()
         cursor.execute(SQL)
+        self._lock.release()
         pick_cmds=cursor.fetchall()
-        self.conn.commit()
+
         cursor.close()
+        self.conn.commit()
 
         return pick_cmds
 
     def delete_cmd(self,id):
         self.conn.begin()
         cursor=self.conn.cursor()
-        SQL="delete from command_queue where statu=2 and export_id=%d"%id
-        cursor.execute(SQL)
-        self.conn.commit()
+        SQL1="select * from command_queue for update"
+        self._lock.acquire()
+        cursor.execute(SQL1)
+        self._lock.release()
+        SQL2="delete from command_queue where statu=2 and export_id=%d"%id
+        self._lock.acquire()
+        cursor.execute(SQL2)
+        self._lock.release()
+
         cursor.close()
+        self.conn.commit()
 
 '''
     def run(self):

+ 20 - 1
出口单片机节点/ExportIO.py

@@ -95,10 +95,17 @@ class ExportIO(threading.Thread):
         print("Connected to {}:{}".format(self._ip, self._port))
         return reader, writer
     async def recv_loop(self):
+        if (self._id == 5):
+            print(" test 1 ")
         while self._close==False:
+            if (self._id == 5):
+                print(" test 2 ")
             try:
                 recieve=await self._reader.readuntil(b'$')
+                if (self._id == 5):
+                    print(" 00 recieve = " + str(recieve))
             except Exception as e:
+                print("self._reader.readuntil(b'$') error")
                 print("  e: {}".format(e))
                 self._reader,self._writer=await self.connect()
                 await asyncio.sleep(0.001)
@@ -113,16 +120,24 @@ class ExportIO(threading.Thread):
                 self._latest_iomsg =self.recieve2message(bytes)
                 if (not self._rabbit_mq == None) and (not self._latest_iomsg == None):
                     if self._latest_iomsg.outside_safety == 0 or self._latest_iomsg.door_statu == 0:
+                        print("self._latest_iomsg error")
                         continue
                     else:
+                        if (self._id == 5):
+                            print(" 11 recieve = " + str(recieve))
                         ex_name = "statu_ex"
                         key = "out_mcpu_%d_statu_port" % self._id
                         self._rabbit_mq.publish(ex_name, key, tf.MessageToString(self._latest_iomsg, as_utf8=True))
+                else:
+                    print("self._rabbit_mq")
+                    print(self._rabbit_mq)
+                    print("self._latest_iomsg")
+                    print(self._latest_iomsg)
             else:
                 print(" start_index = %s"%start_index)
                 print("end_index = %s"%end_index)
                 print("WARNING : mcpu recieve format error , time = %s"%time.time())
-                print("  recieve = " + str(recieve))
+                print(" 22 recieve = " + str(recieve))
                 await asyncio.sleep(0)
 
                 continue
@@ -160,11 +175,15 @@ class ExportIO(threading.Thread):
         if 'InsideExistenceFlag' in data.keys():
             statu_msg.outside_safety = data['InsideExistenceFlag'] + 1
         else:
+            print("statu_msg.outside_safety not live")
+            print(bytes)
             statu_msg.outside_safety = 0
 
         if 'OutsideDoorStatus' in data.keys():
             statu_msg.door_statu = data["OutsideDoorStatus"] + 1  # 1 k  2g 3 running
         else:
+            print("statu_msg.door_statu not live ")
+            print(bytes)
             statu_msg.door_statu = 0
 
         return statu_msg

+ 5 - 2
指令检查节点/CheckCommand.py

@@ -38,6 +38,9 @@ class CheckCommand():
     def check_pick_command(self, msg):
         pick = message.park_table()
         tf.Parse(msg, pick)
+        if pick.primary_key is not None:
+            return tf.MessageToString(pick, as_utf8=True)
+            
         unit_id = pick.unit_id
         if pick.primary_key is None:
             pick.statu.execute_statu = message.eError
@@ -92,7 +95,7 @@ class CheckCommand():
             im_mcpu_statu = message.in_mcpu_statu()
             tf.Parse(g_rabbitmq[key].statu,im_mcpu_statu)
             results = ""
-            if im_mcpu_statu.back_io != 1:
+            if im_mcpu_statu.back_io != 2:
                 results = results + "车辆后超界!"
             if im_mcpu_statu.is_occupy != 2:
                 results = results + "库位无车!"
@@ -126,4 +129,4 @@ class CheckCommand():
             return 1.90
 
 
-check_command = CheckCommand()
+check_command = CheckCommand()

File diff suppressed because it is too large
+ 24 - 14
指令检查节点/message_pb2.py


+ 5 - 5
测量节点/setting/velodyne_manager.prototxt

@@ -23,7 +23,7 @@ velodyne_lidars
     {
          r:-0.276397
          p:-0.11717
-         y:88.703  #89.6003
+         y:91.572  # 88.703 #89.6003
          cz:0.05467
         #r:-0.623165
         #p:0.601821
@@ -179,7 +179,7 @@ region
 	maxx:1.6
 	miny:-2.6
 	maxy:2.6
-	minz:0.025
+	minz:0.025 # 0.025
 	maxz:0.5
     region_id:5
     turnplate_cx:0.0
@@ -203,8 +203,8 @@ region
         lidar_id:6
         calib
         {
-            cx:1.89004
-            cy:0
+            cx:1.92004
+            cy:-0.03
         }
     }
     lidar_exts
@@ -475,4 +475,4 @@ region
             cy:0.01367
         }
     }
-}
+}

File diff suppressed because it is too large
+ 684 - 245
测量节点/setting/wanji_manager.prototxt


+ 4 - 0
测量节点/wanji_lidar/detect_wheel_ceres.cpp

@@ -546,6 +546,10 @@ void detect_wheel_ceres::create_mark(double x,double y,double theta,pcl::PointCl
 
 bool detect_wheel_ceres::Solve(Detect_result &detect_result, double &avg_loss)
 {
+    if(m_left_front_cloud.size()<=1 || m_right_front_cloud.size()<=1 || m_left_rear_cloud.size()<=1 || m_right_rear_cloud.size()<=1)
+    {
+        return false;
+    }
     double SCALE=300.0;
     double cx=detect_result.cx;
     double cy=detect_result.cy;