Browse Source

0926 merge to chutian

yct 2 years ago
parent
commit
881b5b1b88
100 changed files with 819 additions and 815 deletions
  1. 0 0
      .gitignore
  2. 6 6
      CMakeLists.txt
  3. 0 0
      communication/communication.pb.cc
  4. 0 0
      communication/communication.pb.h
  5. 0 0
      communication/communication.proto
  6. 0 0
      communication/communication_message.cpp
  7. 0 0
      communication/communication_message.h
  8. 0 0
      communication/communication_message.h.orig
  9. 0 0
      communication/communication_socket_base.cpp
  10. 0 0
      communication/communication_socket_base.cpp.orig
  11. 0 0
      communication/communication_socket_base.h
  12. 0 0
      communication/communication_socket_base.h.orig
  13. 24 9
      main.cpp
  14. 0 0
      message/UnNormalized_module_message.proto
  15. 0 0
      message/central_control_message.proto
  16. 0 0
      message/dispatch_control.proto
  17. 0 0
      message/dispatch_message.proto
  18. 0 0
      message/log_process.proto
  19. 0 0
      message/measure_message.pb.cc
  20. 0 0
      message/measure_message.pb.h
  21. 0 0
      message/measure_message.proto
  22. 0 0
      message/message_base.pb.cc
  23. 0 0
      message/message_base.pb.h
  24. 0 0
      message/message_base.proto
  25. 0 0
      message/notify_message.proto
  26. 0 0
      message/parkspace_allocation_message.proto
  27. 0 0
      message/process_message.proto
  28. 0 0
      message/singlechip_msg.proto
  29. 0 0
      message/terminal_message.proto
  30. 0 0
      setting/VLP16db.yaml
  31. 0 0
      setting/calib/0back_pole.txt
  32. 0 0
      setting/calib/0front_pole.txt
  33. 0 0
      setting/calib/1back_pole.txt
  34. 0 0
      setting/calib/1front_pole.txt
  35. 0 0
      setting/calib/2back_pole.txt
  36. 0 0
      setting/calib/2front_pole.txt
  37. 0 0
      setting/calib/3back_pole.txt
  38. 0 0
      setting/calib/3front_pole.txt
  39. 2 2
      setting/communication.prototxt
  40. 0 0
      setting/limit.prototxt
  41. 2 2
      setting/velodyne_manager.prototxt
  42. 0 0
      setting/velodyne_manager_chutian.prototxt
  43. 0 0
      setting/velodyne_manager_puai_26x.prototxt
  44. 0 0
      setting/velodyne_manager_puai_env.prototxt
  45. 0 0
      setting/wanji_lidar.prototxt
  46. 220 377
      setting/wanji_manager.prototxt
  47. 0 0
      system/system_communication.cpp
  48. 0 0
      system/system_communication.h
  49. 484 357
      system/system_executor.cpp
  50. 14 1
      system/system_executor.h
  51. 0 0
      tests/lidar_calib_tools.cpp
  52. 0 0
      tests/region_4_26x.txt
  53. 0 0
      tests/region_4_26x_g.txt
  54. 0 0
      tests/region_4_env.txt
  55. 0 0
      tests/region_4_env_g.txt
  56. 0 0
      tests/vlp16_driver_test.cpp
  57. 0 0
      tool/common_data.cpp
  58. 0 0
      tool/common_data.h
  59. 0 0
      velodyne_lidar/icp_svd_registration.cpp
  60. 0 0
      velodyne_lidar/icp_svd_registration.hpp
  61. 0 0
      tool/measure_filter.h
  62. 0 0
      tool/pathcreator.cpp
  63. 0 0
      tool/pathcreator.h
  64. 0 0
      tool/pcl_cloud_with_lock.cpp
  65. 0 0
      tool/pcl_cloud_with_lock.h
  66. 0 0
      tool/point2D_tool.cpp
  67. 0 0
      tool/point2D_tool.h
  68. 0 0
      tool/point3D_tool.cpp
  69. 0 0
      tool/point3D_tool.h
  70. 0 0
      tool/proto_tool.cpp
  71. 0 0
      tool/proto_tool.h
  72. 0 0
      velodyne_lidar/region_status_checker.h
  73. 1 1
      tool/rotate_center_caliber.cpp
  74. 0 0
      tool/singleton.cpp
  75. 0 0
      tool/singleton.h
  76. 0 0
      tool/thread_pool.h
  77. 0 0
      tool/thread_safe_list.cpp
  78. 0 0
      tool/thread_safe_list.h
  79. 0 0
      tool/time_tool.cpp
  80. 0 0
      tool/time_tool.h
  81. 1 1
      velodyne_lidar/car_pose_detector.cpp
  82. 0 0
      velodyne_lidar/car_pose_detector.h
  83. 27 22
      velodyne_lidar/ground_region.cpp
  84. 1 1
      velodyne_lidar/ground_region.h
  85. 0 0
      velodyne_lidar/velodyne_config.pb.cc
  86. 0 0
      velodyne_lidar/velodyne_config.pb.h
  87. 0 0
      velodyne_lidar/velodyne_config.proto
  88. 0 0
      velodyne_lidar/velodyne_driver/calibration.cc
  89. 0 0
      velodyne_lidar/velodyne_driver/calibration.h
  90. 0 0
      velodyne_lidar/velodyne_driver/input.cc
  91. 0 0
      velodyne_lidar/velodyne_driver/input.h
  92. 0 0
      velodyne_lidar/velodyne_driver/rawdata.cc
  93. 0 0
      velodyne_lidar/velodyne_driver/rawdata.h
  94. 4 12
      velodyne_lidar/velodyne_driver/velodyne_lidar_device.cpp
  95. 0 0
      velodyne_lidar/velodyne_driver/velodyne_lidar_scan_task.cpp
  96. 0 0
      velodyne_lidar/velodyne_driver/velodyne_lidar_scan_task.h
  97. 0 0
      velodyne_lidar/velodyne_manager.cpp
  98. 0 0
      velodyne_lidar/velodyne_manager.h
  99. 33 24
      wanji_lidar/detect_wheel_ceres.cpp
  100. 0 0
      wanji_lidar/region_detect.cpp

+ 0 - 0
.gitignore


+ 6 - 6
CMakeLists.txt

@@ -2,7 +2,7 @@ project(measure_wj_proj)
 
 cmake_minimum_required(VERSION 3.5)
 
-set (CMAKE_CXX_STANDARD 11)
+set (CMAKE_CXX_STANDARD 14)
 set(CMAKE_BUILD_TYPE "Release")
 
 # set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
@@ -27,7 +27,7 @@ endif(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5")
 
 #other libs
 FIND_PACKAGE(Protobuf REQUIRED)
-FIND_PACKAGE(Glog REQUIRED)
+# FIND_PACKAGE(Glog REQUIRED)
 FIND_PACKAGE(OpenCV REQUIRED)
 FIND_PACKAGE(PCL REQUIRED)
 FIND_PACKAGE(Ceres REQUIRED)
@@ -86,8 +86,8 @@ add_executable(measure_wj
 		)
 
 target_link_libraries(measure_wj
-        /usr/local/lib/libglog.a
-        /usr/local/lib/libgflags.a
+        /usr/lib/x86_64-linux-gnu/libglog.so
+        /usr/lib/x86_64-linux-gnu/libgflags.so
         nnxx
         nanomsg
 
@@ -122,8 +122,8 @@ ${VELODYNE_LIDAR_DRIVER}
 ${VELODYNE_LIDAR}
 )
 target_link_libraries(vlp16 
-/usr/local/lib/libglog.a
-/usr/local/lib/libgflags.a
+/usr/lib/x86_64-linux-gnu/libglog.so
+/usr/lib/x86_64-linux-gnu/libgflags.so
 nnxx
 nanomsg
 

+ 0 - 0
communication/communication.pb.cc


+ 0 - 0
communication/communication.pb.h


+ 0 - 0
communication/communication.proto


+ 0 - 0
communication/communication_message.cpp


+ 0 - 0
communication/communication_message.h


+ 0 - 0
communication/communication_message.h.orig


+ 0 - 0
communication/communication_socket_base.cpp


+ 0 - 0
communication/communication_socket_base.cpp.orig


+ 0 - 0
communication/communication_socket_base.h


+ 0 - 0
communication/communication_socket_base.h.orig


+ 24 - 9
main.cpp

@@ -90,15 +90,28 @@ int main(int argc,char* argv[])
 	}
 	std::cout << " huli test :::: " << " t_terminal_id = " << t_terminal_id << std::endl;
 
+	Error_manager ec;
+
 	// 初始化
-	// Wanji_manager::get_instance_references().wanji_manager_init();
-	// std::cout << "wanji_manager = " << Wanji_manager::get_instance_references().check_status().to_string() << std::endl;
-	Error_manager ec = Velodyne_manager::get_instance_references().velodyne_manager_init(t_terminal_id);
-	std::cout << "veodyne_manager = " << Velodyne_manager::get_instance_references().check_status().to_string() << std::endl;
-	if(ec != SUCCESS)
+	if(WJ_VELO == 0 || WJ_VELO == 2)
 	{
-		LOG(ERROR) << "velodyne_manager init failed: " << ec.to_string();
-		return -1;
+		Wanji_manager::get_instance_references().wanji_manager_init(t_terminal_id);
+		std::cout << "wanji_manager = " << Wanji_manager::get_instance_references().check_status().to_string() << std::endl;
+		if (ec != SUCCESS)
+		{
+			LOG(ERROR) << "wanji_manager init failed: " << ec.to_string();
+			return -1;
+		}
+	}
+	if(WJ_VELO == 1 || WJ_VELO == 2)
+	{
+		ec = Velodyne_manager::get_instance_references().velodyne_manager_init(t_terminal_id);
+		std::cout << "veodyne_manager = " << Velodyne_manager::get_instance_references().check_status().to_string() << std::endl;
+		if (ec != SUCCESS)
+		{
+			LOG(ERROR) << "velodyne_manager init failed: " << ec.to_string();
+			return -1;
+		}
 	}
 
 	ec = System_executor::get_instance_references().system_executor_init(4, t_terminal_id);
@@ -151,8 +164,10 @@ int main(int argc,char* argv[])
 	// 反初始化
 	System_communication::get_instance_references().communication_uninit();
 	System_executor::get_instance_references().system_executor_uninit();
-	// Wanji_manager::get_instance_references().wanji_manager_uninit();
-	Velodyne_manager::get_instance_references().Velodyne_manager_uninit();
+	if(WJ_VELO == 0 || WJ_VELO == 2)
+		Wanji_manager::get_instance_references().wanji_manager_uninit();
+	if(WJ_VELO == 1 || WJ_VELO == 2)
+		Velodyne_manager::get_instance_references().Velodyne_manager_uninit();
 
 	return 0;
 }

+ 0 - 0
message/UnNormalized_module_message.proto


+ 0 - 0
message/central_control_message.proto


+ 0 - 0
message/dispatch_control.proto


+ 0 - 0
message/dispatch_message.proto


+ 0 - 0
message/log_process.proto


+ 0 - 0
message/measure_message.pb.cc


+ 0 - 0
message/measure_message.pb.h


+ 0 - 0
message/measure_message.proto


+ 0 - 0
message/message_base.pb.cc


+ 0 - 0
message/message_base.pb.h


+ 0 - 0
message/message_base.proto


+ 0 - 0
message/notify_message.proto


