Kaynağa Gözat

修改障碍物点数达标条件为20个点

zx 3 yıl önce
ebeveyn
işleme
e763c799e2

+ 55 - 53
build/setting/setting.prototxt

@@ -1,6 +1,8 @@
+#楚天项目B库配置文件
+
 plc_setting
 {	
-	ip:"192.168.0.81"
+	ip:"192.168.0.161"
 	dbnumber:9050
 	start_id:0
 }
@@ -10,82 +12,83 @@ entrance_parameter
 	lidars
 	{
 		
-		sncode:"3GGDJ8S00100921"
-		r:175.69
-		p:24.49
-		y:-83.43
-		tx:-1.2322
-		ty:0
-		tz:0
+		sncode:"3GGDJ9600100091"
+		r:1.30148
+		p:156.532
+		y:84.4213
+		tx:1.26102
+		ty:0.0123
+		tz:-0.01864
 		fps:5.0
 	}
 	lidars
 	{
 		
-		sncode:"3GGDJ8X00100541"
-		r:173.87
-		p:27.51
-		y:-98.23
-		tx:1.2677
-		ty:0.0109
-		tz:-0.013
+		sncode:"3GGDJ9600100671"
+		r:2.97929
+		p:155.07
+		y:96.0385
+		tx:-1.17089
+		ty:0.00796
+		tz:-0.00934
 		fps:5.0
 	}
 	
 	box
 	{
-		minx:-1.7
-		maxx:1.7
-		miny:-4.95
-		maxy:-0.18
-		minz:-1.59
+		minx:-1.35
+		maxx:1.41
+		miny:-5.76
+		maxy:0
+		minz:-2.95
 		maxz:0.4
 	}
 	verify_box1
 	{
-		minx:-1.20
-		maxx:-0.992
-		miny:-5.31
+		minx:1.01
+		maxx:1.21
+		miny:-5.560
 		maxy:-0.18
-		minz:-1.54
+		minz:-1.53
 		maxz:-0.1
 	}
 	verify_box2
 	{
-		minx:0.982
-		maxx:1.192
-		miny:-5.31
-		maxy:-0.33
-		minz:-1.54
+		minx:-1.15
+		maxx:-0.97
+		miny:-5.560
+		maxy:-0.18
+		minz:-1.53
 		maxz:-0.1
 	}
+	
 }
 
-
+#出口
 export_parameter
 {
 	lidars
 	{
 		
-		sncode:"3GGDJ8T00100171"
-		r:-169.23
-		p:27.71
-		y:81.1
-		tx:-1.17415
-		ty:0.018
-		tz:0.0196
+		sncode:"3GGDJ9600100211"
+		r:-176.061
+		p:26.0979
+		y:84.6403
+		tx:-1.1672
+		ty:0.056
+		tz:-0.044736
 		fps:5.0
 	}
 	lidars
 	{
 		
-		sncode:"3GGDJ8X00100481"
-		r:-176.71
-		p:22.5
-		y:100.82
-		tx:1.23285
-		ty:0
-		tz:0
+		sncode:"3GGDJ9600101051"
+		r:-178.143
+		p:26.6329
+		y:96.2658
+		tx:1.240727
+		ty:0.0299054
+		tz:-0.060195
 		fps:5.0
 	}
 	
@@ -100,19 +103,19 @@ export_parameter
 	}
 	verify_box1
 	{
-		minx:-1.20
-		maxx:-0.992
-		miny:0.15
-		maxy:4.91
+		minx:-1.14
+		maxx:-0.94
+		miny:0.25
+		maxy:5.5
 		minz:-1.53
 		maxz:-0.1
 	}
 	verify_box2
 	{
-		minx:0.982
-		maxx:1.192
-		miny:0.15
-		maxy:4.91
+		minx:1.00
+		maxx:1.25
+		miny:0.25
+		maxy:5.5
 		minz:-1.53
 		maxz:-0.1
 	}
@@ -120,4 +123,3 @@ export_parameter
 
 
 
-

+ 1 - 0
laser/lds_lidar.cpp

@@ -262,6 +262,7 @@ void LdsLidar::OnDeviceBroadcast(const BroadcastDeviceInfo *info)
 
     if(!g_snPtr.find(info->broadcast_code))
     {
+        printf(" can not find sn:%s in map\n",info->broadcast_code);
         return;
     }
 

+ 5 - 6
main.cpp

@@ -205,17 +205,16 @@ int main(int argc,char* argv[])
         buf.m_size=sizeof(plc_data);
         buf.m_start_index=setting_parameter.plc_setting().start_id();
         buf.mp_buf_reverse=&plc_data;
-        /*int result = m_snap7_client.AsDBWrite(snap7_buf.m_id, snap7_buf.m_start_index, snap7_buf.m_size,
-                                              snap7_buf.mp_buf_reverse);*/
 
-        //code=snap7_client.read_data_buf(buf);
         code=snap7_client.write_data_buf(buf);
-        /*unsigned short a;
-        memcpy(&a,buf.mp_buf_reverse,2);
-        printf("------------%d\n",bswap_16(a));*/
+
 
         if(code!=SUCCESS)
         {
+            snap7_client.communication_uninit();
+            usleep(500*1000);
+            snap7_client.communication_init(setting_parameter.plc_setting().ip());
+            usleep(500*1000);
             std::cout<<code<<std::endl;
         }
 

+ 5 - 1
plc/snap7_communication_base.cpp

@@ -293,7 +293,11 @@ Error_manager Snap7_communication_base::write_data_buf(Snap7_buf& snap7_buf)
 //		std::this_thread::sleep_for(std::chrono::milliseconds(10));
 		if ( result == 0 )
 		{
-			m_snap7_client.WaitAsCompletion(100);
+			if(0!=m_snap7_client.WaitAsCompletion(100))
+            {
+                return Error_manager(Error_code::SNAP7_WRITE_ERROR, Error_level::MINOR_ERROR,
+                                     " Snap7_communication_base::write_data_buf error ");
+            }
 		}
 		else
 		{

+ 4 - 1
safety_excutor.cpp

@@ -99,7 +99,10 @@ bool safety_excutor::verify(tagMeasureData& data)
     pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_warnning1=PassThroughCloud(cloud_inner,box1);
     pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_warnning2=PassThroughCloud(cloud_inner,box2);
 
-    bool safe1=(cloud_warnning1->size()<=5),safe2=((cloud_warnning2->size()<=5));
+
+    bool safe1=(cloud_warnning1->size()<=20),safe2=((cloud_warnning2->size()<=20));
+    //std::cout<<"  v1:"<<cloud_warnning1->size()<<"      v2:"<<cloud_warnning2->size()<<std::endl;
+
     data.wheel_path_safety=(unsigned short)(safe1&safe2&connected);
 
     shutter::box_param box_parkspace,box_left,box_right;