+ 0 - 0
message/parkspace_allocation_message.proto


+ 0 - 0
message/process_message.proto


+ 0 - 0
message/singlechip_msg.proto


+ 0 - 0
message/terminal_message.proto


+ 0 - 0
setting/VLP16db.yaml


+ 0 - 0
setting/calib/0back_pole.txt


+ 0 - 0
setting/calib/0front_pole.txt


+ 0 - 0
setting/calib/1back_pole.txt


+ 0 - 0
setting/calib/1front_pole.txt


+ 0 - 0
setting/calib/2back_pole.txt


+ 0 - 0
setting/calib/2front_pole.txt


+ 0 - 0
setting/calib/3back_pole.txt


+ 0 - 0
setting/calib/3front_pole.txt


+ 2 - 2
setting/communication.prototxt

@@ -3,8 +3,8 @@
 communication_parameters
 {
 
-  bind_string:"tcp://192.168.1.233:30010"
-  connect_string_vector:"tcp://192.168.1.233:30000"
+  bind_string:"tcp://127.0.0.1:30010"
+  # connect_string_vector:"tcp://127.0.0.1:30000"
  # connect_string_vector:"tcp://192.168.2.166:9002"
 
   # connect_string_vector:"tcp://192.168.2.125:9876"

+ 0 - 0
setting/limit.prototxt


+ 2 - 2
setting/velodyne_manager.prototxt

@@ -1,7 +1,7 @@
 fence_data_path:"/home/zx/data/ground_detect/"
 #fence_log_path:"/home/zx/yct/MainStructure/new_electronic_fence/log"
-left_model_path:"/home/zx/yct/chutian_measure_2021/setting/left_model.txt"
-right_model_path:"/home/zx/yct/chutian_measure_2021/setting/right_model.txt"
+left_model_path:"/home/yct/Documents/ierobot/measure/puai_wj_2021/setting/left_model.txt"
+right_model_path:"/home/yct/Documents/ierobot/measure/puai_wj_2021/setting/right_model.txt"
 distribution_mode:false
 
 #-----------------------------------lidars, id 0-6 from A1-C2

+ 0 - 0
setting/velodyne_manager_chutian.prototxt


+ 0 - 0
setting/velodyne_manager_puai_26x.prototxt


+ 0 - 0
setting/velodyne_manager_puai_env.prototxt


+ 0 - 0
setting/wanji_lidar.prototxt


+ 220 - 377
setting/wanji_manager.prototxt

@@ -1,269 +1,6 @@
 fence_data_path:"/home/zx/data/fence_wj"
 #fence_log_path:"/home/zx/yct/MainStructure/new_electronic_fence/log"
-
-#1
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.201"
-        port:2112
-    }
-    transform
-    {
-        m00:-0.100059
-		m01:0.9949814
-		m02:-1.470
-		m10:0.9949814
-		m11:0.1000593
-		m12:-2.285
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#2
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.202"
-        port:2112
-    }
-    transform
-    {
-        m00:-0.0123952
-		m01:-0.9999232
-		m02:1.851
-		m10:-0.9999232
-		m11:0.0123952
-		m12:3.48100000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#3
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.203"
-        port:2112
-    }
-    transform
-    {
-        m00:0.0108588
-		m01:0.9999409
-		m02:5.229
-		m10:0.9999409
-		m11:-0.0108588
-		m12:-2.3500000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#4
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.204"
-        port:2112
-    }
-    transform
-    {
-        m00:0.0549574
-		m01:-0.9984888
-		m02:8.717
-		m10:-0.9984888
-		m11:-0.0549574
-		m12:3.54400000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#5
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.205"
-        port:2112
-    }
-    transform
-    {
-    	m00:-0.0196446
-		m01:0.9998069
-		m02:12.136
-		m10:0.9998069
-		m11:0.0196446
-		m12:-2.3190000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#6
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.206"
-        port:2112
-    }
-    transform
-    {
-        m00:0.085926
-		m01:-0.9963016
-		m02:15.675
-		m10:-0.9963016
-		m11:-0.0859263
-		m12:3.48400000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#7
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.207"
-        port:2112
-    }
-    transform
-    {
-        m00:-0.0609897
-		m01:0.9981384
-		m02:19.069
-		m10:0.9981384
-		m11:0.0609897
-		m12:-2.3750000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
-
-#8
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.208"
-        port:2112
-    }
-    transform
-    {
-        m00:0.0473273
-		m01:-0.9988794
-		m02:-1.398
-		m10:-0.9988794
-		m11:-0.0473273
-		m12:3.35600000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:4
-    }
-}
+distribution_mode:false
 
 #9
 wj_lidar
@@ -276,7 +13,7 @@ wj_lidar
     range_max:30
     net_config
     {
-        ip_address:"192.168.2.209"
+        ip_address:"192.168.1.219"
         port:2112
     }
     transform
@@ -296,6 +33,7 @@ wj_lidar
         miny:-4
         maxy:4
     }
+    lidar_id:8
 }
 
 #10
@@ -309,7 +47,7 @@ wj_lidar
     range_max:30
     net_config
     {
-        ip_address:"192.168.2.210"
+        ip_address:"192.168.1.220"
         port:2112
     }
     transform
@@ -329,6 +67,7 @@ wj_lidar
         miny:-4
         maxy:4
     }
+    lidar_id:9
 }
 
 #11
@@ -342,7 +81,7 @@ wj_lidar
     range_max:30
     net_config
     {
-        ip_address:"192.168.2.211"
+        ip_address:"192.168.1.221"
         port:2112
     }
     transform
@@ -362,6 +101,7 @@ wj_lidar
         miny:-4
         maxy:3.2
     }
+    lidar_id:10
 }
 
 #12
@@ -375,7 +115,7 @@ wj_lidar
     range_max:30
     net_config
     {
-        ip_address:"192.168.2.212"
+        ip_address:"192.168.1.222"
         port:2112
     }
     transform
@@ -395,122 +135,225 @@ wj_lidar
         miny:-4
         maxy:4
     }
+    lidar_id:11
 }
 
-#13
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.213"
-        port:2112
-    }
-    transform
-    {
-        m00:-0.0459619
-		m01:0.9989432
-		m02:15.555
-		m10:0.9989432
-		m11:0.0459619
-		m12:-2.5410000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5.5
-        miny:-4
-        maxy:3.25
-    }
-}
+# #1
+# regions
+# {
+# 	minx:-0.7
+# 	maxx:1.8
+# 	miny:-2.43
+# 	maxy:3.3
+# }
+# #2
+# regions
+# {
+# 	minx:2.5
+# 	maxx:5.2
+# 	miny:-2.4
+# 	maxy:3.43
+# }
+# #3
+# regions
+# {
+# 	minx:5.4
+# 	maxx:8.7
+# 	miny:-2.40
+# 	maxy:3.43
+# }
 
-#14
-wj_lidar
-{
-    angle_min:-2.35619449
-    angle_max:2.35619449
-    angle_increment:0.00582
-    time_increment:0.000062
-    range_min:0
-    range_max:30
-    net_config
-    {
-        ip_address:"192.168.2.214"
-        port:2112
-    }
-    transform
-    {
-        m00:-0.1357627
-		m01:-0.9907414
-		m02:18.616
-		m10:-0.9907414
-		m11:0.1357627
-		m12:3.48700000
-    }
-    scan_limit
-    {
-        dist_limit:8
-        minx:0.1
-        maxx:5
-        miny:-4
-        maxy:4
-    }
-}
+# #4
+# regions
+# {
+#     # minx:8.7
+#     # maxx:12
+#     minx:-1.5
+#     maxx:1.5
+#     miny:-2.40
+#     maxy:3.45
 
+#     minz:0.025
+# 	maxz:0.5
+#     region_id:3
+#     turnplate_cx:0.0
+#     turnplate_cy:0.0
+#     border_minx:-1.3
+#     border_maxx:1.3
+#     plc_offsetx:0.0
+#     plc_offsety:0.0
+#     plc_offset_degree:0.0
+#     plc_border_miny:-7.51
+#     car_min_width:1.55
+#     car_max_width:1.95
+#     car_min_wheelbase:2.3
+#     car_max_wheelbase:3.15
+#     turnplate_angle_limit_anti_clockwise:5.3
+#     turnplate_angle_limit_clockwise:5.3
 
-#1
-regions
-{
-	minx:-0.7
-	maxx:1.8
-	miny:-2.43
-	maxy:3.3
-}
+#     lidar_exts
+#     {
+#         lidar_id:3
+#         calib
+#         {
+#             cx:-14.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:4
+#         calib
+#         {
+#             cx:-14.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:10
+#         calib
+#         {
+#             cx:-14.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:11
+#         calib
+#         {
+#             cx:-14.3
+#             cy:0.0
+#         }
+#     }
+# }
 
-#2
-regions
-{
-	minx:2.5
-	maxx:5.2
-	miny:-2.4
-	maxy:3.43
-}
-
-#3
-regions
-{
-	minx:5.4
-	maxx:8.7
-	miny:-2.40
-	maxy:3.43
-}
-#4
-regions
-{
-    minx:8.7
-    maxx:12
-    miny:-2.40
-    maxy:3.45
-}
 #5
 regions
 {
-    minx:12.1
-    maxx:15.4
-    miny:-2.40
-    maxy:3.45
-}
-#6
-regions
-{
-    minx:15.8
-    maxx:18.8
-    miny:-2.40
-    maxy:3.45
+    minx:-1.6
+	maxx:1.6
+	miny:-2.6
+	maxy:2.6
+	minz:0.025
+	maxz:0.5
+    region_id:5
+    turnplate_cx:0.0
+    turnplate_cy:0.0
+    border_minx:-1.2
+    border_maxx:1.2
+    plc_offsetx:1.913
+    plc_offsety:-6.078
+    plc_offset_degree:-89.5
+    plc_border_miny:-7.51
+    car_min_width:1.55
+    car_max_width:1.92
+    car_min_wheelbase:2.3
+    car_max_wheelbase:3.15
+    turnplate_angle_limit_anti_clockwise:5.3
+    turnplate_angle_limit_clockwise:5.3
+
+    lidar_exts
+    {
+        lidar_id:8
+        calib
+        {
+            cx:0.0
+            cy:0.0
+        }
+    }
+    lidar_exts
+    {
+        lidar_id:9
+        calib
+        {
+            cx:0.0
+            cy:0.0
+        }
+    }
+    lidar_exts
+    {
+        lidar_id:10
+        calib
+        {
+            cx:0.0
+            cy:0.0
+        }
+    }
+    lidar_exts
+    {
+        lidar_id:11
+        calib
+        {
+            cx:0.0
+            cy:0.0
+        }
+    }
 }
+
+# #6
+# regions
+# {
+#     # minx:15.8
+#     # maxx:18.8
+#     minx:-1.5
+#     maxx:1.5
+#     miny:-2.40
+#     maxy:3.45
+
+#     minz:0.025
+# 	maxz:0.5
+#     region_id:5
+#     turnplate_cx:0.0
+#     turnplate_cy:0.0
+#     border_minx:-1.3
+#     border_maxx:1.3
+#     plc_offsetx:0.0
+#     plc_offsety:0.0
+#     plc_offset_degree:0.0
+#     plc_border_miny:-7.51
+#     car_min_width:1.55
+#     car_max_width:1.95
+#     car_min_wheelbase:2.3
+#     car_max_wheelbase:3.15
+#     turnplate_angle_limit_anti_clockwise:5.3
+#     turnplate_angle_limit_clockwise:5.3
+
+#     lidar_exts
+#     {
+#         lidar_id:5
+#         calib
+#         {
+#             cx:-17.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:6
+#         calib
+#         {
+#             cx:-17.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:12
+#         calib
+#         {
+#             cx:-17.3
+#             cy:0.0
+#         }
+#     }
+#     lidar_exts
+#     {
+#         lidar_id:13
+#         calib
+#         {
+#             cx:-17.3
+#             cy:0.0
+#         }
+#     }
+# }

+ 0 - 0
system/system_communication.cpp


+ 0 - 0
system/system_communication.h


+ 484 - 357
system/system_executor.cpp

@@ -3,13 +3,6 @@
 //
 
 #include "system_executor.h"
-#include "../tool/common_data.h"
-#include "../tool/measure_filter.h"
-#include "../message/measure_message.pb.h"
-#include "../system/system_communication.h"
-
-#include "../wanji_lidar/wanji_manager.h"
-#include "../velodyne_lidar/velodyne_manager.h"
 
 // std::ofstream g_debug_file; // 用于测试滤波功能
 
@@ -226,6 +219,99 @@ Error_manager System_executor::check_status()
 	}
 }
 
+// 更新消息中关于定位结果与超界信息的内容
+bool System_executor::update_measure_info(message::Ground_status_msg &msg, Common_data::Car_wheel_information &measure_info, int cloud_size)
+{
+	Error_manager t_error;
+	//无论定位结果如何, 都要填充数据, 即使全部写0, 必须保证通信格式正确.
+	message::Locate_information t_locate_information;
+	//= t_multi_status_msg.add_locate_information_realtime();
+	t_locate_information.set_locate_x(measure_info.car_center_x);
+	t_locate_information.set_locate_y(measure_info.car_center_y);
+	t_locate_information.set_locate_angle(measure_info.car_angle);
+	t_locate_information.set_locate_length(0);
+	t_locate_information.set_locate_width(0);
+	t_locate_information.set_locate_height(0);
+	t_locate_information.set_locate_wheel_base(measure_info.car_wheel_base);
+	t_locate_information.set_locate_wheel_width(measure_info.car_wheel_width);
+	t_locate_information.set_locate_front_theta(measure_info.car_front_theta);
+	t_locate_information.set_locate_correct(measure_info.correctness);
+	t_locate_information.set_uniformed_car_x(measure_info.uniform_car_x);
+	t_locate_information.set_uniformed_car_y(measure_info.uniform_car_y);
+	msg.mutable_locate_information_realtime()->CopyFrom(t_locate_information);
+	// 当前超界提示仅保留一项
+	// 20211026已修改,分离为电子围栏状态与超界状态,只有测量正确时超界状态才有意义
+	msg.set_border_status(measure_info.range_status);
+	if (!measure_info.correctness)
+	{
+		if (cloud_size > 0)
+			msg.set_ground_status(message::Ground_statu::Noise);
+		else
+			msg.set_ground_status(message::Ground_statu::Nothing);
+	}
+	else if (measure_info.range_status == int(Ground_region::Range_status::Range_correct))
+	{
+		msg.set_ground_status(message::Ground_statu::Car_correct);
+	}
+	else
+	{
+		msg.set_ground_status(message::Ground_statu::Car_border_reached);
+		// 更新待提示错误信息
+		std::string t_error_str;
+		if (measure_info.range_status & Ground_region::Range_status::Range_front != 0)
+		{
+			t_error_str.append("前超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_back != 0)
+		{
+			t_error_str.append("后超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_left != 0)
+		{
+			t_error_str.append("左超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_right != 0)
+		{
+			t_error_str.append("右超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_bottom != 0)
+		{
+			t_error_str.append("底盘超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_top != 0)
+		{
+			t_error_str.append("顶超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_car_width != 0)
+		{
+			t_error_str.append("车宽超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_car_wheelbase != 0)
+		{
+			t_error_str.append("轴距超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_angle_anti_clock != 0)
+		{
+			t_error_str.append("车辆角度左超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_angle_clock != 0)
+		{
+			t_error_str.append("车辆角度右超界 ");
+		}
+		if (measure_info.range_status & Ground_region::Range_status::Range_steering_wheel_nozero != 0)
+		{
+			t_error_str.append("车辆前轮角超界 ");
+		}
+
+		t_error.set_error_description(t_error_str);
+	}
+
+	msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
+	msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
+	msg.mutable_error_manager()->set_error_description(t_error.get_error_description());
+	return true;
+}
+
 //定时发送状态信息
 Error_manager System_executor::encapsulate_send_status()
 {
@@ -247,13 +333,153 @@ Error_manager System_executor::encapsulate_send_status()
 	// t_ground_status_msg.set_terminal_id(m_terminal_id);
 	t_ground_status_msg.mutable_id_struct()->set_terminal_id(m_terminal_id);
 
-	// 创建各区域状态消息, 
+	// 创建各区域状态消息,
 	// 注意!!!目前公共消息名字依旧使用wj,不做修改
 	// manager
+#if WJ_VELO == 1
+	{
+		Velodyne_manager::Velodyne_manager_status t_velodyne_manager_status = Velodyne_manager::get_instance_references().get_status();
+		t_ground_status_msg.set_wanji_manager_status((message::Wanji_manager_status)t_velodyne_manager_status);
+
+		// lidar
+		std::map<int, Velodyne_lidar_device *> t_velodyne_lidar_device_map = Velodyne_manager::get_instance_references().get_velodyne_lidar_device_map();
+		std::map<int, Velodyne_lidar_device::Velodyne_lidar_device_status> t_velodyne_lidar_status_map;
+		for (auto iter = t_velodyne_lidar_device_map.begin(); iter != t_velodyne_lidar_device_map.end(); ++iter)
+		{
+			t_velodyne_lidar_status_map.emplace(std::pair<int, Velodyne_lidar_device::Velodyne_lidar_device_status>(iter->second->get_lidar_id(), iter->second->get_status()));
+		}
+
+		// region
+		std::map<int, Ground_region *> t_ground_region_map = Velodyne_manager::get_instance_references().get_ground_region_map();
+		int region_index = 0;
+		for (auto iter = t_ground_region_map.begin(); iter != t_ground_region_map.end(); ++iter)
+		{
+			// 以t_ground_status_msg为模板创建各区域心跳消息
+			message::Ground_status_msg t_multi_status_msg;
+			t_multi_status_msg.CopyFrom(t_ground_status_msg);
+			t_multi_status_msg.mutable_id_struct()->set_terminal_id(iter->second->get_terminal_id());
+			t_multi_status_msg.set_region_worker_status((message::Region_worker_status)(iter->second->get_status()));
+			velodyne::Region t_param = iter->second->get_param();
+			for (size_t j = 0; j < t_param.lidar_exts_size(); j++)
+			{
+				std::map<int, Velodyne_lidar_device::Velodyne_lidar_device_status>::iterator t_status_iter = t_velodyne_lidar_status_map.find(t_param.lidar_exts(j).lidar_id());
+				if (t_status_iter == t_velodyne_lidar_status_map.end())
+				{
+					LOG(WARNING) << "lidar status " << t_param.lidar_exts(j).lidar_id() << " cannot be found, param error";
+				}
+				else
+				{
+					t_multi_status_msg.add_wanji_lidar_device_status((message::Wanji_lidar_device_status)t_status_iter->second);
+				}
+			}
+			//velodyne雷达的自动定位信息
+			Common_data::Car_wheel_information t_car_wheel_information;
+			t_error = (*iter).second->get_last_wheel_information(&t_car_wheel_information, std::chrono::system_clock::now());
+
+			// 获取区域点云填入信息
+			pcl::PointCloud<pcl::PointXYZ>::Ptr t_region_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
+			iter->second->get_region_cloud(t_region_cloud, Ground_region::Region_cloud_type::filtered);
+			if (cloud_count == 5)
+			{
+				std::string t_filename = std::string("region_") + std::to_string(iter->first) + "_cloud.txt";
+				save_cloud_txt(t_region_cloud, t_filename);
+				LOG(INFO) << "region " << iter->first << " cloud has been saved in " + t_filename;
+			}
+			// for (size_t j = 0; j < t_region_cloud->size(); j++)
+			// {
+			// 	message::Cloud_coordinate *tp_cloud = t_multi_status_msg.add_cloud();
+			// 	tp_cloud->set_x(t_region_cloud->points[j].x);
+			// 	tp_cloud->set_y(t_region_cloud->points[j].y);
+			// 	tp_cloud->set_z(t_region_cloud->points[j].z);
+			// }
+
+			update_measure_info(t_multi_status_msg, t_car_wheel_information, t_region_cloud->size());
+
+			std::string t_msg = t_multi_status_msg.SerializeAsString();
+			System_communication::get_instance_references().encapsulate_msg(t_msg);
+			if (t_multi_status_msg.id_struct().terminal_id() == DISP_TERM_ID)
+				std::cout << t_multi_status_msg.DebugString() << std::endl
+						  << std::endl;
+		}
+	}
+#elif WJ_VELO == 0
+	{
+		// wj_support 20220718
+		Wanji_manager::Wanji_manager_status t_wj_manager_status = Wanji_manager::get_instance_references().get_status();
+		t_ground_status_msg.set_wanji_manager_status((message::Wanji_manager_status)t_wj_manager_status);
+
+		// lidar
+		std::map<int, Wanji_lidar_device *> t_wj_lidar_device_map = Wanji_manager::get_instance_references().get_wanji_lidar_device_map();
+		std::map<int, Wanji_lidar_device::Wanji_lidar_device_status> t_wj_lidar_status_map;
+		for (auto iter = t_wj_lidar_device_map.begin(); iter != t_wj_lidar_device_map.end(); ++iter)
+		{
+			t_wj_lidar_status_map.emplace(std::pair<int, Wanji_lidar_device::Wanji_lidar_device_status>(iter->second->get_lidar_id(), iter->second->get_status()));
+		}
+
+		// region
+		std::map<int, Region_worker *> t_region_worker_map = Wanji_manager::get_instance_references().get_region_worker_map();
+		int region_index = 0;
+		for (auto iter = t_region_worker_map.begin(); iter != t_region_worker_map.end(); ++iter)
+		{
+			// 以t_ground_status_msg为模板创建各区域心跳消息
+			message::Ground_status_msg t_multi_status_msg;
+			t_multi_status_msg.CopyFrom(t_ground_status_msg);
+			t_multi_status_msg.mutable_id_struct()->set_terminal_id(iter->second->get_terminal_id());
+			t_multi_status_msg.set_region_worker_status((message::Region_worker_status)(iter->second->get_status()));
+			wj::Region t_param = iter->second->get_param();
+			for (size_t j = 0; j < t_param.lidar_exts_size(); j++)
+			{
+				std::map<int, Wanji_lidar_device::Wanji_lidar_device_status>::iterator t_status_iter = t_wj_lidar_status_map.find(t_param.lidar_exts(j).lidar_id());
+				if (t_status_iter == t_wj_lidar_status_map.end())
+				{
+					LOG(WARNING) << "lidar status " << t_param.lidar_exts(j).lidar_id() << " cannot be found, param error";
+				}
+				else
+				{
+					t_multi_status_msg.add_wanji_lidar_device_status((message::Wanji_lidar_device_status)t_status_iter->second);
+				}
+			}
+			//velodyne雷达的自动定位信息
+			Common_data::Car_wheel_information t_car_wheel_information;
+			t_error = (*iter).second->get_last_wheel_information(&t_car_wheel_information, std::chrono::system_clock::now());
+
+			// 获取区域点云填入信息
+			pcl::PointCloud<pcl::PointXYZ>::Ptr t_region_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
+			iter->second->get_region_cloud(t_region_cloud);
+			if (cloud_count == 5)
+			{
+				std::string t_filename = std::string("region_") + std::to_string(iter->first) + "_cloud.txt";
+				save_cloud_txt(t_region_cloud, t_filename);
+				LOG(INFO) << "region " << iter->first << " cloud has been saved in " + t_filename;
+			}
+			// for (size_t j = 0; j < t_region_cloud->size(); j++)
+			// {
+			// 	message::Cloud_coordinate *tp_cloud = t_multi_status_msg.add_cloud();
+			// 	tp_cloud->set_x(t_region_cloud->points[j].x);
+			// 	tp_cloud->set_y(t_region_cloud->points[j].y);
+			// 	tp_cloud->set_z(t_region_cloud->points[j].z);
+			// }
+
+			update_measure_info(t_multi_status_msg, t_car_wheel_information, t_region_cloud->size());
+
+			std::string t_msg = t_multi_status_msg.SerializeAsString();
+			System_communication::get_instance_references().encapsulate_msg(t_msg);
+			if (t_multi_status_msg.id_struct().terminal_id() == DISP_TERM_ID)
+				LOG(INFO) << t_multi_status_msg.DebugString();
+		}
+	}
+	//	std::cout << " huli test :::: " << " t_ground_status_msg.DebugString() = "  << std::endl;
+	//	std::cout << t_ground_status_msg.DebugString() << std::endl;
+
+	//	std::cout << " huli test :::: " << " t_ground_status_msg.DebugString() = " << t_ground_status_msg.DebugString() << std::endl;
+#else
+{
+	// mix vlp16 and wj716
+	// 以多线雷达为主
 	Velodyne_manager::Velodyne_manager_status t_velodyne_manager_status = Velodyne_manager::get_instance_references().get_status();
 	t_ground_status_msg.set_wanji_manager_status((message::Wanji_manager_status)t_velodyne_manager_status);
 
-	// lidar
+	// vlp16 lidar
 	std::map<int, Velodyne_lidar_device *> t_velodyne_lidar_device_map = Velodyne_manager::get_instance_references().get_velodyne_lidar_device_map();
 	std::map<int, Velodyne_lidar_device::Velodyne_lidar_device_status> t_velodyne_lidar_status_map;
 	for (auto iter = t_velodyne_lidar_device_map.begin(); iter != t_velodyne_lidar_device_map.end(); ++iter)
@@ -261,44 +487,65 @@ Error_manager System_executor::encapsulate_send_status()
 		t_velodyne_lidar_status_map.emplace(std::pair<int, Velodyne_lidar_device::Velodyne_lidar_device_status>(iter->second->get_lidar_id(), iter->second->get_status()));
 	}
 
-	// region
+	// wj lidar
+#if LIDAR_TYPE == 1
+	std::map<int, Wanji_lidar_device *> t_wj_lidar_device_map = Wanji_manager::get_instance_references().get_wanji_lidar_device_map();
+	std::map<int, Wanji_lidar_device::Wanji_lidar_device_status> t_wj_lidar_status_map;
+	for (auto iter = t_wj_lidar_device_map.begin(); iter != t_wj_lidar_device_map.end(); ++iter)
+	{
+		t_wj_lidar_status_map.emplace(std::pair<int, Wanji_lidar_device::Wanji_lidar_device_status>(iter->second->get_lidar_id(), iter->second->get_status()));
+	}
+#else
+	std::map<int, Wanji_716N_lidar_device *> t_wj_lidar_device_map = Wanji_manager::get_instance_references().get_wanji_lidar_device_map();
+	std::map<int, Wanji_716N_lidar_device::Wanji_716N_device_status> t_wj_lidar_status_map;
+	for (auto iter = t_wj_lidar_device_map.begin(); iter != t_wj_lidar_device_map.end(); ++iter)
+	{
+		t_wj_lidar_status_map.emplace(std::pair<int, Wanji_716N_lidar_device::Wanji_716N_device_status>(iter->second->get_lidar_id(), iter->second->get_status()));
+	}
+#endif
+	
+	
+
+	// wj region
+	std::map<int, Region_worker *> t_region_worker_map = Wanji_manager::get_instance_references().get_region_worker_map();
+
+	// vlp16 region
 	std::map<int, Ground_region *> t_ground_region_map = Velodyne_manager::get_instance_references().get_ground_region_map();
 	int region_index = 0;
 	for (auto iter = t_ground_region_map.begin(); iter != t_ground_region_map.end(); ++iter)
 	{
-		bool has_mulfunctional_device = false;
 		// 以t_ground_status_msg为模板创建各区域心跳消息
 		message::Ground_status_msg t_multi_status_msg;
 		t_multi_status_msg.CopyFrom(t_ground_status_msg);
-        t_multi_status_msg.mutable_id_struct()->set_terminal_id(iter->second->get_terminal_id());
+		t_multi_status_msg.mutable_id_struct()->set_terminal_id(iter->second->get_terminal_id());
 		t_multi_status_msg.set_region_worker_status((message::Region_worker_status)(iter->second->get_status()));
+		// 查找多线区域内对应多线激光雷达
 		velodyne::Region t_param = iter->second->get_param();
-		for (size_t j = 0; j <t_param.lidar_exts_size(); j++)
+		for (size_t j = 0; j < t_param.lidar_exts_size(); j++)
 		{
 			std::map<int, Velodyne_lidar_device::Velodyne_lidar_device_status>::iterator t_status_iter = t_velodyne_lidar_status_map.find(t_param.lidar_exts(j).lidar_id());
-			if(t_status_iter== t_velodyne_lidar_status_map.end())
+			if (t_status_iter == t_velodyne_lidar_status_map.end())
+			{
+				LOG(WARNING) << "vlp16 lidar status " << t_param.lidar_exts(j).lidar_id() << " cannot be found, param error";
+			}
+			else
 			{
-				LOG(WARNING) << "lidar status "<<t_param.lidar_exts(j).lidar_id()<<" cannot be found, param error";
-			}else{
 				t_multi_status_msg.add_wanji_lidar_device_status((message::Wanji_lidar_device_status)t_status_iter->second);
-				if(t_status_iter->second != Velodyne_lidar_device::E_READY && t_status_iter->second != Velodyne_lidar_device::E_BUSY)
-				{
-					has_mulfunctional_device = true;
-				}
 			}
 		}
+
 		//velodyne雷达的自动定位信息
-		Common_data::Car_wheel_information	t_car_wheel_information;
+		Common_data::Car_wheel_information t_car_wheel_information;
 		t_error = (*iter).second->get_last_wheel_information(&t_car_wheel_information, std::chrono::system_clock::now());
 
 		// 获取区域点云填入信息
 		pcl::PointCloud<pcl::PointXYZ>::Ptr t_region_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
 		iter->second->get_region_cloud(t_region_cloud, Ground_region::Region_cloud_type::filtered);
-		if(cloud_count == 5)
+		if (cloud_count == 5)
 		{
-			std::string t_filename = std::string("region_")+std::to_string(iter->first)+"_cloud.txt";
+			std::string t_filename = std::string("vlp16_region_") + std::to_string(iter->first) + "_cloud.txt";
 			save_cloud_txt(t_region_cloud, t_filename);
-			LOG(INFO) << "region "<< iter->first <<" cloud has been saved in " + t_filename;
+			LOG(INFO) << "vlp16 region " << iter->first << " cloud has been saved in " + t_filename;
 		}
 		// for (size_t j = 0; j < t_region_cloud->size(); j++)
 		// {
@@ -308,195 +555,77 @@ Error_manager System_executor::encapsulate_send_status()
 		// 	tp_cloud->set_z(t_region_cloud->points[j].z);
 		// }
 
-		//无论定位结果如何, 都要填充数据, 即使全部写0, 必须保证通信格式正确.
-		message::Locate_information t_locate_information;
-		//= t_multi_status_msg.add_locate_information_realtime();
-		t_locate_information.set_locate_x(t_car_wheel_information.car_center_x);
-		t_locate_information.set_locate_y(t_car_wheel_information.car_center_y);
-		t_locate_information.set_locate_angle(t_car_wheel_information.car_angle);
-		t_locate_information.set_locate_length(0);
-		t_locate_information.set_locate_width(0);
-		t_locate_information.set_locate_height(0);
-		t_locate_information.set_locate_wheel_base(t_car_wheel_information.car_wheel_base);
-		t_locate_information.set_locate_wheel_width(t_car_wheel_information.car_wheel_width);
-		t_locate_information.set_locate_front_theta(t_car_wheel_information.car_front_theta);
-		t_locate_information.set_locate_correct(t_car_wheel_information.correctness);
-		t_locate_information.set_uniformed_car_x(t_car_wheel_information.uniform_car_x);
-		t_locate_information.set_uniformed_car_y(t_car_wheel_information.uniform_car_y);
-		t_multi_status_msg.mutable_locate_information_realtime()->CopyFrom(t_locate_information);
-		// 当前超界提示仅保留一项
-		// 20211026已修改,分离为电子围栏状态与超界状态,只有测量正确时超界状态才有意义
-		t_multi_status_msg.set_border_status(t_car_wheel_information.range_status);
-		if(!t_car_wheel_information.correctness)
+		// 检查vlp16区域与wj区域对应关系,wj存在对应区域则填充设备状态,并融合测量结果
+		auto t_wj_region_iter = t_region_worker_map.find(iter->first);
+		if(t_wj_region_iter != t_region_worker_map.end())
 		{
-			if(t_region_cloud->size() > 0)
-				t_multi_status_msg.set_ground_status(message::Ground_statu::Noise);
-			else
-				t_multi_status_msg.set_ground_status(message::Ground_statu::Nothing);
-		}else if(t_car_wheel_information.range_status == int(Ground_region::Range_status::Range_correct))
-		{
-			t_multi_status_msg.set_ground_status(message::Ground_statu::Car_correct);
-		}else {
-			t_multi_status_msg.set_ground_status(message::Ground_statu::Car_border_reached);
-			// 更新待提示错误信息
-			std::string t_error_str;
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_front != 0)
+			wj::Region t_param = t_wj_region_iter->second->get_param();
+			// 
+			for (size_t j = 0; j < t_param.lidar_exts_size(); j++)
 			{
-				t_error_str.append("前超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_back != 0)
-			{
-				t_error_str.append("后超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_left != 0)
-			{
-				t_error_str.append("左超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_right != 0)
-			{
-				t_error_str.append("右超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_bottom != 0)
-			{
-				t_error_str.append("底盘超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_top != 0)
-			{
-				t_error_str.append("顶超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_car_width != 0)
-			{
-				t_error_str.append("车宽超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_car_wheelbase != 0)
-			{
-				t_error_str.append("轴距超界 ");
+#if LIDAR_TYPE == 1
+	std::map<int, Wanji_lidar_device::Wanji_lidar_device_status>::iterator t_status_iter = t_wj_lidar_status_map.find(t_param.lidar_exts(j).lidar_id());
+#else
+	std::map<int, Wanji_716N_lidar_device::Wanji_716N_device_status>::iterator t_status_iter = t_wj_lidar_status_map.find(t_param.lidar_exts(j).lidar_id());
+#endif
+				if (t_status_iter == t_wj_lidar_status_map.end())
+				{
+					LOG(WARNING) << "wj lidar status " << t_param.lidar_exts(j).lidar_id() << " cannot be found, param error";
+				}
+				else
+				{
+					t_multi_status_msg.add_wanji_lidar_device_status((message::Wanji_lidar_device_status)t_status_iter->second);
+				}
 			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_angle_anti_clock != 0)
+			//wj雷达的自动定位信息
+			Common_data::Car_wheel_information t_wj_car_wheel_information;
+			t_error = t_wj_region_iter->second->get_last_wheel_information(&t_wj_car_wheel_information, std::chrono::system_clock::now());
+
+			// 获取区域点云填入信息
+			pcl::PointCloud<pcl::PointXYZ>::Ptr t_wj_region_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
+			t_wj_region_iter->second->get_region_cloud(t_wj_region_cloud);
+			if (cloud_count == 5)
 			{
-				t_error_str.append("车辆角度左超界 ");
+				std::string t_filename = std::string("wj_region_") + std::to_string(t_wj_region_iter->first) + "_cloud.txt";
+				save_cloud_txt(t_wj_region_cloud, t_filename);
+				LOG(INFO) << "wj region " << t_wj_region_iter->first << " cloud has been saved in " + t_filename;
 			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_angle_clock != 0)
+			// for (size_t j = 0; j < t_wj_region_cloud->size(); j++)
+			// {
+			// 	message::Cloud_coordinate *tp_cloud = t_multi_status_msg.add_cloud();
+			// 	tp_cloud->set_x(t_wj_region_cloud->points[j].x);
+			// 	tp_cloud->set_y(t_wj_region_cloud->points[j].y);
+			// 	tp_cloud->set_z(t_wj_region_cloud->points[j].z);
+			// }
+
+			// 融合测量结果,验证中心点差异x<0.03, y<0.03, 角度差异ang<0.6, 轴距差异wb<0.055
+			double dx = t_car_wheel_information.car_center_x - t_wj_car_wheel_information.car_center_x;
+			double dy = t_car_wheel_information.car_center_y - t_wj_car_wheel_information.car_center_y;
+			double dang = t_car_wheel_information.car_angle - t_wj_car_wheel_information.car_angle;
+			double dwb = t_car_wheel_information.car_wheel_base - t_wj_car_wheel_information.car_wheel_base;
+			if(fabs(dx) < 0.03 && fabs(dy) < 0.03 && fabs(dang) < 0.6 && fabs(dwb) < 0.055)
 			{
-				t_error_str.append("车辆角度右超界 ");
-			}
-			if (t_car_wheel_information.range_status & Ground_region::Range_status::Range_steering_wheel_nozero != 0)
+				t_car_wheel_information.car_wheel_base = t_car_wheel_information.car_wheel_base*0.2 + t_car_wheel_information.car_wheel_base*0.8;
+			}else
 			{
-				t_error_str.append("车辆前轮角超界 ");
+				LOG_IF(WARNING, iter->second->get_terminal_id() == DISP_TERM_ID)<<
+					"detect mismatch, region "<<iter->first<<", dx dy dang dwb: "<<dx<<", "<<dy<<", "<<dang<<", "<< dwb;
 			}
-			
-			t_error.set_error_description(t_error_str);
-		}
 
-		if(has_mulfunctional_device)
-		{
-			t_multi_status_msg.mutable_error_manager()->set_error_code(Error_code::VELODYNE_LIDAR_COMMUNICATION_DISCONNECT);
-			t_multi_status_msg.mutable_error_manager()->set_error_level(message::Error_level::MAJOR_ERROR);
-			t_multi_status_msg.mutable_error_manager()->set_error_description("has mulfunctional lidar device, please check.");
-		}
-		else
-		{
-			t_multi_status_msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
-			t_multi_status_msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
-			t_multi_status_msg.mutable_error_manager()->set_error_description(t_error.get_error_description());
+		}else{
+			LOG_IF(WARNING, iter->second->get_terminal_id() == DISP_TERM_ID)<<"region mismatch, vlp16 "<<iter->first<<", wj doesn't have corresponding region id";
 		}
 
+		update_measure_info(t_multi_status_msg, t_car_wheel_information, t_region_cloud->size());
+
 		std::string t_msg = t_multi_status_msg.SerializeAsString();
 		System_communication::get_instance_references().encapsulate_msg(t_msg);
-		if(t_multi_status_msg.id_struct().terminal_id()==DISP_TERM_ID)
-        	std::cout<<t_multi_status_msg.DebugString()<<std::endl<<std::endl;
-
-		usleep(1000*10);
+		if (t_multi_status_msg.id_struct().terminal_id() == DISP_TERM_ID)
+			std::cout << t_multi_status_msg.DebugString() << std::endl
+						<< std::endl;
 	}
-
-	// 普爱统一一个万集节点, 各终端消息分别发送
-	// 此处将t_ground_status_msg当做模板创建各区域的心跳消息. 
-	//万集716
-/*Wanji_manager::Wanji_manager_status t_wanji_manager_status = Wanji_manager::get_instance_references().get_status();
-	t_ground_status_msg.set_wanji_manager_status((message::Wanji_manager_status)t_wanji_manager_status);
-
-	std::map<int, Wanji_lidar_device*> & t_wanji_lidar_device_map = Wanji_manager::get_instance_references().get_wanji_lidar_device_map();
-	for (auto iter = t_wanji_lidar_device_map.begin(); iter != t_wanji_lidar_device_map.end(); ++iter)
-	{
-		Wanji_lidar_device::Wanji_lidar_device_status t_wanji_lidar_device_status = (*iter).second->get_status();
-		t_ground_status_msg.add_wanji_lidar_device_status((message::Wanji_lidar_device_status)t_wanji_lidar_device_status);
-	}
-
-	std::map<int, Region_worker*> & t_region_worker_map = Wanji_manager::get_instance_references().get_region_worker_map();
-	int region_index = 0;
-	for (auto iter = t_region_worker_map.begin(); iter != t_region_worker_map.end(); ++iter)
-	{
-        message::Ground_status_msg t_multi_status_msg;
-        t_multi_status_msg.CopyFrom(t_ground_status_msg);
-        t_multi_status_msg.set_terminal_id(region_index++);
-		Region_worker::Region_worker_status t_region_worker_status = (*iter).second->get_status();
-        // t_multi_status_msg.add_region_worker_status((message::Region_worker_status)t_region_worker_status);
-		t_multi_status_msg.set_region_worker_status((message::Region_worker_status)t_region_worker_status);
-
-		//万集雷达的自动定位信息
-		Common_data::Car_wheel_information	t_car_wheel_information;
-		t_error = (*iter).second->get_last_wheel_information(&t_car_wheel_information, std::chrono::system_clock::now());
-
-		//无论定位结果如何, 都要填充数据, 即使全部写0, 必须保证通信格式正确.
-		message::Locate_information t_locate_information;
-		//= t_multi_status_msg.add_locate_information_realtime();
-		t_locate_information.set_locate_x(t_car_wheel_information.center_x);
-		t_locate_information.set_locate_y(t_car_wheel_information.center_y);
-		t_locate_information.set_locate_angle(t_car_wheel_information.car_angle);
-		t_locate_information.set_locate_length(0);
-		t_locate_information.set_locate_width(0);
-		t_locate_information.set_locate_height(0);
-		t_locate_information.set_locate_wheel_base(t_car_wheel_information.wheel_base);
-		t_locate_information.set_locate_wheel_width(t_car_wheel_information.wheel_width);
-		t_locate_information.set_locate_front_theta(t_car_wheel_information.front_theta);
-		t_locate_information.set_locate_correct(t_car_wheel_information.correctness);
-		t_multi_status_msg.mutable_locate_information_realtime()->CopyFrom(t_locate_information);
-		t_multi_status_msg.set_ground_status(t_car_wheel_information.correctness?message::Ground_statu::Car_correct:message::Ground_statu::Noise);
-
-		t_multi_status_msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
-        t_multi_status_msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
-        t_multi_status_msg.mutable_error_manager()->set_error_description(t_error.get_error_description(), t_error.get_description_length());
-        std::string t_msg = t_multi_status_msg.SerializeAsString();
-        System_communication::get_instance_references().encapsulate_msg(t_msg);
-
-//        // 记录滤波前后测量数据,用于判断测量精度变化
-//        static int t_line_count = 0;
-//        if(region_index == 6 && ++t_line_count < 120) {
-//            if (g_debug_file.is_open() && t_car_wheel_information.correctness) {
-//                g_debug_file << "basic:"<<t_line_count<<"\n" <<std::setprecision(6)<<std::setiosflags(std::ios::fixed)
-//                             << t_car_wheel_information.center_x << ", "
-//                             << t_car_wheel_information.center_y << ", "
-//                             << t_car_wheel_information.car_angle << ", "
-//                             << t_car_wheel_information.wheel_base << ", "
-//                             << t_car_wheel_information.wheel_width << ", "
-//                             << t_car_wheel_information.front_theta << std::endl;
-//            }
-//            Common_data::Car_wheel_information t_filtered_result;
-//            Error_manager ec = Measure_filter::get_instance_references().get_filtered_wheel_information(region_index - 1, t_filtered_result);
-//            if(ec==SUCCESS){
-//                if (g_debug_file.is_open()) {
-//                    g_debug_file << "filtered:"<<t_line_count<<"\n" <<std::setprecision(6)<<std::setiosflags(std::ios::fixed)
-//                                 << t_filtered_result.center_x << ", "
-//                                 << t_filtered_result.center_y << ", "
-//                                 << t_filtered_result.car_angle << ", "
-//                                 << t_filtered_result.wheel_base << ", "
-//                                 << t_filtered_result.wheel_width << ", "
-//                                 << t_filtered_result.front_theta << std::endl;
-//                }
-//            }else{
-//                LOG(WARNING)<<ec.to_string();
-//            }
-////            LOG(WARNING) << t_multi_status_msg.DebugString();
-//        }
-}*/
-
-
-
-
-//	std::cout << " huli test :::: " << " t_ground_status_msg.DebugString() = "  << std::endl;
-//	std::cout << t_ground_status_msg.DebugString() << std::endl;
-
-//	std::cout << " huli test :::: " << " t_ground_status_msg.DebugString() = " << t_ground_status_msg.DebugString() << std::endl;
+}
+#endif
 
 	return Error_code::SUCCESS;
 }
@@ -504,7 +633,7 @@ Error_manager System_executor::encapsulate_send_status()
 //判断是否为待机,如果已经准备好,则可以执行任务。
 bool System_executor::is_ready()
 {
-	if ( m_system_executor_status == SYSTEM_EXECUTOR_READY && m_thread_pool.thread_is_full_load() == false )
+	if (m_system_executor_status == SYSTEM_EXECUTOR_READY && m_thread_pool.thread_is_full_load() == false)
 	{
 		return true;
 	}
@@ -514,180 +643,178 @@ bool System_executor::is_ready()
 	}
 }
 
-System_executor::System_executor_status System_executor::get_system_executor_status()
-{
-	return m_system_executor_status;
-}
-
-int System_executor::get_terminal_id()
-{
-	return m_terminal_id;
-}
-
-//雷达感测定位 的处理函数
-//input::command_id, 消息指令id, 由主控制系统生成的唯一码
-//input::command_id, 终端id, 对应具体的某个车位
-//return::void, 没有返回, 执行结果直接生成一条答复消息, 然后通过通信返回
-void System_executor::execute_for_measure(std::string command_info, int terminal_id,std::chrono::system_clock::time_point receive_time)
-{
-	Error_manager t_error;
-	Error_manager t_result;
-	LOG(INFO) << " System_executor::execute_for_measure run "<< this;
-
-	//第1步, 按照时间生成中间文件的保存路径
-	time_t nowTime;
-	nowTime = time(NULL);
-	struct tm* sysTime = localtime(&nowTime);
-	char t_save_path[256] = { 0 };
-	sprintf(t_save_path, "../data/%04d%02d%02d_%02d%02d%02d",
-			sysTime->tm_year + 1900, sysTime->tm_mon + 1, sysTime->tm_mday, sysTime->tm_hour, sysTime->tm_min, sysTime->tm_sec);
-
-
-	//第2步, 创建万集管理模块的任务单, 并发送到 wanji_manager
-	// Wanji_manager_task  t_wanji_manager_task ;
-	// Common_data::Car_wheel_information	t_car_information_by_wanji;
-	// t_wanji_manager_task.task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(3000),
-	// 							   terminal_id, receive_time);
-	// t_error = Task_command_manager::get_instance_references().execute_task(&t_wanji_manager_task);
-	// 或者创建velodyne管理模块任务单,并发送到velodyne_manager
-	Velodyne_manager_task t_velodyne_manager_task;
-	Common_data::Car_wheel_information	t_car_information_by_velodyne;
-	t_velodyne_manager_task.task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(3000),
-								   terminal_id, receive_time);
-	t_error = Task_command_manager::get_instance_references().execute_task(&t_velodyne_manager_task);							   
-
-	//第3步, 等待任务单完成
-	if ( t_error != Error_code::SUCCESS )
+	System_executor::System_executor_status System_executor::get_system_executor_status()
 	{
-		LOG(INFO) << " Velodyne_manager/Velodyne_manager  execute_task   error "<< this;
+		return m_system_executor_status;
 	}
-	else
+
+	int System_executor::get_terminal_id()
 	{
-		// //判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
-		// while ( t_wanji_manager_task.is_task_end() == false)
-		// {
-		// 	if ( t_wanji_manager_task.is_over_time() )
-		// 	{
-		// 		//超时处理。取消任务。
-		// 		Wanji_manager::get_instance_pointer()->cancel_task(&t_wanji_manager_task);
-		// 		t_error.error_manager_reset(Error_code::WJ_MANAGER_TASK_OVER_TIME, Error_level::MINOR_ERROR,
-		// 									" t_wanjestaui_manager_task is_over_time ");
-		// 		t_wanji_manager_task.set_task_error_manager(t_error);
-		// 	}
-		// 	else
-		// 	{
-		// 		//继续等待
-		// 		std::this_thread::sleep_for(std::chrono::microseconds(1));
-		// 		std::this_thread::yield();
-		// 	}
-		// }
+		return m_terminal_id;
+	}
 
-		// //提取任务单 的错误码
-		// t_error = t_wanji_manager_task.get_task_error_manager();
-		// if ( t_error == Error_code::SUCCESS )
-		// {
-		// 	t_car_information_by_wanji = t_wanji_manager_task.get_car_wheel_information();
-		// }
-		// else
-		// {
-		//     LOG(INFO) << " wanji_manager_task error :::::::"  << t_wanji_manager_task.get_task_error_manager().to_string() << this;
-		// }
-		// ------------------- 切换为velodyne ------------------
-		//判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
-		while ( t_velodyne_manager_task.is_task_end() == false)
+	//雷达感测定位 的处理函数
+	//input::command_id, 消息指令id, 由主控制系统生成的唯一码
+	//input::command_id, 终端id, 对应具体的某个车位
+	//return::void, 没有返回, 执行结果直接生成一条答复消息, 然后通过通信返回
+	void System_executor::execute_for_measure(std::string command_info, int terminal_id, std::chrono::system_clock::time_point receive_time)
+	{
+		Error_manager t_error;
+		Error_manager t_result;
+		LOG(INFO) << " System_executor::execute_for_measure run " << this;
+
+		//第1步, 按照时间生成中间文件的保存路径
+		time_t nowTime;
+		nowTime = time(NULL);
+		struct tm *sysTime = localtime(&nowTime);
+		char t_save_path[256] = {0};
+		sprintf(t_save_path, "../data/%04d%02d%02d_%02d%02d%02d",
+				sysTime->tm_year + 1900, sysTime->tm_mon + 1, sysTime->tm_mday, sysTime->tm_hour, sysTime->tm_min, sysTime->tm_sec);
+
+		//第2步, 创建万集管理模块的任务单, 并发送到 wanji_manager
+		// Wanji_manager_task  t_wanji_manager_task ;
+		// Common_data::Car_wheel_information	t_car_information_by_wanji;
+		// t_wanji_manager_task.task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(3000),
+		// 							   terminal_id, receive_time);
+		// t_error = Task_command_manager::get_instance_references().execute_task(&t_wanji_manager_task);
+		// 或者创建velodyne管理模块任务单,并发送到velodyne_manager
+		Velodyne_manager_task t_velodyne_manager_task;
+		Common_data::Car_wheel_information t_car_information_by_velodyne;
+		t_velodyne_manager_task.task_init(TASK_CREATED, "", NULL, std::chrono::milliseconds(3000),
+										  terminal_id, receive_time);
+		t_error = Task_command_manager::get_instance_references().execute_task(&t_velodyne_manager_task);
+
+		//第3步, 等待任务单完成
+		if (t_error != Error_code::SUCCESS)
 		{
-			if ( t_velodyne_manager_task.is_over_time() )
+			LOG(INFO) << " Velodyne_manager/Velodyne_manager  execute_task   error " << this;
+		}
+		else
+		{
+			// //判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
+			// while ( t_wanji_manager_task.is_task_end() == false)
+			// {
+			// 	if ( t_wanji_manager_task.is_over_time() )
+			// 	{
+			// 		//超时处理。取消任务。
+			// 		Wanji_manager::get_instance_pointer()->cancel_task(&t_wanji_manager_task);
+			// 		t_error.error_manager_reset(Error_code::WJ_MANAGER_TASK_OVER_TIME, Error_level::MINOR_ERROR,
+			// 									" t_wanjestaui_manager_task is_over_time ");
+			// 		t_wanji_manager_task.set_task_error_manager(t_error);
+			// 	}
+			// 	else
+			// 	{
+			// 		//继续等待
+			// 		std::this_thread::sleep_for(std::chrono::microseconds(1));
+			// 		std::this_thread::yield();
+			// 	}
+			// }
+
+			// //提取任务单 的错误码
+			// t_error = t_wanji_manager_task.get_task_error_manager();
+			// if ( t_error == Error_code::SUCCESS )
+			// {
+			// 	t_car_information_by_wanji = t_wanji_manager_task.get_car_wheel_information();
+			// }
+			// else
+			// {
+			//     LOG(INFO) << " wanji_manager_task error :::::::"  << t_wanji_manager_task.get_task_error_manager().to_string() << this;
+			// }
+			// ------------------- 切换为velodyne ------------------
+			//判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
+			while (t_velodyne_manager_task.is_task_end() == false)
+			{
+				if (t_velodyne_manager_task.is_over_time())
+				{
+					//超时处理。取消任务。
+					Velodyne_manager::get_instance_pointer()->cancel_task(&t_velodyne_manager_task);
+					t_error.error_manager_reset(Error_code::VELODYNE_MANAGER_TASK_OVER_TIME, Error_level::MINOR_ERROR,
+												" t_velodyne_manager_task is_over_time ");
+					t_velodyne_manager_task.set_task_error_manager(t_error);
+				}
+				else
+				{
+					//继续等待
+					std::this_thread::sleep_for(std::chrono::microseconds(1));
+					std::this_thread::yield();
+				}
+			}
+
+			//提取任务单 的错误码
+			t_error = t_velodyne_manager_task.get_task_error_manager();
+			if (t_error == Error_code::SUCCESS)
 			{
-				//超时处理。取消任务。
-				Velodyne_manager::get_instance_pointer()->cancel_task(&t_velodyne_manager_task);
-				t_error.error_manager_reset(Error_code::VELODYNE_MANAGER_TASK_OVER_TIME, Error_level::MINOR_ERROR,
-											" t_velodyne_manager_task is_over_time ");
-				t_velodyne_manager_task.set_task_error_manager(t_error);
+				t_car_information_by_velodyne = t_velodyne_manager_task.get_car_wheel_information();
 			}
 			else
 			{
-				//继续等待
-				std::this_thread::sleep_for(std::chrono::microseconds(1));
-				std::this_thread::yield();
+				LOG(INFO) << " velodyne_manager_task error :::::::" << t_velodyne_manager_task.get_task_error_manager().to_string() << this;
 			}
 		}
+		t_result.compare_and_cover_error(t_error);
 
-		//提取任务单 的错误码
-		t_error = t_velodyne_manager_task.get_task_error_manager();
-		if ( t_error == Error_code::SUCCESS )
-		{
-			t_car_information_by_velodyne = t_velodyne_manager_task.get_car_wheel_information();
-		}
-		else
-		{
-		    LOG(INFO) << " velodyne_manager_task error :::::::"  << t_velodyne_manager_task.get_task_error_manager().to_string() << this;
-		}
-	}
-	t_result.compare_and_cover_error(t_error);
-
-	//measure 测量模块的最终结果
-	Common_data::Car_measure_information	t_car_information_result;
-
-	//第4步, 生成反馈消息
-	// if(t_car_information_by_wanji.correctness == true )
-	// {
-	// 	t_car_information_result.center_x = t_car_information_by_wanji.center_x;
-	// 	t_car_information_result.center_y = t_car_information_by_wanji.center_y;
-
-	// 	t_car_information_result.car_angle = t_car_information_by_wanji.car_angle;
-	// 	t_car_information_result.wheel_base = t_car_information_by_wanji.wheel_base;
-
-	// 	t_car_information_result.wheel_width = t_car_information_by_wanji.wheel_width;
-	// 	t_car_information_result.correctness = true;
-	// }else{
-	// 	t_result.set_error_level_down(NEGLIGIBLE_ERROR);
-	// }
-	// ------------------- 切换为velodyne ------------------
-	if(t_car_information_by_velodyne.correctness == true )
-	{
-		t_car_information_result.car_center_x = t_car_information_by_velodyne.car_center_x;
-		t_car_information_result.car_center_y = t_car_information_by_velodyne.car_center_y;
-
-		t_car_information_result.car_angle = t_car_information_by_velodyne.car_angle;
-		t_car_information_result.car_wheel_base = t_car_information_by_velodyne.car_wheel_base;
-
-		t_car_information_result.car_wheel_width = t_car_information_by_velodyne.car_wheel_width;
-		t_car_information_result.correctness = true;
-	}else{
-		t_result.set_error_level_down(NEGLIGIBLE_ERROR);
-	}
+		//measure 测量模块的最终结果
+		Common_data::Car_measure_information t_car_information_result;
 
+		//第4步, 生成反馈消息
+		// if(t_car_information_by_wanji.correctness == true )
+		// {
+		// 	t_car_information_result.center_x = t_car_information_by_wanji.center_x;
+		// 	t_car_information_result.center_y = t_car_information_by_wanji.center_y;
 
-	//第七步, 创建一条答复消息
-	message::Ground_detect_response_msg t_ground_detect_response_msg;
-	t_ground_detect_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eGround_detect_response_msg);
-	t_ground_detect_response_msg.mutable_base_info()->set_timeout_ms(5000);
-	t_ground_detect_response_msg.mutable_base_info()->set_sender(message::Communicator::eGround_measurer);
-	t_ground_detect_response_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
-
-	t_ground_detect_response_msg.set_command_key(command_info);
-	t_ground_detect_response_msg.mutable_id_struct()->set_terminal_id(terminal_id);
-	t_ground_detect_response_msg.mutable_error_manager()->set_error_code(t_result.get_error_code());
-	t_ground_detect_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_result.get_error_level());
-	t_ground_detect_response_msg.mutable_error_manager()->set_error_description(t_result.get_error_description());
+		// 	t_car_information_result.car_angle = t_car_information_by_wanji.car_angle;
+		// 	t_car_information_result.wheel_base = t_car_information_by_wanji.wheel_base;
 
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_x(t_car_information_result.car_center_x);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_y(t_car_information_result.car_center_y);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_angle(t_car_information_result.car_angle);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_length(t_car_information_result.car_length);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_width(t_car_information_result.car_width);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_height(t_car_information_result.car_height);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_wheel_base(t_car_information_result.car_wheel_base);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_wheel_width(t_car_information_result.car_wheel_width);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_front_theta(t_car_information_result.car_front_theta);
-	t_ground_detect_response_msg.mutable_locate_information()->set_locate_correct(t_car_information_result.correctness);
+		// 	t_car_information_result.wheel_width = t_car_information_by_wanji.wheel_width;
+		// 	t_car_information_result.correctness = true;
+		// }else{
+		// 	t_result.set_error_level_down(NEGLIGIBLE_ERROR);
+		// }
+		// ------------------- 切换为velodyne ------------------
+		if (t_car_information_by_velodyne.correctness == true)
+		{
+			t_car_information_result.car_center_x = t_car_information_by_velodyne.car_center_x;
+			t_car_information_result.car_center_y = t_car_information_by_velodyne.car_center_y;
 
+			t_car_information_result.car_angle = t_car_information_by_velodyne.car_angle;
+			t_car_information_result.car_wheel_base = t_car_information_by_velodyne.car_wheel_base;
 
-	std::string t_msg = t_ground_detect_response_msg.SerializeAsString();
-	System_communication::get_instance_references().encapsulate_msg(t_msg);
+			t_car_information_result.car_wheel_width = t_car_information_by_velodyne.car_wheel_width;
+			t_car_information_result.correctness = true;
+		}
+		else
+		{
+			t_result.set_error_level_down(NEGLIGIBLE_ERROR);
+		}
 
-	std::cout << "huli t_measure_response_msg = " << t_ground_detect_response_msg.DebugString() << std::endl;
+		//第七步, 创建一条答复消息
+		message::Ground_detect_response_msg t_ground_detect_response_msg;
+		t_ground_detect_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eGround_detect_response_msg);
+		t_ground_detect_response_msg.mutable_base_info()->set_timeout_ms(5000);
+		t_ground_detect_response_msg.mutable_base_info()->set_sender(message::Communicator::eGround_measurer);
+		t_ground_detect_response_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
+
+		t_ground_detect_response_msg.set_command_key(command_info);
+		t_ground_detect_response_msg.mutable_id_struct()->set_terminal_id(terminal_id);
+		t_ground_detect_response_msg.mutable_error_manager()->set_error_code(t_result.get_error_code());
+		t_ground_detect_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_result.get_error_level());
+		t_ground_detect_response_msg.mutable_error_manager()->set_error_description(t_result.get_error_description());
+
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_x(t_car_information_result.car_center_x);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_y(t_car_information_result.car_center_y);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_angle(t_car_information_result.car_angle);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_length(t_car_information_result.car_length);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_width(t_car_information_result.car_width);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_height(t_car_information_result.car_height);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_wheel_base(t_car_information_result.car_wheel_base);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_wheel_width(t_car_information_result.car_wheel_width);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_front_theta(t_car_information_result.car_front_theta);
+		t_ground_detect_response_msg.mutable_locate_information()->set_locate_correct(t_car_information_result.correctness);
+
+		std::string t_msg = t_ground_detect_response_msg.SerializeAsString();
+		System_communication::get_instance_references().encapsulate_msg(t_msg);
 
+		std::cout << "huli t_measure_response_msg = " << t_ground_detect_response_msg.DebugString() << std::endl;
 
-	return ;
-}
+		return;
+	}

+ 14 - 1
system/system_executor.h

@@ -10,7 +10,17 @@
 #include "../error_code/error_code.h"
 #include "../communication/communication_message.h"
 
-#define DISP_TERM_ID -1
+#include "../tool/common_data.h"
+#include "../tool/measure_filter.h"
+#include "../message/measure_message.pb.h"
+#include "../system/system_communication.h"
+
+#include "../wanji_lidar/wanji_manager.h"
+#include "../velodyne_lidar/velodyne_manager.h"
+
+#define DISP_TERM_ID 5
+// 0wj  1velo	2both
+#define WJ_VELO 2
 
 class System_executor:public Singleton<System_executor>
 {
@@ -58,6 +68,9 @@ public://API functions
 
 	//判断是否为待机,如果已经准备好,则可以执行任务。
 	bool is_ready();
+
+	// 更新消息中关于定位结果与超界信息的内容
+	bool update_measure_info(message::Ground_status_msg &msg, Common_data::Car_wheel_information &measure_info, int cloud_size);
 public://get or set member variable
 	System_executor_status get_system_executor_status();
 	int get_terminal_id();

+ 0 - 0
tests/lidar_calib_tools.cpp


+ 0 - 0
tests/region_4_26x.txt


+ 0 - 0
tests/region_4_26x_g.txt


+ 0 - 0
tests/region_4_env.txt


+ 0 - 0
tests/region_4_env_g.txt


+ 0 - 0
tests/vlp16_driver_test.cpp


+ 0 - 0
tool/common_data.cpp


+ 0 - 0
tool/common_data.h


+ 0 - 0
velodyne_lidar/icp_svd_registration.cpp


+ 0 - 0
velodyne_lidar/icp_svd_registration.hpp


+ 0 - 0
tool/measure_filter.h


+ 0 - 0
tool/pathcreator.cpp


+ 0 - 0
tool/pathcreator.h


+ 0 - 0
tool/pcl_cloud_with_lock.cpp


+ 0 - 0
tool/pcl_cloud_with_lock.h


+ 0 - 0
tool/point2D_tool.cpp


+ 0 - 0
tool/point2D_tool.h


+ 0 - 0
tool/point3D_tool.cpp


+ 0 - 0
tool/point3D_tool.h


+ 0 - 0
tool/proto_tool.cpp


+ 0 - 0
tool/proto_tool.h


+ 0 - 0
velodyne_lidar/region_status_checker.h


+ 1 - 1
tool/rotate_center_caliber.cpp

@@ -155,7 +155,7 @@ Eigen::Matrix4f rotate_center_caliber::match(pcl::PointCloud<pcl::PointXYZ>::Ptr
     //设置匹配迭代的最大次数
     ndt.setMaximumIterations(100);
     // 设置要配准的点云
-    ndt.setInputCloud(cloud);
+    ndt.setInputSource(cloud);
     //设置点云配准目标
     ndt.setInputTarget(cloud_center);
     //设置使用机器人测距法得到的初始对准估计结果

+ 0 - 0
tool/singleton.cpp


+ 0 - 0
tool/singleton.h


+ 0 - 0
tool/thread_pool.h


+ 0 - 0
tool/thread_safe_list.cpp


+ 0 - 0
tool/thread_safe_list.h


+ 0 - 0
tool/time_tool.cpp


+ 0 - 0
tool/time_tool.h


+ 1 - 1
velodyne_lidar/car_pose_detector.cpp

@@ -209,7 +209,7 @@ struct Trans_mat_cost
         //     }
         // }
         // printf("r:%d c:%d\n", img_show.rows, img_show.cols);
-        cv::namedWindow("img", CV_WINDOW_FREERATIO);
+        cv::namedWindow("img", cv::WINDOW_FREERATIO);
         // cv::imshow("origin", mat);
         cv::imshow("img", img_show);
         cv::waitKey();

+ 0 - 0
velodyne_lidar/car_pose_detector.h


+ 27 - 22
velodyne_lidar/ground_region.cpp

@@ -10,11 +10,13 @@
 #include <pcl/segmentation/extract_clusters.h>
 #include <fcntl.h>
 
+#include "../tool/point_tool.h"
+
 // 测量结果滤波,不影响现有结构
 #include "../tool/measure_filter.h"
 
 // 增加车辆停止状态判断
-#include "region_status_checker.h"
+#include "../tool/region_status_checker.h"
 
 //欧式聚类*******************************************************
 std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> Ground_region::segmentation(pcl::PointCloud<pcl::PointXYZ>::Ptr sor_cloud)
@@ -40,16 +42,16 @@ std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> Ground_region::segmentation(pcl
     return segmentation_clouds;
 }
 
-/**
- * @description: distance between two points
- * @param {Point2f} p1
- * @param {Point2f} p2
- * @return the distance
- */
-double Ground_region::distance(cv::Point2f p1, cv::Point2f p2)
-{
-    return sqrt(pow(p1.x - p2.x, 2.0) + pow(p1.y - p2.y, 2.0));
-}
+// /**
+//  * @description: distance between two points
+//  * @param {Point2f} p1
+//  * @param {Point2f} p2
+//  * @return the distance
+//  */
+// double Ground_region::distance(cv::Point2f p1, cv::Point2f p2)
+// {
+//     return sqrt(pow(p1.x - p2.x, 2.0) + pow(p1.y - p2.y, 2.0));
+// }
 
 /**
  * @description: point rectangle detect
@@ -599,17 +601,16 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
         pcl::getMinMax3D(*t_width_extract_cloud, t_min_p, t_max_p);
 
         double accurate_width = t_max_p.x - t_min_p.x;
-        
-        char valid_info[255];
-        sprintf(valid_info, "validation for car width, origin/accurate: (%.3f, %.3f)", last_result.width, accurate_width);
-        // 允许一边4cm误差,且保证车宽应比车轮识别计算出的大,否则为错误宽度数据
-        if (accurate_width - last_result.width > 0.08 || accurate_width < last_result.width)
-        {
-            //return Error_manager(VELODYNE_REGION_CERES_SOLVE_ERROR, NEGLIGIBLE_ERROR, valid_info);
-        }else
-        {
-            last_result.width = accurate_width;
-        }
+        last_result.width = accurate_width;
+
+        // !!!暂时不限制宽度数据
+        // char valid_info[255];
+        // sprintf(valid_info, "validation for car width, origin/accurate: (%.3f, %.3f)", last_result.width, accurate_width);
+        // // 允许一边5cm误差,且保证车宽应比车轮识别计算出的大,否则为错误宽度数据
+        // if (accurate_width - last_result.width > 0.1 || accurate_width < last_result.width)
+        // {
+        //     return Error_manager(VELODYNE_REGION_CERES_SOLVE_ERROR, NEGLIGIBLE_ERROR, valid_info);
+        // }
         // if (m_region.region_id() == 0 || m_region.region_id() == 4)
         // {
         //     LOG(WARNING) << valid_info;
@@ -864,7 +865,11 @@ void Ground_region::thread_measure_func()
                 // else{
                 //     std::cout<<ec.to_string()<<std::endl;
                 // }
+<<<<<<< HEAD
                 //  LOG_IF(INFO, m_region.region_id() == 1) << m_car_wheel_information.to_string();
+=======
+                 //LOG_IF(INFO, m_region.region_id() == 4 || m_region.region_id() == 1) << m_car_wheel_information.to_string();
+>>>>>>> 00fb9584746fa2f0fc86b7596cdc4711435586f0
             }
             else
             {

+ 1 - 1
velodyne_lidar/ground_region.h

@@ -150,7 +150,7 @@ private:
 
    std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> segmentation(pcl::PointCloud<pcl::PointXYZ>::Ptr sor_cloud);
 
-   double distance(cv::Point2f p1, cv::Point2f p2);
+   // double distance(cv::Point2f p1, cv::Point2f p2);
 
    bool isRect(std::vector<cv::Point2f> &points);
 

+ 0 - 0
velodyne_lidar/velodyne_config.pb.cc


+ 0 - 0
velodyne_lidar/velodyne_config.pb.h


+ 0 - 0
velodyne_lidar/velodyne_config.proto


+ 0 - 0
velodyne_lidar/velodyne_driver/calibration.cc


+ 0 - 0
velodyne_lidar/velodyne_driver/calibration.h


+ 0 - 0
velodyne_lidar/velodyne_driver/input.cc


+ 0 - 0
velodyne_lidar/velodyne_driver/input.h


+ 0 - 0
velodyne_lidar/velodyne_driver/rawdata.cc


+ 0 - 0
velodyne_lidar/velodyne_driver/rawdata.h


+ 4 - 12
velodyne_lidar/velodyne_driver/velodyne_lidar_device.cpp

@@ -606,21 +606,13 @@ void Velodyne_lidar_device::parse_thread_fun()
 					{
 						m_num_packet_inside = 0;
 						m_ring_cloud.clear();
-						// 20220411 changed by yct, A1A2中间1号雷达8号线出现问题
-						// m_ring_cloud = m_cloud_buf;
-						// m_cloud_buf.clear();
+						m_ring_cloud = m_cloud_buf;
+						m_cloud_buf.clear();
 						// 对环点云进行内参变换
-						for (size_t i = 0; i < m_cloud_buf.size(); i++)
+						for (size_t i = 0; i < m_ring_cloud.size(); i++)
 						{
-							Lidar_point t_point = m_cloud_buf[i];
-							t_point.transform(m_calib_matrix);
-							// m_ring_cloud[i].transform(m_calib_matrix);
-							if(t_point.ring != 8 || m_lidar_id != 1)
-							{
-								m_ring_cloud.push_back(t_point);
-							}
+							m_ring_cloud[i].transform(m_calib_matrix);
 						}
-						m_cloud_buf.clear();
 						m_parse_ring_time = std::chrono::steady_clock::now();
 					}
 					// LOG(INFO) << "33333";

+ 0 - 0
velodyne_lidar/velodyne_driver/velodyne_lidar_scan_task.cpp


+ 0 - 0
velodyne_lidar/velodyne_driver/velodyne_lidar_scan_task.h


+ 0 - 0
velodyne_lidar/velodyne_manager.cpp


+ 0 - 0
velodyne_lidar/velodyne_manager.h


+ 33 - 24
wanji_lidar/detect_wheel_ceres.cpp

@@ -78,10 +78,10 @@ public:
         T width = variable[4];
         T theta_front = variable[5];
         T theta_front_weight = T(0.8);
-        T wheel_length_img_ratio = variable[6];
-        T wheel_width_length_ratio = variable[7];
+//        T wheel_length_img_ratio = variable[6];
+        T wheel_width_length_ratio = variable[6];
         // [1/3, 5/3]
-        T limited_wheel_length_img_ratio = T(0.8) / (T(1) + ceres::exp(T(-wheel_length_img_ratio))) + T(0.75);
+        T limited_wheel_length_img_ratio = T(0.85);// = T(0.7) / (T(1) + ceres::exp(T(-wheel_length_img_ratio))) + T(0.85);
         // [0.25, 0.35]
         T limited_wheel_length_ratio = T(0.25) / (T(1) + ceres::exp(T(-wheel_width_length_ratio))) + T(0.25);
 
@@ -188,22 +188,29 @@ public:
 		//printf("dev: %.6f\n", costs[i]);
 	}
 
-        char buf[30];
-        memset(buf, 0, 30);
-        sprintf(buf, "%.12f", costs[0]);
-        m_costs_lf = std::stod(buf) / left_front_num;
+            char buf[30];
+            memset(buf, 0, 30);
+            sprintf(buf, "%.12f", costs[0]);
+            double t_costs_lf = std::stod(buf) / left_front_num;
 
-        memset(buf, 0, 30);
-        sprintf(buf, "%.12f", costs[1]);
-        m_costs_rf = std::stod(buf) / right_front_num;
+            memset(buf, 0, 30);
+            sprintf(buf, "%.12f", costs[1]);
+            double t_costs_rf = std::stod(buf) / right_front_num;
 
-        memset(buf, 0, 30);
-        sprintf(buf, "%.12f", costs[2]);
-        m_costs_lr = std::stod(buf) / left_rear_num;
+            memset(buf, 0, 30);
+            sprintf(buf, "%.12f", costs[2]);
+            double t_costs_lr = std::stod(buf) / left_rear_num;
 
-        memset(buf, 0, 30);
-        sprintf(buf, "%.12f", costs[3]);
-        m_costs_rr = std::stod(buf) / right_rear_num;
+            memset(buf, 0, 30);
+            sprintf(buf, "%.12f", costs[3]);
+            double t_costs_rr = std::stod(buf) / right_rear_num;
+            if(t_costs_lf >= 0.001 && t_costs_rf >= 0.001 && t_costs_lr >= 0.001 && t_costs_rr >= 0.001)
+            {
+                m_costs_lf=t_costs_lf;
+                m_costs_rf=t_costs_rf;
+                m_costs_lr=t_costs_lr;
+                m_costs_rr=t_costs_rr;
+            }
         // m_costs_lf = costs[0];
 	//printf("%.6f %.6f %.6f %.6f\n",m_costs_lf, m_costs_rf, m_costs_lr, m_costs_rr);
         return true;
@@ -252,8 +259,10 @@ bool detect_wheel_ceres::update_mat(int rows, int cols)
         // }
 
     }
+    // std::cout<<"map size: "<<map.size()<<std::endl;
     cv::resize(map,map,cv::Size(cols,rows));
     cv::GaussianBlur(map,m_map,cv::Size(7,7),3,3);
+    return true;
 }
 
 detect_wheel_ceres::detect_wheel_ceres()
@@ -620,18 +629,18 @@ bool detect_wheel_ceres::Solve(Detect_result &detect_result, Loss_result &loss_r
     double init_width=1.55;
     double init_theta_front=0*M_PI/180.0;
     // 车轮长图比, 比例取值1/3-5/3, 当前变量无限制
-    double init_wheel_length_img_ratio = 0;
+//    double init_wheel_length_img_ratio = 0.1;
     // 车轮宽长比, 默认长为1,比例取值范围0.2-0.8, 当前变量范围无限制
-    double init_wheel_width_length_ratio = 0;
+    double init_wheel_width_length_ratio = -0.5;
 
-    double variable[] = {cx, cy, init_theta, init_wheel_base, init_width, init_theta_front, init_wheel_length_img_ratio, init_wheel_width_length_ratio};
+    double variable[] = {cx, cy, init_theta, init_wheel_base, init_width, init_theta_front, init_wheel_width_length_ratio};
     // printf("solve x:%.3f  y: %.3f  wheel:%.3f  width:%.3f    theta : %.3f   front theta: %.3f\n", variable[0], variable[1], variable[3], variable[4], variable[2], variable[5]);
     // 第二部分:构建寻优问题
     ceres::Problem problem;
     CostFunctor *cost_func = new CostFunctor(m_left_front_cloud,m_right_front_cloud,m_left_rear_cloud,m_right_rear_cloud,m_map,SCALE);
     //使用自动求导,将之前的代价函数结构体传入,第一个1是输出维度,即残差的维度,第二个1是输入维度,即待寻优参数x的维度。
     ceres::CostFunction* cost_function =new
-            ceres::AutoDiffCostFunction<CostFunctor, ceres::DYNAMIC, 8>(
+            ceres::AutoDiffCostFunction<CostFunctor, ceres::DYNAMIC, 7>(
                     cost_func,
                     m_left_front_cloud.size()+m_right_front_cloud.size()+m_left_rear_cloud.size()+m_right_rear_cloud.size()+2);
     problem.AddResidualBlock(cost_function, NULL, variable); //向问题中添加误差项,本问题比较简单,添加一个就行。
@@ -672,15 +681,15 @@ bool detect_wheel_ceres::Solve(Detect_result &detect_result, Loss_result &loss_r
     //检验
     // printf("loss: %.5f\n", loss);
     // printf("middle x:%.3f  y: %.3f  wheel:%.3f  width:%.3f    theta : %.3f   front theta: %.3f\n", variable[0], variable[1], variable[3], variable[4], variable[2], variable[5]);
-    if(loss>0.005)
+    if(loss>0.0115)
     {
         error_info.append("总loss过大 ").append(std::to_string(loss)).append("\t");
 //        LOG(WARNING) <<"总loss过大 "<<loss;
         return false;
     }
-    if (detect_result.width < 1.25 || detect_result.width > 2.000 || detect_result.wheel_base > 3.200 || detect_result.wheel_base < 2.200)
+    if (detect_result.width < 1.25 || detect_result.width > 2.000 || detect_result.wheel_base > 3.15 || detect_result.wheel_base < 2.200)
     {
-        error_info.append(std::string("宽度(1.25, 2.00) 轴距(2.20, 3.20): ").append(std::to_string(detect_result.width).append(", ").append(std::to_string(detect_result.wheel_base)).append("\t")));
+        error_info.append(std::string("宽度(1.25, 2.00) 轴距(2.20, 3.15): ").append(std::to_string(detect_result.width).append(", ").append(std::to_string(detect_result.wheel_base)).append("\t")));
 //        LOG(WARNING) <<"宽度(1.35, 2.00) 轴距(2.20, 3.30): "<<detect_result.width<<", "<<detect_result.wheel_base;
         return false;
     }
@@ -724,7 +733,7 @@ bool detect_wheel_ceres::Solve(Detect_result &detect_result, Loss_result &loss_r
             loss_result.rb_loss = loss;
         }
         // 判断每个轮子平均loss是否满足条件
-        double single_wheel_loss_threshold = 0.5;
+        double single_wheel_loss_threshold = 0.135;
         if(loss_result.lf_loss > single_wheel_loss_threshold || loss_result.rf_loss > single_wheel_loss_threshold  || loss_result.lb_loss > single_wheel_loss_threshold || loss_result.rb_loss > single_wheel_loss_threshold)
         {
             error_info.append("四轮loss过大 ").append(std::to_string(loss_result.lf_loss)).append(", ")

+ 0 - 0
wanji_lidar/region_detect.cpp


Some files were not shown because too many files changed in this diff