Переглянути джерело

recover railling verify,
need to eliminate wj lidar part.

yct 4 роки тому
батько
коміт
0d701c9429

+ 144 - 0
.gitignore

@@ -0,0 +1,144 @@
+#################
+## Eclipse
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+.idea
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+# External tool builders
+.externalToolBuilders/
+# Locally stored "Eclipse launch configurations"
+*.launch
+# CDT-specific
+.cproject
+# PDT-specific
+.buildpath
+## Visual Studio
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.vspscc
+.builds
+*.dotCover
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+# Visual Studio profiler
+*.psess
+*.vsp
+# ReSharper is a .NET coding add-in
+_ReSharper*
+# Installshield output folder
+[Ee]xpress
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+# Click-Once directory
+publish
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+############
+## Windows
+# Windows image file caches
+Thumbs.db
+# Folder config file
+Desktop.ini
+#############
+## Python
+*.py[co]
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+# Installer logs
+pip-log.txt
+# Unit test / coverage reports
+.coverage
+.tox
+#Translations
+*.mo
+#Mr Developer
+.mr.developer.cfg
+# Mac crap
+.DS_Store
+/build_64bits_msvc10/
+/test/
+private_plugins
+/data/
+/misc/
+CCCoreLibExport.h
+/.vs/CloudCompare/v15
+/.vs/ProjectSettings.json
+/.vs/slnx.sqlite
+/.vs
+.vscode
+/CMakeSettings.json
+#VS2019 default cmake build & install paths
+/out/
+*.cfg
+*.pb
+*ckpt*
+*.weights

+ 4 - 3
CMakeLists.txt

@@ -1,9 +1,10 @@
-project(nnxx_tests)
+project(measure_dj_proj)
 
 cmake_minimum_required(VERSION 3.5)
 
 set (CMAKE_CXX_STANDARD 11)
 
+set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(nanomsg REQUIRED nanomsg)
 FIND_PACKAGE(Protobuf REQUIRED)
@@ -48,7 +49,7 @@ aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/communication COMMUNICATION_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/system SYSTEM_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/verify VERIFY_SRC )
 
-add_executable(terminal
+add_executable(measure_dj
         main.cpp
         ${ERROR_SRC}
         ${locate_src}
@@ -68,7 +69,7 @@ add_executable(terminal
 
 		)
 
-target_link_libraries(terminal
+target_link_libraries(measure_dj
         /usr/local/lib/libglog.a
         /usr/local/lib/libgflags.a
         /usr/local/lib/liblivox_sdk_static.a

+ 3 - 1
laser/LivoxLaser.h

@@ -5,9 +5,12 @@
 #include "livox_sdk.h"
 #include <map>
 
+#define DEFAULT_HANDLE 255
+
 //大疆livox雷达,从Laser_base继承。
 class CLivoxLaser :public Laser_base
 {
+
 public:
 	//雷达设备状态,livox管理底层sdk,后台线程的工作状态
 	typedef enum
@@ -79,7 +82,6 @@ public://set and get
 
 	void set_device_info(DeviceInfo info);
 
-
 protected:
 	//接受二进制消息的功能函数,并将其存入 m_queue_laser_data, 每次只转化一个CBinaryData,
 	// 纯虚函数,必须由子类重载,

+ 1 - 1
laser/livox_driver.cpp

@@ -221,7 +221,7 @@ void Livox_driver::livox_device_broadcast_callback(const BroadcastDeviceInfo *p_
 				else
 				{
 					//连接失败.    (一般雷达设备有应答,就会连接成功.)
-					tp_livox_laser->set_handle(-1);
+					tp_livox_laser->set_handle(DEFAULT_HANDLE);
 					tp_livox_laser->set_device_state( CLivoxLaser::K_DEVICE_STATE_FAULT);
 				}
 			}

+ 128 - 234
main.cpp

@@ -46,149 +46,30 @@ GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
 
 }
 
-
-
-int main(int argc,char* argv[])
+void prev_test_pred_task()
 {
-
-
-	Error_manager t_error;
-	Error_manager t_result ;
-
-
-	const char* logPath = "./";
-	google::InitGoogleLogging("LidarMeasurement");
-	google::SetStderrLogging(google::INFO);
-	google::SetLogDestination(0, logPath);
-	google::SetLogFilenameExtension("zxlog");
-	google::InstallFailureSignalHandler();
-	google::InstallFailureWriter(&shut_down_logging);
-	FLAGS_colorlogtostderr = true;        // Set log color
-	FLAGS_logbufsecs = 0;                // Set log output speed(s)
-	FLAGS_max_log_size = 1024;            // Set max log file size(GB)
-	FLAGS_stop_logging_if_full_disk = true;
-
-	Wanji_manager::get_instance_references().wanji_manager_init();
-	std::cout << " huli test :::: " << " wanji_manager_init = " << 1 << std::endl;
-
-
-/*
-	while (1  )
-	{
-		char ch1 ;
-		std::cin >> ch1 ;
-		if (ch1 == 'b'  )
-		{
-			break;
-		}
-
-		auto start   = std::chrono::system_clock::now();
-
-
-		Wanji_manager_task task;
-		task.task_init(TASK_CREATED, "", NULL,
-					   std::chrono::milliseconds(1000),
-					   0,
-					   std::chrono::system_clock::now());
-		t_error = Wanji_manager::get_instance_references().execute_task(&task);
-		std::cout << " huli test 123123:::: " << " t_error = " << t_error << std::endl;
-
-
-		//判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
-		while ( task.is_task_end() == false)
-		{
-			if ( task.is_over_time() )
-			{
-				//超时处理。取消任务。
-				Wanji_manager::get_instance_references().cancel_task(&task);
-				task.set_task_statu(TASK_DEAD);
-				t_error.error_manager_reset(Error_code::WANJI_LIDAR_DEVICE_TASK_OVER_TIME, Error_level::MINOR_ERROR,
-											" locate_manager_task is_over_time ");
-				task.set_task_error_manager(t_error);
-			}
-			else
-			{
-				//继续等待
-				std::this_thread::sleep_for(std::chrono::microseconds(1));
-				std::this_thread::yield();
-			}
-
-		}
-		//提取任务单 的错误码
-		t_error = task.get_task_error_manager();
-		std::cout << "huli  error 456456:::::::"  << t_error << std::endl;
-		std::cout << " huli test :::: " << " task.get_task_statu() = " << task.get_task_statu() << std::endl;
-
-
-		auto end   = std::chrono::system_clock::now();
-		auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
-		std::cout <<  "花费了"
-			 << double(duration.count()*1000) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den   << "毫秒" << std::endl;
-		std::cout << " huli test :::: " << " std::chrono::microseconds::period::num = " << std::chrono::microseconds::period::num << std::endl;
-		std::cout << " huli test :::: " << " std::chrono::microseconds::period::den = " << std::chrono::microseconds::period::den << std::endl;
-		std::cout << " huli test :::: " << " duration.count() = " << duration.count() << std::endl;
-
-
-	}
-//	Wanji_manager::get_instance_references().wanji_manager_uninit();
-	std::cout << " huli test :::: " << " uninit = " << 999999 << std::endl;
-	return 0;
-
-
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	int t_terminal_id = 0;
-	if ( argc == 2 )
-	{
-		std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl;
-		t_terminal_id = atoi(argv[1]);
-	}
-	std::cout << " huli test :::: " << " t_terminal_id = " << t_terminal_id << std::endl;
-
-
-	Laser_manager::get_instance_references().laser_manager_init();
-	std::cout << "Laser_manager = " << Laser_manager::get_instance_references().get_laser_manager_status() << std::endl;
-	Locate_manager::get_instance_references().Locate_manager_init();
-	std::cout << "Locate_manager = " << Locate_manager::get_instance_references().get_locate_manager_status() << std::endl;
-	System_executor::get_instance_references().system_executor_init(4, t_terminal_id);
-	std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
-
-	System_communication::get_instance_references().communication_init();
-
 	char ch;
-	while ( 1 )
+	while (1)
 	{
-		std::cin >> ch ;
+		std::cin >> ch;
 
-		if ( ch == 'b' )
+		if (ch == 'b')
 		{
 			break;
 		}
 
-
 		//第一步, 创建点云缓存, 和 指定雷达,目前就一个
-		std::map<int,pcl::PointCloud<pcl::PointXYZ>::Ptr>		point_cloud_map;
+		std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> point_cloud_map;
 		std::mutex cloud_lock;
 
 		pcl::PointCloud<pcl::PointXYZ>::Ptr p_cloud(new pcl::PointCloud<pcl::PointXYZ>);
 
 		std::ifstream is;
 		is.open("/home/huli/huli/Terminal_project/hl_measure/Terminal_process_CT/test_data/car_cloud/20200907-084334_src - Cloud.txt", std::ios::out);
+		if(!is.is_open())
+			continue;
 		char t_buf[256];
-		while ( !is.eof() )
+		while (!is.eof())
 		{
 			is.getline(t_buf, 256);
 			pcl::PointXYZ t_point;
@@ -199,33 +80,30 @@ int main(int argc,char* argv[])
 
 			p_cloud->push_back(t_point);
 		}
-		std::cout << " huli test :::: " << " p_cloud->size() = " << p_cloud->size() << std::endl;
+		std::cout << " huli test :::: "
+				  << " p_cloud->size() = " << p_cloud->size() << std::endl;
 		point_cloud_map[0] = p_cloud;
 
-
-
-
-
-		Locate_manager_task locate_manager_task ;
+		Locate_manager_task locate_manager_task;
 		Common_data::Car_measure_information t_car_information_by_livox;
 
 		//第五步, 创建定位模块的任务单, 并发送到 Locate_manager
-		locate_manager_task.task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(15000),
-									  true,"/home/huli/huli/Terminal_project/hl_measure/Terminal_process_CT/data",
-									  &cloud_lock,&point_cloud_map, true	);
-		t_error = Task_command_manager::get_instance_references().execute_task(&locate_manager_task);
+		locate_manager_task.task_init(TASK_CREATED, "", NULL, std::chrono::milliseconds(15000),
+									  true, "/home/huli/huli/Terminal_project/hl_measure/Terminal_process_CT/data",
+									  &cloud_lock, &point_cloud_map, true);
+		Error_manager t_error = Task_command_manager::get_instance_references().execute_task(&locate_manager_task);
 
 		//第六步, 等待任务单完成
-		if ( t_error != Error_code::SUCCESS )
+		if (t_error != Error_code::SUCCESS)
 		{
 			LOG(INFO) << " Locate_manager  execute_task error ";
 		}
 		else
 		{
 			//判断任务是否结束, 阻塞 等待, 直到任务完成或者超时
-			while ( locate_manager_task.is_task_end() == false)
+			while (locate_manager_task.is_task_end() == false)
 			{
-				if ( locate_manager_task.is_over_time() )
+				if (locate_manager_task.is_over_time())
 				{
 					//超时处理。取消任务。
 					Locate_manager::get_instance_pointer()->cancel_task();
@@ -240,11 +118,10 @@ int main(int argc,char* argv[])
 					std::this_thread::sleep_for(std::chrono::microseconds(1));
 					std::this_thread::yield();
 				}
-
 			}
 			//提取任务单 的错误码
 			t_error = locate_manager_task.get_task_error_manager();
-			if ( t_error == Error_code::SUCCESS )
+			if (t_error == Error_code::SUCCESS)
 			{
 				t_car_information_by_livox.center_x = locate_manager_task.get_task_locate_information_ex()->locate_x;
 				t_car_information_by_livox.center_y = locate_manager_task.get_task_locate_information_ex()->locate_y;
@@ -257,74 +134,60 @@ int main(int argc,char* argv[])
 				t_car_information_by_livox.front_theta = 0;
 				t_car_information_by_livox.correctness = true;
 
-				std::cout << " huli test :::: " << " t_car_information_by_livox.center_x = " << t_car_information_by_livox.center_x << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.center_y = " << t_car_information_by_livox.center_y << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.car_angle = " << t_car_information_by_livox.car_angle << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.car_length = " << t_car_information_by_livox.car_length << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.car_width = " << t_car_information_by_livox.car_width << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.car_height = " << t_car_information_by_livox.car_height << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.wheel_base = " << t_car_information_by_livox.wheel_base << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.wheel_width = " << t_car_information_by_livox.wheel_width << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.front_theta = " << t_car_information_by_livox.front_theta << std::endl;
-				std::cout << " huli test :::: " << " t_car_information_by_livox.correctness = " << t_car_information_by_livox.correctness << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.center_x = " << t_car_information_by_livox.center_x << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.center_y = " << t_car_information_by_livox.center_y << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.car_angle = " << t_car_information_by_livox.car_angle << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.car_length = " << t_car_information_by_livox.car_length << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.car_width = " << t_car_information_by_livox.car_width << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.car_height = " << t_car_information_by_livox.car_height << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.wheel_base = " << t_car_information_by_livox.wheel_base << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.wheel_width = " << t_car_information_by_livox.wheel_width << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.front_theta = " << t_car_information_by_livox.front_theta << std::endl;
+				std::cout << " huli test :::: "
+						  << " t_car_information_by_livox.correctness = " << t_car_information_by_livox.correctness << std::endl;
 			}
 			else
 			{
-				LOG(INFO) << " locate_manager_task error :::::::"  << locate_manager_task.get_task_error_manager().to_string() ;
+				LOG(INFO) << " locate_manager_task error :::::::" << locate_manager_task.get_task_error_manager().to_string();
 			}
 		}
-
 	}
+}
 
-	System_communication::get_instance_references().communication_uninit();
-	System_executor::get_instance_references().system_executor_uninit();
-	Locate_manager::get_instance_references().Locate_manager_uninit();
-	Laser_manager::get_instance_references().laser_manager_uninit();
-
-	return 0;
-
-
-	LOG(INFO) << " --- main start --- " ;
-
-
-
-
-
-
-	std::cout << "huli 101 main start!" << std::endl;
-
-	std::cout << "1111111111111111111111" << std::endl;
-	Laser_manager::get_instance_pointer()->laser_manager_init();
-	Locate_manager::get_instance_pointer()->Locate_manager_init();
-
-	Point_sift_segmentation*                mp_point_sift;
+void prev_test_sample_pred_process()
+{
+	std::cout << "sample pred process" << std::endl;
+	Error_manager t_error;
+	Point_sift_segmentation *mp_point_sift;
 	int point_size = 8192;
 	int cls_num = 3;
 	double freq = 20.0;
 	std::string graph = "../model_param/seg_model_404500.ckpt.meta";
 	std::string cpkt = "../model_param/seg_model_404500.ckpt";
-	pcl::PointXYZ minp(-10000,-10000,-10000);
-	pcl::PointXYZ maxp(10000,10000,10000);
-
-
+	pcl::PointXYZ minp(-10000, -10000, -10000);
+	pcl::PointXYZ maxp(10000, 10000, 10000);
 
-
-	while(1)
+	while (1)
 	{
-
-
-
-
 		std::cout << "huli 401 connect_laser Error_code::SUCCESS" << std::endl;
 
 		std::cout << " press to start" << std::endl;
-		char ch ;
-//		= getchar();
+		char ch;
+		//		= getchar();
 
 		std::this_thread::sleep_for(std::chrono::seconds(2));
-		std::cin >> ch ;
+		std::cin >> ch;
 
-		if ( ch == 'b' )
+		if (ch == 'b')
 		{
 			std::cout << "  end scan ------------" << std::endl;
 			break;
@@ -332,11 +195,11 @@ int main(int argc,char* argv[])
 		std::cout << "  start scan ------------" << std::endl;
 
 		int n = 1;
-		while(n)
+		while (n)
 		{
 			n--;
 
-			std::map<int,pcl::PointCloud<pcl::PointXYZ>::Ptr>		point_cloud_map;
+			std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> point_cloud_map;
 			std::mutex cloud_lock;
 			std::vector<int> select_laser_id_vector;
 			select_laser_id_vector.push_back(0);
@@ -344,33 +207,30 @@ int main(int argc,char* argv[])
 			select_laser_id_vector.push_back(2);
 			select_laser_id_vector.push_back(3);
 
-
 			time_t nowTime;
 			nowTime = time(NULL);
-			struct tm* sysTime = localtime(&nowTime);
-			char t_save_path[256] = { 0 };
+			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);
 
-			Laser_manager_task * laser_manager_task = new Laser_manager_task;
-			laser_manager_task->task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(15000),
-										  true,t_save_path,&cloud_lock,&point_cloud_map,false,
-										  1000,false,select_laser_id_vector	);
-
-
+			Laser_manager_task *laser_manager_task = new Laser_manager_task;
+			laser_manager_task->task_init(TASK_CREATED, "", NULL, std::chrono::milliseconds(15000),
+										  true, t_save_path, &cloud_lock, &point_cloud_map, false,
+										  1000, false, select_laser_id_vector);
 
 			t_error = Task_command_manager::get_instance_references().execute_task(laser_manager_task);
-//			tp_laser_manager->execute_task(laser_manager_task);
+			//			tp_laser_manager->execute_task(laser_manager_task);
 
-			if ( t_error != Error_code::SUCCESS )
+			if (t_error != Error_code::SUCCESS)
 			{
 				std::cout << "huli Laser_manager:::::" << t_error.to_string() << std::endl;
 			}
 			else
 			{
-				while ( laser_manager_task->is_task_end() == false)
+				while (laser_manager_task->is_task_end() == false)
 				{
-					if ( laser_manager_task->is_over_time() )
+					if (laser_manager_task->is_over_time())
 					{
 						//超时处理。取消任务。
 						Laser_manager::get_instance_pointer()->cancel_task();
@@ -383,22 +243,14 @@ int main(int argc,char* argv[])
 					{
 						std::this_thread::yield();
 					}
-
 				}
-				std::cout << "huli task_error::::"  << laser_manager_task->get_task_error_manager().to_string() << std::endl;
-
+				std::cout << "huli task_error::::" << laser_manager_task->get_task_error_manager().to_string() << std::endl;
 			}
-			delete(laser_manager_task);
-
+			delete (laser_manager_task);
 
 			std::cout << "huli laser result---------------------" << t_error.to_string() << std::endl;
-			std::cout << "huli zczxczxczx---------------------" << t_error.to_string() << std::endl;
-			std::cout << "huli zczxczxczx---------------------" << t_error.to_string() << std::endl;
-			std::cout << "huli zczxczxczx---------------------" << t_error.to_string() << std::endl;
-
-
 
-/*
+			/*
 			pcl::PointCloud<pcl::PointXYZ>::Ptr scan_cloud ;
 			scan_cloud =  point_cloud_map[0];
 
@@ -416,20 +268,20 @@ int main(int argc,char* argv[])
 			std::cout << t_error.to_string() << std::endl;
 			*/
 
-			Locate_manager_task * locate_manager_task = new Locate_manager_task;
-			locate_manager_task->task_init(TASK_CREATED,"",NULL,std::chrono::milliseconds(15000),
-										   true,t_save_path,&cloud_lock,&point_cloud_map, false	);
+			Locate_manager_task *locate_manager_task = new Locate_manager_task;
+			locate_manager_task->task_init(TASK_CREATED, "", NULL, std::chrono::milliseconds(15000),
+										   true, t_save_path, &cloud_lock, &point_cloud_map, false);
 			t_error = Task_command_manager::get_instance_references().execute_task(locate_manager_task);
 
-			if ( t_error != Error_code::SUCCESS )
+			if (t_error != Error_code::SUCCESS)
 			{
 				std::cout << "huli Locate_manager:::::" << t_error.to_string() << std::endl;
 			}
 			else
 			{
-				while ( locate_manager_task->is_task_end() == false)
+				while (locate_manager_task->is_task_end() == false)
 				{
-					if ( locate_manager_task->is_over_time() )
+					if (locate_manager_task->is_over_time())
 					{
 						//超时处理。取消任务。
 						Locate_manager::get_instance_pointer()->cancel_task();
@@ -442,11 +294,9 @@ int main(int argc,char* argv[])
 					{
 						std::this_thread::yield();
 					}
-
 				}
 
-				std::cout << "huli task_error:::::"  << locate_manager_task->get_task_error_manager().to_string() << std::endl;
-
+				std::cout << "huli task_error:::::" << locate_manager_task->get_task_error_manager().to_string() << std::endl;
 
 				std::cout << "locate_x = " << locate_manager_task->get_task_locate_information_ex()->locate_x << std::endl;
 				std::cout << "locate_y = " << locate_manager_task->get_task_locate_information_ex()->locate_y << std::endl;
@@ -457,25 +307,69 @@ int main(int argc,char* argv[])
 				std::cout << "locate_wheel_width = " << locate_manager_task->get_task_locate_information_ex()->locate_wheel_width << std::endl;
 				std::cout << "locate_angle = " << locate_manager_task->get_task_locate_information_ex()->locate_angle << std::endl;
 				std::cout << "locate_correct = " << locate_manager_task->get_task_locate_information_ex()->locate_correct << std::endl;
-
-
 			}
-			delete(locate_manager_task);
+			delete (locate_manager_task);
 			std::cout << "huli locate result:::::" << t_error.to_string() << std::endl;
-
 		}
 
-		cout << "huli: 601 :" << t_error.to_string() << endl;
+		std::cout << "err code :" << t_error.to_string() << std::endl;
 		std::this_thread::sleep_for(std::chrono::seconds(2));
+	}
+}
+
+void test_whole_process()
+{
+	System_executor::get_instance_references().execute_for_measure("key_for_test_only", 5, std::chrono::system_clock::now());
+}
+
+int main(int argc,char* argv[])
+{
+	Error_manager t_error;
+	Error_manager t_result ;
+
+
+	const char* logPath = "./";
+	google::InitGoogleLogging("LidarMeasurement");
+	google::SetStderrLogging(google::INFO);
+	google::SetLogDestination(0, logPath);
+	google::SetLogFilenameExtension("zxlog");
+	google::InstallFailureSignalHandler();
+	google::InstallFailureWriter(&shut_down_logging);
+	FLAGS_colorlogtostderr = true;        // Set log color
+	FLAGS_logbufsecs = 0;                // Set log output speed(s)
+	FLAGS_max_log_size = 1024;            // Set max log file size(GB)
+	FLAGS_stop_logging_if_full_disk = true;
+
+	// Wanji_manager::get_instance_references().wanji_manager_init();
+	// std::cout << " huli test :::: " << " wanji_manager_init = " << 1 << std::endl;
 
+	// 定义服务的终端id
+	int t_terminal_id = 0;
+	if ( argc == 2 )
+	{
+		std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl;
+		t_terminal_id = atoi(argv[1]);
 	}
+	std::cout << " huli test :::: " << " t_terminal_id = " << t_terminal_id << std::endl;
 
-	Laser_manager::get_instance_pointer()->laser_manager_uninit();
-	Locate_manager::get_instance_pointer()->Locate_manager_uninit();
+	// 初始化
+	Laser_manager::get_instance_references().laser_manager_init();
+	std::cout << "Laser_manager = " << Laser_manager::get_instance_references().get_laser_manager_status() << std::endl;
+	Locate_manager::get_instance_references().Locate_manager_init();
+	std::cout << "Locate_manager = " << Locate_manager::get_instance_references().get_locate_manager_status() << std::endl;
+	System_executor::get_instance_references().system_executor_init(4, t_terminal_id);
+	std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
+
+	System_communication::get_instance_references().communication_init();
 
-	cout << "huli 1234 main end" << endl;
-	std::this_thread::sleep_for(std::chrono::seconds(3));
+	// prev_test_pred_task();
+	test_whole_process();
 
+	// 反初始化
+	System_communication::get_instance_references().communication_uninit();
+	System_executor::get_instance_references().system_executor_uninit();
+	Locate_manager::get_instance_references().Locate_manager_uninit();
+	Laser_manager::get_instance_references().laser_manager_uninit();
 
 	return 0;
 }

+ 1 - 1
proto.sh

@@ -7,4 +7,4 @@ protoc -I=./laser laser_message.proto --cpp_out=./laser
 protoc -I=./communication communication.proto --cpp_out=./communication
 
 protoc -I=./wanji_lidar wj_lidar_conf.proto --cpp_out=./wanji_lidar
-
+protoc -I=./verify hardware_limit.proto --cpp_out=./verify

+ 2 - 2
setting/communication.prototxt

@@ -24,8 +24,8 @@ communication_parameters
 
 #   connect_string_vector:"tcp://192.168.2.233:2333"
 
-bind_string:"tcp://192.168.2.168:30008"
-connect_string_vector:"tcp://192.168.2.183:30000"
+bind_string:"tcp://192.168.2.141:30008"
+connect_string_vector:"tcp://192.168.2.141:30000"
 
 
 }

+ 445 - 58
setting/laser.prototxt

@@ -1,86 +1,473 @@
 #1号雷达
 #  0TFDFG700601881  0TFDFCE00502001 0TFDH5L00684HE1  0TFDH5R006RCJ91
 
+#普爱8*3个雷达
 
+#1号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG410064MEB1"
+	frame_num:700
+    mat_r00:-0.0046481
+    mat_r01:-0.9979388
+    mat_r02:0.0640112
+    mat_r03:12200.509
+    mat_r10:0.3061189
+    mat_r11:0.0595189
+    mat_r12:0.9501309
+    mat_r13:-2345.693
+    mat_r20:-0.9519821
+    mat_r21:0.0240113
+    mat_r22:0.3052112
+    mat_r23:6720.61400
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG410064MEB2"
+	frame_num:700
+    mat_r00:-0.0046481
+    mat_r01:-0.9979388
+    mat_r02:0.0640112
+    mat_r03:12200.509
+    mat_r10:0.3061189
+    mat_r11:0.0595189
+    mat_r12:0.9501309
+    mat_r13:-2345.693
+    mat_r20:-0.9519821
+    mat_r21:0.0240113
+    mat_r22:0.3052112
+    mat_r23:6720.61400
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG410064MEB3"
+	frame_num:700
+    mat_r00:-0.0046481
+    mat_r01:-0.9979388
+    mat_r02:0.0640112
+    mat_r03:12200.509
+    mat_r10:0.3061189
+    mat_r11:0.0595189
+    mat_r12:0.9501309
+    mat_r13:-2345.693
+    mat_r20:-0.9519821
+    mat_r21:0.0240113
+    mat_r22:0.3052112
+    mat_r23:6720.61400
+}
+#2号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1F006V2WU1"
+	frame_num:500
+    mat_r00:0.0135042 
+    mat_r01:0.9988871 
+    mat_r02:0.0451919 
+    mat_r03:12198.162 
+    mat_r10:-0.3850948
+    mat_r11:0.0469052 
+    mat_r12:-0.9216841
+    mat_r13:3545.251  
+    mat_r20:-0.9227782
+    mat_r21:-0.0049566
+    mat_r22:0.3852997 
+    mat_r23:6738.30800
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1F006V2WU2"
+	frame_num:500
+    mat_r00:0.0135042 
+    mat_r01:0.9988871 
+    mat_r02:0.0451919 
+    mat_r03:12198.162 
+    mat_r10:-0.3850948
+    mat_r11:0.0469052 
+    mat_r12:-0.9216841
+    mat_r13:3545.251  
+    mat_r20:-0.9227782
+    mat_r21:-0.0049566
+    mat_r22:0.3852997 
+    mat_r23:6738.30800
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1F006V2WU3"
+	frame_num:500
+    mat_r00:0.0135042 
+    mat_r01:0.9988871 
+    mat_r02:0.0451919 
+    mat_r03:12198.162 
+    mat_r10:-0.3850948
+    mat_r11:0.0469052 
+    mat_r12:-0.9216841
+    mat_r13:3545.251  
+    mat_r20:-0.9227782
+    mat_r21:-0.0049566
+    mat_r22:0.3852997 
+    mat_r23:6738.30800
+}
+#3号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006N93N1"
+	frame_num:700
+    mat_r00:0.0229183
+    mat_r01:-0.9985044
+    mat_r02:0.0496393
+    mat_r03:5287.829
+    mat_r10:0.2763783
+    mat_r11:0.0540452
+    mat_r12:0.9595283
+    mat_r13:-2399.535
+    mat_r20:-0.9607757
+    mat_r21:-0.0082715
+    mat_r22:0.2772034
+    mat_r23:6674.29500
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006N93N2"
+	frame_num:700
+    mat_r00:0.0229183
+    mat_r01:-0.9985044
+    mat_r02:0.0496393
+    mat_r03:5287.829
+    mat_r10:0.2763783
+    mat_r11:0.0540452
+    mat_r12:0.9595283
+    mat_r13:-2399.535
+    mat_r20:-0.9607757
+    mat_r21:-0.0082715
+    mat_r22:0.2772034
+    mat_r23:6674.29500
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006N93N3"
+	frame_num:700
+    mat_r00:0.0229183
+    mat_r01:-0.9985044
+    mat_r02:0.0496393
+    mat_r03:5287.829
+    mat_r10:0.2763783
+    mat_r11:0.0540452
+    mat_r12:0.9595283
+    mat_r13:-2399.535
+    mat_r20:-0.9607757
+    mat_r21:-0.0082715
+    mat_r22:0.2772034
+    mat_r23:6674.29500
+}
+#4号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006G4621"
+	frame_num:500
+    mat_r00:0.0126959
+    mat_r01:0.9992238
+    mat_r02:-0.0372968
+    mat_r03:5264.606 
+    mat_r10:-0.3767520
+    mat_r11:-0.0297706
+    mat_r12:-0.9258357
+    mat_r13:3559.158
+    mat_r20:-0.9262271
+    mat_r21:0.0258060
+    mat_r22:0.3760815
+    mat_r23:6721.93300
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006G4622"
+	frame_num:500
+    mat_r00:0.0126959
+    mat_r01:0.9992238
+    mat_r02:-0.0372968
+    mat_r03:5264.606 
+    mat_r10:-0.3767520
+    mat_r11:-0.0297706
+    mat_r12:-0.9258357
+    mat_r13:3559.158
+    mat_r20:-0.9262271
+    mat_r21:0.0258060
+    mat_r22:0.3760815
+    mat_r23:6721.93300
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006G4623"
+	frame_num:500
+    mat_r00:0.0126959
+    mat_r01:0.9992238
+    mat_r02:-0.0372968
+    mat_r03:5264.606 
+    mat_r10:-0.3767520
+    mat_r11:-0.0297706
+    mat_r12:-0.9258357
+    mat_r13:3559.158
+    mat_r20:-0.9262271
+    mat_r21:0.0258060
+    mat_r22:0.3760815
+    mat_r23:6721.93300
+}
+#5号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006MNJG1"
+	frame_num:1100
+    mat_r00:0.3164810
+    mat_r01:-0.9480029
+    mat_r02:0.0336194
+    mat_r03:-1620.378
+    mat_r10:0.2050821
+    mat_r11:0.1029815
+    mat_r12:0.9733119
+    mat_r13:-2364.715
+    mat_r20:-0.9261647
+    mat_r21:-0.3011400
+    mat_r22:0.2270101
+    mat_r23:6703.779000
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006MNJG2"
+	frame_num:1100
+    mat_r00:0.3164810
+    mat_r01:-0.9480029
+    mat_r02:0.0336194
+    mat_r03:-1620.378
+    mat_r10:0.2050821
+    mat_r11:0.1029815
+    mat_r12:0.9733119
+    mat_r13:-2364.715
+    mat_r20:-0.9261647
+    mat_r21:-0.3011400
+    mat_r22:0.2270101
+    mat_r23:6703.779000
+}
 
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006MNJG3"
+	frame_num:1100
+    mat_r00:0.3164810
+    mat_r01:-0.9480029
+    mat_r02:0.0336194
+    mat_r03:-1620.378
+    mat_r10:0.2050821
+    mat_r11:0.1029815
+    mat_r12:0.9733119
+    mat_r13:-2364.715
+    mat_r20:-0.9261647
+    mat_r21:-0.3011400
+    mat_r22:0.2270101
+    mat_r23:6703.779000
+}
 
+#6号雷达
 laser_parameters
 {
 	type:"Livox"
-	sn:"0TFDFG700601881"
+	is_save_txt:false
+	sn:"1LVDFCE00504461"
 	frame_num:1000
-    mat_r00:1
-    mat_r01:0
-    mat_r02:0
-    mat_r03:0
-    mat_r10:0
-    mat_r11:1
-    mat_r12:0
-    mat_r13:0
-    mat_r20:0
-    mat_r21:0
-    mat_r22:1
-    mat_r23:0
+    mat_r00:0.2753770
+    mat_r01:0.9612699
+    mat_r02:0.0113092
+    mat_r03:-1641.832
+    mat_r10:-0.4067668
+    mat_r11:0.1271702
+    mat_r12:-0.9046370
+    mat_r13:3503.771
+    mat_r20:-0.8710384
+    mat_r21:0.2445160
+    mat_r22:0.4260324
+    mat_r23:6717.29800
 }
-
-
 laser_parameters
 {
 	type:"Livox"
-	sn:"0TFDFCE00502001"
+	is_save_txt:false
+	sn:"1LVDFCE00504462"
 	frame_num:1000
-    mat_r00:1
-    mat_r01:0
-    mat_r02:0
-    mat_r03:0
-    mat_r10:0
-    mat_r11:1
-    mat_r12:0
-    mat_r13:0
-    mat_r20:0
-    mat_r21:0
-    mat_r22:1
-    mat_r23:0
+    mat_r00:0.2753770
+    mat_r01:0.9612699
+    mat_r02:0.0113092
+    mat_r03:-1641.832
+    mat_r10:-0.4067668
+    mat_r11:0.1271702
+    mat_r12:-0.9046370
+    mat_r13:3503.771
+    mat_r20:-0.8710384
+    mat_r21:0.2445160
+    mat_r22:0.4260324
+    mat_r23:6717.29800
 }
-
-
-
 laser_parameters
 {
 	type:"Livox"
-	sn:"0TFDH5L00684HE1"
+	is_save_txt:false
+	sn:"1LVDFCE00504463"
 	frame_num:1000
-    mat_r00:1
-    mat_r01:0
-    mat_r02:0
-    mat_r03:0
-    mat_r10:0
-    mat_r11:1
-    mat_r12:0
-    mat_r13:0
-    mat_r20:0
-    mat_r21:0
-    mat_r22:1
-    mat_r23:0
+    mat_r00:0.2753770
+    mat_r01:0.9612699
+    mat_r02:0.0113092
+    mat_r03:-1641.832
+    mat_r10:-0.4067668
+    mat_r11:0.1271702
+    mat_r12:-0.9046370
+    mat_r13:3503.771
+    mat_r20:-0.8710384
+    mat_r21:0.2445160
+    mat_r22:0.4260324
+    mat_r23:6717.29800
 }
 
+#7号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG190069Q141"
+	frame_num:1100
+    mat_r00:-0.2873471
+    mat_r01:-0.9572698
+    mat_r02:0.0326608
+    mat_r03:19060.742
+    mat_r10:0.2812832
+    mat_r11:-0.0517402
+    mat_r12:0.9582292
+    mat_r13:-2301.871
+    mat_r20:-0.9155936
+    mat_r21:0.2845312
+    mat_r22:0.2841312
+    mat_r23:6652.31000
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG190069Q142"
+	frame_num:1100
+    mat_r00:-0.2873471
+    mat_r01:-0.9572698
+    mat_r02:0.0326608
+    mat_r03:19060.742
+    mat_r10:0.2812832
+    mat_r11:-0.0517402
+    mat_r12:0.9582292
+    mat_r13:-2301.871
+    mat_r20:-0.9155936
+    mat_r21:0.2845312
+    mat_r22:0.2841312
+    mat_r23:6652.31000
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG190069Q143"
+	frame_num:1100
+    mat_r00:-0.2873471
+    mat_r01:-0.9572698
+    mat_r02:0.0326608
+    mat_r03:19060.742
+    mat_r10:0.2812832
+    mat_r11:-0.0517402
+    mat_r12:0.9582292
+    mat_r13:-2301.871
+    mat_r20:-0.9155936
+    mat_r21:0.2845312
+    mat_r22:0.2841312
+    mat_r23:6652.31000
+}
 
-
+#8号雷达
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006Y27R1"
+	frame_num:1000
+    mat_r00:-0.2963634
+    mat_r01:0.9547403
+    mat_r02:-0.0252988
+    mat_r03:19077.359
+    mat_r10:-0.2261306
+    mat_r11:-0.0958803
+    mat_r12:-0.9693665
+    mat_r13:3570.490
+    mat_r20:-0.9279189
+    mat_r21:-0.2815638
+    mat_r22:0.2443113
+    mat_r23:6680.68600
+}
+laser_parameters
+{
+	type:"Livox"
+	is_save_txt:false
+	sn:"1LVDG1S006Y27R2"
+	frame_num:1000
+    mat_r00:-0.2963634
+    mat_r01:0.9547403
+    mat_r02:-0.0252988
+    mat_r03:19077.359
+    mat_r10:-0.2261306
+    mat_r11:-0.0958803
+    mat_r12:-0.9693665
+    mat_r13:3570.490
+    mat_r20:-0.9279189
+    mat_r21:-0.2815638
+    mat_r22:0.2443113
+    mat_r23:6680.68600
+}
 laser_parameters
 {
 	type:"Livox"
-	sn:"0TFDH5R006RCJ91"
+	is_save_txt:false
+	sn:"1LVDG1S006Y27R3"
 	frame_num:1000
-    mat_r00:1
-    mat_r01:0
-    mat_r02:0
-    mat_r03:0
-    mat_r10:0
-    mat_r11:1
-    mat_r12:0
-    mat_r13:0
-    mat_r20:0
-    mat_r21:0
-    mat_r22:1
-    mat_r23:0
+    mat_r00:-0.2963634
+    mat_r01:0.9547403
+    mat_r02:-0.0252988
+    mat_r03:19077.359
+    mat_r10:-0.2261306
+    mat_r11:-0.0958803
+    mat_r12:-0.9693665
+    mat_r13:3570.490
+    mat_r20:-0.9279189
+    mat_r21:-0.2815638
+    mat_r22:0.2443113
+    mat_r23:6680.68600
 }

+ 47 - 54
setting/locate.prototxt

@@ -1,54 +1,47 @@
-area{
- #   x_min:-1227.5
- #   x_max:1802.9
- #   y_min:-2789.8
- #   y_max:3777.19
-  #  z_min:0
-  #  z_max:1800
-
-        x_min:-1000000
-        x_max:1000000
-        y_min:-1000000
-        y_max:1000000
-        z_min:-1000000
-        z_max:1000000
-}
-
-net_3dcnn_parameter
-{
-    length:0.224
-    width:0.224
-    height:0.096
-    freq:0.025
-    nclass:3
-    weights_file:"./setting/3dcnn_model.pb"
-}
-
-seg_parameter
-{
-    point_size:8192
-    cls_num:2
-    freq:0.020
-    area
-    {
-        x_min:-100000.0
-    	x_max:100000.0
-    	y_min:-100000.0
-    	y_max:100000.0
-    	z_min:-100000.0
-    	z_max:100000.0
-    }
-    graph:"../model_param/seg_model_404500.ckpt.meta"
-    cpkt:"../model_param/seg_model_404500.ckpt"
-}
-
-yolo_parameter
-{
-    cfg:"./setting/yolov3-spot2.cfg"
-    weights:"./setting/yolov3-spot2_12000.weights"
-    min_x:-1227.5
-    max_x:10802.9
-    min_y:-2789.8
-    max_y:3777.19
-    freq:25.
-}
+area{
+    x_min:-1227.5
+    x_max:1802.9
+    y_min:-2789.8
+    y_max:3777.19
+    z_min:0
+    z_max:1800
+}
+
+net_3dcnn_parameter
+{
+    length:224
+    width:224
+    height:96
+    freq:25
+    nclass:3
+    weights_file:"../setting/3dcnn_model.pb"
+}
+
+seg_parameter
+{
+    point_size:8192
+    cls_num:3
+    freq:50.0
+    area
+    {
+        x_min:-1227.50
+    	x_max:1802.9
+    	y_min:-2789.8
+    	y_max:3777.19
+    	z_min:0
+    	z_max:1800
+    }
+    graph:"../setting/seg_model_9000.ckpt.meta"
+    cpkt:"../setting/seg_model_9000.ckpt"
+}
+
+yolo_parameter
+{
+    cfg:"../setting/yolov3-spot2.cfg"
+    weights:"../setting/yolov3-spot2_12000.weights"
+    min_x:-1227.5
+    max_x:10802.9
+    min_y:-2789.8
+    max_y:3777.19
+    freq:25.
+}

+ 10 - 165
system/system_executor.cpp

@@ -472,7 +472,6 @@ void System_executor::execute_for_measure(std::string command_info, int terminal
 					std::this_thread::sleep_for(std::chrono::microseconds(1));
 					std::this_thread::yield();
 				}
-
 			}
 			//提取任务单 的错误码
 			t_error = locate_manager_task.get_task_error_manager();
@@ -497,116 +496,6 @@ void System_executor::execute_for_measure(std::string command_info, int terminal
 	}
 	t_result.compare_and_cover_error(t_error);
 
-
-	//第7步, 创建万集管理模块的任务单, 并发送到 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(15000),
-								   terminal_id, receive_time);
-	t_error = Task_command_manager::get_instance_references().execute_task(&t_wanji_manager_task);
-
-
-	//第8步, 等待任务单完成
-	if ( t_error != Error_code::SUCCESS )
-	{
-		LOG(INFO) << " Wanji_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_wanji_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;
-		}
-	}
-	t_result.compare_and_cover_error(t_error);
-
-
-	//measure 测量模块的最终结果
-	Common_data::Car_measure_information	t_car_information_result;
-	//第9步, 对比livox和万集的, 并且进行校验
-	//都成功则选最优解, 返回成功
-	//其中一个构成, 就返回一个数据, 并返回错误码, 降级为一级故障
-	//都失败就直接返回错误码,
-	if ( t_car_information_by_livox.correctness == true && t_car_information_by_wanji.correctness == true )
-	{
-		//2个都有效时, 进行对比
-		float offset_x = fabs(t_car_information_by_livox.center_x - t_car_information_by_wanji.center_x);
-		float offset_y = fabs(t_car_information_by_livox.center_y - t_car_information_by_wanji.center_y);
-		float offset_angle = fabs(t_car_information_by_livox.car_angle - t_car_information_by_wanji.car_angle);
-		float offset_wheel_width = fabs(t_car_information_by_livox.wheel_width - t_car_information_by_wanji.wheel_width);
-		float offset_wheel_base = fabs(t_car_information_by_livox.wheel_base - t_car_information_by_wanji.wheel_base);
-		if (offset_x > 100 || offset_y > 150 || offset_angle > 3 || offset_wheel_base > 550 || offset_wheel_width > 250) {
-			LOG(WARNING) << "chekc failed. (offset x>100, y>150, angle>3, wheel_base>550, width>250): " << offset_x
-						 << " " << offset_y << " " << offset_angle << " " << offset_wheel_base << " " << offset_wheel_width;
-			t_error =  Error_manager(TERMINOR_CHECK_RESULTS_ERROR, MINOR_ERROR, "check results failed ");
-			t_result.compare_and_cover_error(t_error);
-		}
-		else
-		{
-			///根据sigmod函数计算角度权重
-			double angle_weight=1.0-1.0/(1.0+exp(-offset_angle/1.8));
-			///根据两个结果选择最优结果,中心点选择万集雷达,角度选择两值加权,轴距已以2750为基准作卡尔曼滤波
-			///车长以大疆雷达为准,车宽以万集雷达为准,高以大疆雷达为准
-			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 =angle_weight * t_car_information_by_wanji.car_angle +
-												(1.0-angle_weight) * t_car_information_by_livox.car_angle;
-
-			t_car_information_result.car_length = t_car_information_by_livox.car_length;
-			t_car_information_result.car_width = t_car_information_by_livox.car_width;
-			t_car_information_result.car_height = t_car_information_by_livox.car_height;
-
-			float dj_distance = fabs(t_car_information_by_livox.wheel_base - 2750);
-			float wj_distance = fabs(t_car_information_by_wanji.wheel_base - 2750);
-			float weight_dj = wj_distance / (dj_distance + wj_distance);
-			float weight_wj = dj_distance / (dj_distance + wj_distance);
-			t_car_information_result.wheel_base = weight_dj * t_car_information_by_livox.wheel_base +
-													  weight_wj * t_car_information_by_wanji.wheel_base;
-			t_car_information_result.wheel_base=t_car_information_result.wheel_base>3000?3000:t_car_information_result.wheel_base;
-
-			t_car_information_result.wheel_width = t_car_information_by_wanji.wheel_width;
-			t_car_information_result.correctness = true;
-		}
-	}
-	else if( t_car_information_by_livox.correctness == true && t_car_information_by_wanji.correctness == false )
-	{
-		t_car_information_result = t_car_information_by_livox;
-		t_result.set_error_level_down(NEGLIGIBLE_ERROR);
-	}
-	else if( t_car_information_by_livox.correctness == false && t_car_information_by_wanji.correctness == true )
-	{
-		Common_data::copy_data(t_car_information_by_wanji, t_car_information_result);
-		t_result.set_error_level_down(NEGLIGIBLE_ERROR);
-	}
-
-
-
 	//第七步, 创建一条答复消息
 	message::Measure_response_msg t_measure_response_msg;
 	t_measure_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eLocate_response_msg);
@@ -620,16 +509,16 @@ void System_executor::execute_for_measure(std::string command_info, int terminal
 	t_measure_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_result.get_error_level());
 	t_measure_response_msg.mutable_error_manager()->set_error_description(t_result.get_error_description(), t_result.get_description_length());
 
-	t_measure_response_msg.mutable_locate_information()->set_locate_x(t_car_information_result.center_x);
-	t_measure_response_msg.mutable_locate_information()->set_locate_y(t_car_information_result.center_y);
-	t_measure_response_msg.mutable_locate_information()->set_locate_angle(t_car_information_result.car_angle);
-	t_measure_response_msg.mutable_locate_information()->set_locate_length(t_car_information_result.car_length);
-	t_measure_response_msg.mutable_locate_information()->set_locate_width(t_car_information_result.car_width);
-	t_measure_response_msg.mutable_locate_information()->set_locate_height(t_car_information_result.car_height);
-	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_base(t_car_information_result.wheel_base);
-	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_width(t_car_information_result.wheel_width);
-	t_measure_response_msg.mutable_locate_information()->set_locate_front_theta(t_car_information_result.front_theta);
-	t_measure_response_msg.mutable_locate_information()->set_locate_correct(t_car_information_result.correctness);
+	t_measure_response_msg.mutable_locate_information()->set_locate_x(t_car_information_by_livox.center_x);
+	t_measure_response_msg.mutable_locate_information()->set_locate_y(t_car_information_by_livox.center_y);
+	t_measure_response_msg.mutable_locate_information()->set_locate_angle(t_car_information_by_livox.car_angle);
+	t_measure_response_msg.mutable_locate_information()->set_locate_length(t_car_information_by_livox.car_length);
+	t_measure_response_msg.mutable_locate_information()->set_locate_width(t_car_information_by_livox.car_width);
+	t_measure_response_msg.mutable_locate_information()->set_locate_height(t_car_information_by_livox.car_height);
+	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_base(t_car_information_by_livox.wheel_base);
+	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_width(t_car_information_by_livox.wheel_width);
+	t_measure_response_msg.mutable_locate_information()->set_locate_front_theta(t_car_information_by_livox.front_theta);
+	t_measure_response_msg.mutable_locate_information()->set_locate_correct(t_car_information_by_livox.correctness);
 
 
 	string t_msg = t_measure_response_msg.SerializeAsString();
@@ -637,53 +526,9 @@ void System_executor::execute_for_measure(std::string command_info, int terminal
 
 	std::cout << "huli t_measure_response_msg = " << t_measure_response_msg.DebugString() << std::endl;
 
-
-	return ;
-
-
-
-
-
-
-
-/*
-	message::Measure_response_msg t_measure_response_msg;
-	t_measure_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eLocate_response_msg);
-	t_measure_response_msg.mutable_base_info()->set_timeout_ms(5000);
-	t_measure_response_msg.mutable_base_info()->set_sender(message::Communicator::eMeasurer);
-	t_measure_response_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
-
-	t_measure_response_msg.set_command_key(command_info);
-	t_measure_response_msg.set_terminal_id(terminal_id);
-	t_measure_response_msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
-	t_measure_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
-	t_measure_response_msg.mutable_error_manager()->set_error_description(t_error.get_error_description(), t_error.get_description_length());
-
-	if ( t_error == Error_code::SUCCESS )
-	{
-		t_measure_response_msg.mutable_locate_information()->set_locate_x(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_y(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_angle(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_length(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_width(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_height(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_wheel_base(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_wheel_width(0);
-		t_measure_response_msg.mutable_locate_information()->set_locate_correct(0);
-	}
-
-	string t_msg = t_measure_response_msg.SerializeAsString();
-	System_communication::get_instance_references().encapsulate_msg(t_msg);
-
-	std::cout << "huli t_measure_response_msg = " << t_measure_response_msg.DebugString() << std::endl;
-*/
-
 	return ;
 }
 
-
-
-
 //签收预测的答复消息, (不能传引用)
 void System_executor::execute_for_predict(std::string message_string)
 {

+ 0 - 46
test.txt

@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 63 - 0
verify/Railing.cpp

@@ -0,0 +1,63 @@
+//
+// Created by zx on 2020/1/10.
+//
+
+#include "Railing.h"
+
+/*
+     * 构造函数
+     * a,b,c代表栏杆所在直线方程, ax+by+c=0
+     * width:表示栏杆的宽
+     */
+Railing::Railing(float a,float b,float c,float width)
+{
+    m_a=a;
+    m_b=b;
+    m_c=c;
+    m_width=width;
+}
+/*
+ * 检验结果框,是否会与栏杆冲突
+ */
+Error_manager Railing::verify(cv::RotatedRect rotate_rect)
+{
+    //检验内部参数是否合法
+    if(m_a==0 && m_b==0)
+    {
+        return Error_manager(HARDWARE_LIMIT_RAILING_PARAMETER_ERROR,NORMAL,"railing parameter a&b = 0");
+    }
+    //第一步,获取旋转矩形四个顶角
+    cv::Point2f vertice[4];
+    rotate_rect.points(vertice);
+    //第二步.判断四个顶点是否在栏杆不同侧面,且与直线距离<m_width
+    bool limit_left=false;
+    bool limit_right=false;
+    for(int i=0;i<4;++i)
+    {
+        //计算顶点与直线的距离
+        cv::Point2f point=vertice[i];
+        float x=point.x;
+        float y=point.y;
+        float distance=fabs(m_a*x+m_b*y+m_c)/sqrt(m_a*m_a+m_b*m_b);
+        if(distance<m_width)
+        {
+            //顶点在栏杆上,必定会碰撞
+            return Error_manager(HARDWARE_LIMIT_RAILING_ERROR,NORMAL,"railing error");
+        }
+        else
+        {
+            //顶点在直线右边
+            if(m_a*x+m_b*y+m_c>0)
+                limit_right=true;
+            else if(m_a*x+m_b*y+m_c<0)
+                limit_left=true;
+
+        }
+    }
+    //如果左右都有顶点, 则与栏杆碰撞
+    if(limit_left==true && limit_right==true)
+    {
+        return Error_manager(HARDWARE_LIMIT_RAILING_ERROR,NORMAL,"railing error");
+    }
+    return SUCCESS;
+}

+ 33 - 0
verify/Railing.h

@@ -0,0 +1,33 @@
+//
+// Created by zx on 2020/1/10.
+//
+
+#ifndef RAILING_H
+#define RAILING_H
+#include "../error_code/error_code.h"
+#include <opencv2/opencv.hpp>
+/*
+ * 栏杆类, 用于判断旋转矩形是否与栏杆有重叠区域
+ */
+class Railing
+{
+public:
+    /*
+     * 构造函数
+     * a,b,c代表栏杆所在直线方程, ax+by+c=0
+     * width:表示栏杆的宽
+     */
+    Railing(float a,float b,float c,float width);
+    /*
+     * 检验结果框,是否会与栏杆冲突
+     */
+    Error_manager verify(cv::RotatedRect rotate_rect);
+private:
+    float m_a;
+    float m_b;
+    float m_c;
+    float m_width;
+};
+
+
+#endif //RAILING_H

+ 46 - 0
verify/Terminal_region_limit.cpp

@@ -0,0 +1,46 @@
+//
+// Created by zx on 2020/1/16.
+//
+
+#include "Terminal_region_limit.h"
+
+Terminal_region_limit::Terminal_region_limit(Railing* left_railing,Railing* right_railing)
+{
+    mp_left_railing=left_railing;
+    mp_right_railing=right_railing;
+}
+Error_manager Terminal_region_limit::verify(cv::RotatedRect rect)
+{
+    if(mp_right_railing==NULL || mp_left_railing==NULL)
+    {
+        return Error_manager(PARAMETER_ERROR,NORMAL,"terminal left or right railing is null");
+    }
+    Error_manager code;
+    bool tb_left_error=false;
+    bool tb_right_error=false;
+    code=mp_left_railing->verify(rect);
+    if(code!=SUCCESS)
+    {
+        //左边栏杆碰撞
+        tb_left_error=true;
+    }
+    code=mp_right_railing->verify(rect);
+    if(code!=SUCCESS)
+    {
+        //右边栏杆碰撞
+        tb_right_error=true;
+    }
+    if(tb_left_error && tb_right_error)
+    {
+        return Error_manager(HARDWARE_LIMIT_TERMINAL_LR_ERROR,NORMAL,"terminal left and right railing error");
+    }
+    if(tb_left_error)
+    {
+        return Error_manager(HARDWARE_LIMIT_TERMINAL_LEFT_ERROR,NORMAL,"terminal left railing error");
+    }
+    if(tb_right_error)
+    {
+        return Error_manager(HARDWARE_LIMIT_TERMINAL_RIGHT_ERROR,NORMAL,"terminal right railing error");
+    }
+    return SUCCESS;
+}

+ 25 - 0
verify/Terminal_region_limit.h

@@ -0,0 +1,25 @@
+//
+// Created by zx on 2020/1/16.
+//
+
+#ifndef TERMINAL_REGION_LIMIT_H
+#define TERMINAL_REGION_LIMIT_H
+#include "Railing.h"
+
+class Terminal_region_limit
+{
+    Terminal_region_limit(Railing* left_railing,Railing* right_railing);
+    /*
+     * 检验是否碰撞左右栏杆,
+     * 返回结果:左边碰撞,右边碰撞,左右都碰撞,正确
+     */
+    Error_manager verify(cv::RotatedRect rect);
+protected:
+    //左边栏杆
+    Railing*                     mp_left_railing;
+    //右边栏杆
+    Railing*                     mp_right_railing;
+};
+
+
+#endif //TERMINAL_REGION_LIMIT_H

+ 258 - 0
verify/Verify_result.cpp

@@ -0,0 +1,258 @@
+//
+// Created by zx on 2020/1/10.
+//
+
+#include "Verify_result.h"
+#include <glog/logging.h>
+
+
+/*
+ * 显示rotate rect
+ */
+
+void display(cv::RotatedRect rect,cv::Scalar color)
+{
+    return ;
+    cv::Point2f points_src[4];
+    rect.points(points_src);
+
+    cv::Mat image=cv::Mat::zeros(1000,500,CV_8UC3);
+    cv::RotatedRect t_rect=rect;
+    t_rect.center=cv::Point2f(250,500);
+    t_rect.size.width/=10.0;
+    t_rect.size.height/=10.0;
+    cv::Point2f points[4];
+    t_rect.points(points);
+    float min_x=10000,max_x=0;
+    for(int i=0;i<4;++i)
+    {
+        if(points_src[i].x<min_x)
+            min_x=points_src[i].x;
+        if(points_src[i].x>max_x)
+            max_x=points_src[i].x;
+        cv::line(image, points[i%4],points[(i+1)%4],color,2);
+    }
+    char buf[255]={0};
+    sprintf(buf,"(%.1f,%.1f)[%.1f,%.1f] c:%.1f",t_rect.size.height*10.0,t_rect.size.width*10.0,min_x,max_x,t_rect.angle);
+    cv::putText(image,buf,cv::Point(10,50),1,1.0,color);
+    cv::namedWindow("debug",0);
+    cv::imshow("debug",image);
+    cv::waitKey(0);
+}
+
+
+/*
+     * 构造函数
+     * parameter:硬件限制配置参数
+     */
+Verify_result::Verify_result(Hardware_limit::Hardware_parameter parameter)
+{
+    m_hardware_parameter=parameter;
+}
+/*
+ * 检验硬件限制
+ * rotate_rect:待检验的旋转矩形
+ */
+Error_manager Verify_result::verify(cv::RotatedRect rotate_rect,float height,bool verify_vertex)
+{
+    //-2300   3450
+    cv::Point2f t_corners[4];
+    rotate_rect.points(t_corners);
+
+    //第一步,检验边界
+    float corner_min_y=m_hardware_parameter.corner_min_y();
+    float corner_max_y=m_hardware_parameter.corner_max_y();
+    float center_minx=m_hardware_parameter.center_min_x();
+    float center_maxx=m_hardware_parameter.center_max_x();
+    float center_miny=m_hardware_parameter.center_min_y();
+    float center_maxy=m_hardware_parameter.center_max_y();
+    float center_x=rotate_rect.center.x;
+    float center_y=rotate_rect.center.y;
+    //左超界
+    if(center_x<center_minx)
+    {
+        return Error_manager(HARDWARE_LIMIT_CENTER_X_LEFT,NORMAL,"left limit");
+    }
+    //右超界
+    if(center_x>center_maxx)
+    {
+        return Error_manager(HARDWARE_LIMIT_CENTER_X_RIGHT,NORMAL,"right limit");
+    }
+    //前超界
+    if(center_y>center_maxy)
+    {
+        return Error_manager(HARDWARE_LIMIT_CENTER_Y_TOP,NORMAL,"top limit");
+    }
+    for(int i=0;i<4;++i)
+    {
+        if(t_corners[i].y>corner_max_y)
+        {
+            return Error_manager(HARDWARE_LIMIT_CENTER_Y_TOP,NORMAL,"corner top limit");
+        }
+    }
+    //后超界
+    if(center_y<center_miny)
+    {
+        return Error_manager(HARDWARE_LIMIT_CENTER_Y_BOTTOM,NORMAL,"bottom limit");
+    }
+    for(int i=0;i<4;++i)
+    {
+        if(t_corners[i].y<corner_min_y)
+        {
+            return Error_manager(HARDWARE_LIMIT_CENTER_Y_BOTTOM,NORMAL,"corner bottom limit");
+        }
+    }
+    //第二步,检验高度
+    if(height>m_hardware_parameter.height())
+    {
+        char description[255]={0};
+        sprintf(description,"locate height is out of range(%.2f),height:%.2f",m_hardware_parameter.height(),height);
+        return Error_manager(HARDWARE_LIMIT_HEIGHT_OUT_RANGE,NORMAL,description);
+    }
+    //第三步,检验角度
+    //计算角度到 0-180
+    // 长边向量
+    cv::Point2f vec;
+    cv::Point2f vertice[4];
+    rotate_rect.points(vertice);
+
+    float len1 = pow(vertice[0].x - vertice[1].x, 2.0) + pow(vertice[0].y - vertice[1].y, 2.0);
+    float len2 = pow(vertice[1].x - vertice[2].x, 2.0) + pow(vertice[1].y - vertice[2].y, 2.0);
+    // 寻找长边,倾角为长边与x轴夹角
+    if (len1 > len2)
+    {
+        vec.x = vertice[0].x - vertice[1].x;
+        vec.y = vertice[0].y - vertice[1].y;
+    }
+    else
+    {
+        vec.x = vertice[1].x - vertice[2].x;
+        vec.y = vertice[1].y - vertice[2].y;
+    }
+    float angle_x = 180.0 / M_PI * acos(vec.x / sqrt(vec.x * vec.x + vec.y * vec.y));
+    bool tb_theta_verify=false;
+    for(int i=0;i<m_hardware_parameter.theta_range_size();++i)
+    {
+        Hardware_limit::Theta_range theta_range=m_hardware_parameter.theta_range(i);
+        float min_theta=theta_range.min_theta();
+        float max_theta=theta_range.max_theta();
+        //角度检验, 根据plc限制
+        if( angle_x>=min_theta&&angle_x<=max_theta)
+        {
+            tb_theta_verify = true;
+        }
+    }
+    if(tb_theta_verify==false)
+    {
+        char description[255]={0};
+        sprintf(description,"locate theta is out of range,theta:%.2f",angle_x);
+        return Error_manager(HARDWARE_LIMIT_ANGLE_OUT_RANGE,NORMAL,description);
+    }
+    //是否检验顶点与栏杆的碰撞
+    if(verify_vertex==false)
+    {
+        return SUCCESS;
+    }
+    //第二步,检验栏杆是否碰撞
+    //创建栏杆
+    const int railing_count=m_hardware_parameter.railing_parameter_size();
+    if(railing_count==0)
+        return SUCCESS;
+
+    for(int i=0;i<railing_count;++i)
+    {
+        Hardware_limit::Railing railing_parameter=m_hardware_parameter.railing_parameter(i);
+        Railing* tp_railing=new Railing(railing_parameter.pa(),railing_parameter.pb(),railing_parameter.pc(),
+            railing_parameter.railing_width());
+        if(tp_railing!=NULL)
+        {
+            Error_manager code;
+            code=tp_railing->verify(rotate_rect);
+            delete tp_railing;
+            if(code!=SUCCESS)
+            {
+                return code;
+            }
+        }
+    }
+    return SUCCESS;
+}
+
+/*
+     * 检验硬件限制
+     * rotate_rect:待检验的旋转矩形
+     * height:输入高度
+     * terminal_id:终端编号,终端对应的左右栏杆号为: id,id+1
+     */
+Error_manager Verify_result::verify(cv::RotatedRect rotate_rect,int terminal_id,int& code)
+{
+    display(rotate_rect,cv::Scalar(0,255,0));
+
+    cv::Point2f t_corners[4];
+    rotate_rect.points(t_corners);
+    code=0x000000;
+    //第一步,检验边界
+    float corner_min_y=m_hardware_parameter.corner_min_y();
+    float corner_max_y=m_hardware_parameter.corner_max_y();
+    float center_minx=m_hardware_parameter.center_min_x();
+    float center_maxx=m_hardware_parameter.center_max_x();
+    float center_miny=m_hardware_parameter.center_min_y();
+    float center_maxy=m_hardware_parameter.center_max_y();
+    float center_x=rotate_rect.center.x;
+    float center_y=rotate_rect.center.y;
+
+    // 后超界
+    if(center_y<center_miny)
+    {
+        code|=LIMIT_BACK_ERROR;
+    }
+    /*for(int i=0;i<4;++i)
+    {
+        if(t_corners[i].y>corner_max_y)
+        {
+            code|=LIMIT_BACK_ERROR;
+        }
+    }*/
+    //前超界
+    if(center_y>center_maxy)
+    {
+        code|=LIMIT_FRONT_ERROR;
+    }
+    /*for(int i=0;i<4;++i)
+    {
+        if(t_corners[i].y>corner_max_y)
+        {
+            code|=LIMIT_FRONT_ERROR;
+        }
+    }*/
+
+
+    ////第二步,根据id,检验左右栏杆
+    int left_id=terminal_id;
+    int right_id=terminal_id+1;
+    if(left_id<m_hardware_parameter.railing_parameter_size()&&left_id>=0
+    &&right_id<m_hardware_parameter.railing_parameter_size()&&right_id>=0)
+    {
+        Hardware_limit::Railing railing_left_parameter=m_hardware_parameter.railing_parameter(left_id);
+        Railing* tp_left_railing=new Railing(railing_left_parameter.pa(),railing_left_parameter.pb(),railing_left_parameter.pc(),
+                                             railing_left_parameter.railing_width());
+        Hardware_limit::Railing railing_right_parameter=m_hardware_parameter.railing_parameter(right_id);
+        Railing* tp_right_railing=new Railing(railing_right_parameter.pa(),railing_right_parameter.pb(),railing_right_parameter.pc(),
+                                              railing_right_parameter.railing_width());
+
+        if(tp_left_railing->verify(rotate_rect)!=SUCCESS)
+        {
+            code|=LIMIT_LEFT_ERROR;
+        }
+        if(tp_right_railing->verify(rotate_rect)!=SUCCESS)
+        {
+            code|=LIMIT_RIGHT_ERROR;
+        }
+        delete tp_left_railing;
+        delete tp_right_railing;
+    }
+//    LOG(INFO)<<"verify   end";
+    if(code!=0x00000000)
+        return ERROR;
+    return SUCCESS;
+}

+ 51 - 0
verify/Verify_result.h

@@ -0,0 +1,51 @@
+//
+// Created by zx on 2020/1/10.
+//
+
+#ifndef VERIFY_RESULT_H
+#define VERIFY_RESULT_H
+#include "hardware_limit.pb.h"
+#include "Railing.h"
+
+
+/*
+ * 硬件限制检验
+ * 包括旋转矩形是否会碰撞栏杆,旋转矩形中心是否在plc运动范围内
+ */
+class Verify_result
+{
+public:
+#define LIMIT_FRONT_ERROR   0x000001
+#define LIMIT_BACK_ERROR    0x000002
+#define LIMIT_LEFT_ERROR    0x000004
+#define LIMIT_RIGHT_ERROR   0x000008
+public:
+    /*
+     * 构造函数
+     * parameter:硬件限制配置参数
+     */
+    Verify_result(Hardware_limit::Hardware_parameter parameter);
+    /*
+     * 检验硬件限制
+     * rotate_rect:待检验的旋转矩形
+     * height:输入高度
+     * verify_vertex:只检验中心点,不检验顶角
+     */
+    Error_manager verify(cv::RotatedRect rotate_rect,float height,bool verify_vertex=true);
+
+    /*
+     * 检验硬件限制
+     * rotate_rect:待检验的旋转矩形
+     * height:输入高度
+     * terminal_id:终端编号,终端对应的左右栏杆号为: id,id+1
+     * code:返回超界状态(前后左右,按位或运算)
+     * 主要用于电子围栏,检验栏杆及前后
+     */
+    Error_manager verify(cv::RotatedRect rotate_rect,int terminal_id,int& code);
+
+private:
+    Hardware_limit::Hardware_parameter          m_hardware_parameter;
+};
+
+
+#endif //VERIFY_RESULT_H

Різницю між файлами не показано, бо вона завелика
+ 1479 - 0
verify/hardware_limit.pb.cc


+ 940 - 0
verify/hardware_limit.pb.h

@@ -0,0 +1,940 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: hardware_limit.proto
+
+#ifndef PROTOBUF_hardware_5flimit_2eproto__INCLUDED
+#define PROTOBUF_hardware_5flimit_2eproto__INCLUDED
+
+#include <string>
+
+#include <google/protobuf/stubs/common.h>
+
+#if GOOGLE_PROTOBUF_VERSION < 3005000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please update
+#error your headers.
+#endif
+#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers.  Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/arena.h>
+#include <google/protobuf/arenastring.h>
+#include <google/protobuf/generated_message_table_driven.h>
+#include <google/protobuf/generated_message_util.h>
+#include <google/protobuf/metadata.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>  // IWYU pragma: export
+#include <google/protobuf/extension_set.h>  // IWYU pragma: export
+#include <google/protobuf/unknown_field_set.h>
+// @@protoc_insertion_point(includes)
+
+namespace protobuf_hardware_5flimit_2eproto {
+// Internal implementation detail -- do not use these members.
+struct TableStruct {
+  static const ::google::protobuf::internal::ParseTableField entries[];
+  static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
+  static const ::google::protobuf::internal::ParseTable schema[3];
+  static const ::google::protobuf::internal::FieldMetadata field_metadata[];
+  static const ::google::protobuf::internal::SerializationTable serialization_table[];
+  static const ::google::protobuf::uint32 offsets[];
+};
+void AddDescriptors();
+void InitDefaultsRailingImpl();
+void InitDefaultsRailing();
+void InitDefaultsTheta_rangeImpl();
+void InitDefaultsTheta_range();
+void InitDefaultsHardware_parameterImpl();
+void InitDefaultsHardware_parameter();
+inline void InitDefaults() {
+  InitDefaultsRailing();
+  InitDefaultsTheta_range();
+  InitDefaultsHardware_parameter();
+}
+}  // namespace protobuf_hardware_5flimit_2eproto
+namespace Hardware_limit {
+class Hardware_parameter;
+class Hardware_parameterDefaultTypeInternal;
+extern Hardware_parameterDefaultTypeInternal _Hardware_parameter_default_instance_;
+class Railing;
+class RailingDefaultTypeInternal;
+extern RailingDefaultTypeInternal _Railing_default_instance_;
+class Theta_range;
+class Theta_rangeDefaultTypeInternal;
+extern Theta_rangeDefaultTypeInternal _Theta_range_default_instance_;
+}  // namespace Hardware_limit
+namespace Hardware_limit {
+
+// ===================================================================
+
+class Railing : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Hardware_limit.Railing) */ {
+ public:
+  Railing();
+  virtual ~Railing();
+
+  Railing(const Railing& from);
+
+  inline Railing& operator=(const Railing& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Railing(Railing&& from) noexcept
+    : Railing() {
+    *this = ::std::move(from);
+  }
+
+  inline Railing& operator=(Railing&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Railing& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Railing* internal_default_instance() {
+    return reinterpret_cast<const Railing*>(
+               &_Railing_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    0;
+
+  void Swap(Railing* other);
+  friend void swap(Railing& a, Railing& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Railing* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Railing* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Railing& from);
+  void MergeFrom(const Railing& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Railing* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required float pa = 1;
+  bool has_pa() const;
+  void clear_pa();
+  static const int kPaFieldNumber = 1;
+  float pa() const;
+  void set_pa(float value);
+
+  // required float pb = 2;
+  bool has_pb() const;
+  void clear_pb();
+  static const int kPbFieldNumber = 2;
+  float pb() const;
+  void set_pb(float value);
+
+  // required float pc = 3;
+  bool has_pc() const;
+  void clear_pc();
+  static const int kPcFieldNumber = 3;
+  float pc() const;
+  void set_pc(float value);
+
+  // optional float railing_width = 4 [default = 0];
+  bool has_railing_width() const;
+  void clear_railing_width();
+  static const int kRailingWidthFieldNumber = 4;
+  float railing_width() const;
+  void set_railing_width(float value);
+
+  // @@protoc_insertion_point(class_scope:Hardware_limit.Railing)
+ private:
+  void set_has_pa();
+  void clear_has_pa();
+  void set_has_pb();
+  void clear_has_pb();
+  void set_has_pc();
+  void clear_has_pc();
+  void set_has_railing_width();
+  void clear_has_railing_width();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  float pa_;
+  float pb_;
+  float pc_;
+  float railing_width_;
+  friend struct ::protobuf_hardware_5flimit_2eproto::TableStruct;
+  friend void ::protobuf_hardware_5flimit_2eproto::InitDefaultsRailingImpl();
+};
+// -------------------------------------------------------------------
+
+class Theta_range : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Hardware_limit.Theta_range) */ {
+ public:
+  Theta_range();
+  virtual ~Theta_range();
+
+  Theta_range(const Theta_range& from);
+
+  inline Theta_range& operator=(const Theta_range& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Theta_range(Theta_range&& from) noexcept
+    : Theta_range() {
+    *this = ::std::move(from);
+  }
+
+  inline Theta_range& operator=(Theta_range&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Theta_range& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Theta_range* internal_default_instance() {
+    return reinterpret_cast<const Theta_range*>(
+               &_Theta_range_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    1;
+
+  void Swap(Theta_range* other);
+  friend void swap(Theta_range& a, Theta_range& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Theta_range* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Theta_range* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Theta_range& from);
+  void MergeFrom(const Theta_range& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Theta_range* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // required float min_theta = 1;
+  bool has_min_theta() const;
+  void clear_min_theta();
+  static const int kMinThetaFieldNumber = 1;
+  float min_theta() const;
+  void set_min_theta(float value);
+
+  // required float max_theta = 2;
+  bool has_max_theta() const;
+  void clear_max_theta();
+  static const int kMaxThetaFieldNumber = 2;
+  float max_theta() const;
+  void set_max_theta(float value);
+
+  // @@protoc_insertion_point(class_scope:Hardware_limit.Theta_range)
+ private:
+  void set_has_min_theta();
+  void clear_has_min_theta();
+  void set_has_max_theta();
+  void clear_has_max_theta();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  float min_theta_;
+  float max_theta_;
+  friend struct ::protobuf_hardware_5flimit_2eproto::TableStruct;
+  friend void ::protobuf_hardware_5flimit_2eproto::InitDefaultsTheta_rangeImpl();
+};
+// -------------------------------------------------------------------
+
+class Hardware_parameter : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Hardware_limit.Hardware_parameter) */ {
+ public:
+  Hardware_parameter();
+  virtual ~Hardware_parameter();
+
+  Hardware_parameter(const Hardware_parameter& from);
+
+  inline Hardware_parameter& operator=(const Hardware_parameter& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  Hardware_parameter(Hardware_parameter&& from) noexcept
+    : Hardware_parameter() {
+    *this = ::std::move(from);
+  }
+
+  inline Hardware_parameter& operator=(Hardware_parameter&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _internal_metadata_.unknown_fields();
+  }
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return _internal_metadata_.mutable_unknown_fields();
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const Hardware_parameter& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const Hardware_parameter* internal_default_instance() {
+    return reinterpret_cast<const Hardware_parameter*>(
+               &_Hardware_parameter_default_instance_);
+  }
+  static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
+    2;
+
+  void Swap(Hardware_parameter* other);
+  friend void swap(Hardware_parameter& a, Hardware_parameter& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline Hardware_parameter* New() const PROTOBUF_FINAL { return New(NULL); }
+
+  Hardware_parameter* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+  void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
+  void CopyFrom(const Hardware_parameter& from);
+  void MergeFrom(const Hardware_parameter& from);
+  void Clear() PROTOBUF_FINAL;
+  bool IsInitialized() const PROTOBUF_FINAL;
+
+  size_t ByteSizeLong() const PROTOBUF_FINAL;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
+  int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const PROTOBUF_FINAL;
+  void InternalSwap(Hardware_parameter* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return NULL;
+  }
+  inline void* MaybeArenaPtr() const {
+    return NULL;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // repeated .Hardware_limit.Railing railing_parameter = 1;
+  int railing_parameter_size() const;
+  void clear_railing_parameter();
+  static const int kRailingParameterFieldNumber = 1;
+  const ::Hardware_limit::Railing& railing_parameter(int index) const;
+  ::Hardware_limit::Railing* mutable_railing_parameter(int index);
+  ::Hardware_limit::Railing* add_railing_parameter();
+  ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Railing >*
+      mutable_railing_parameter();
+  const ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Railing >&
+      railing_parameter() const;
+
+  // repeated .Hardware_limit.Theta_range theta_range = 8;
+  int theta_range_size() const;
+  void clear_theta_range();
+  static const int kThetaRangeFieldNumber = 8;
+  const ::Hardware_limit::Theta_range& theta_range(int index) const;
+  ::Hardware_limit::Theta_range* mutable_theta_range(int index);
+  ::Hardware_limit::Theta_range* add_theta_range();
+  ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Theta_range >*
+      mutable_theta_range();
+  const ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Theta_range >&
+      theta_range() const;
+
+  // required float center_min_y = 2;
+  bool has_center_min_y() const;
+  void clear_center_min_y();
+  static const int kCenterMinYFieldNumber = 2;
+  float center_min_y() const;
+  void set_center_min_y(float value);
+
+  // required float center_max_y = 3;
+  bool has_center_max_y() const;
+  void clear_center_max_y();
+  static const int kCenterMaxYFieldNumber = 3;
+  float center_max_y() const;
+  void set_center_max_y(float value);
+
+  // required float center_min_x = 4;
+  bool has_center_min_x() const;
+  void clear_center_min_x();
+  static const int kCenterMinXFieldNumber = 4;
+  float center_min_x() const;
+  void set_center_min_x(float value);
+
+  // required float center_max_x = 5;
+  bool has_center_max_x() const;
+  void clear_center_max_x();
+  static const int kCenterMaxXFieldNumber = 5;
+  float center_max_x() const;
+  void set_center_max_x(float value);
+
+  // required float corner_min_y = 6;
+  bool has_corner_min_y() const;
+  void clear_corner_min_y();
+  static const int kCornerMinYFieldNumber = 6;
+  float corner_min_y() const;
+  void set_corner_min_y(float value);
+
+  // required float corner_max_y = 7;
+  bool has_corner_max_y() const;
+  void clear_corner_max_y();
+  static const int kCornerMaxYFieldNumber = 7;
+  float corner_max_y() const;
+  void set_corner_max_y(float value);
+
+  // required float height = 9;
+  bool has_height() const;
+  void clear_height();
+  static const int kHeightFieldNumber = 9;
+  float height() const;
+  void set_height(float value);
+
+  // @@protoc_insertion_point(class_scope:Hardware_limit.Hardware_parameter)
+ private:
+  void set_has_center_min_y();
+  void clear_has_center_min_y();
+  void set_has_center_max_y();
+  void clear_has_center_max_y();
+  void set_has_center_min_x();
+  void clear_has_center_min_x();
+  void set_has_center_max_x();
+  void clear_has_center_max_x();
+  void set_has_corner_min_y();
+  void clear_has_corner_min_y();
+  void set_has_corner_max_y();
+  void clear_has_corner_max_y();
+  void set_has_height();
+  void clear_has_height();
+
+  // helper for ByteSizeLong()
+  size_t RequiredFieldsByteSizeFallback() const;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::HasBits<1> _has_bits_;
+  mutable int _cached_size_;
+  ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Railing > railing_parameter_;
+  ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Theta_range > theta_range_;
+  float center_min_y_;
+  float center_max_y_;
+  float center_min_x_;
+  float center_max_x_;
+  float corner_min_y_;
+  float corner_max_y_;
+  float height_;
+  friend struct ::protobuf_hardware_5flimit_2eproto::TableStruct;
+  friend void ::protobuf_hardware_5flimit_2eproto::InitDefaultsHardware_parameterImpl();
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif  // __GNUC__
+// Railing
+
+// required float pa = 1;
+inline bool Railing::has_pa() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Railing::set_has_pa() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Railing::clear_has_pa() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Railing::clear_pa() {
+  pa_ = 0;
+  clear_has_pa();
+}
+inline float Railing::pa() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Railing.pa)
+  return pa_;
+}
+inline void Railing::set_pa(float value) {
+  set_has_pa();
+  pa_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Railing.pa)
+}
+
+// required float pb = 2;
+inline bool Railing::has_pb() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void Railing::set_has_pb() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void Railing::clear_has_pb() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void Railing::clear_pb() {
+  pb_ = 0;
+  clear_has_pb();
+}
+inline float Railing::pb() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Railing.pb)
+  return pb_;
+}
+inline void Railing::set_pb(float value) {
+  set_has_pb();
+  pb_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Railing.pb)
+}
+
+// required float pc = 3;
+inline bool Railing::has_pc() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void Railing::set_has_pc() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void Railing::clear_has_pc() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void Railing::clear_pc() {
+  pc_ = 0;
+  clear_has_pc();
+}
+inline float Railing::pc() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Railing.pc)
+  return pc_;
+}
+inline void Railing::set_pc(float value) {
+  set_has_pc();
+  pc_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Railing.pc)
+}
+
+// optional float railing_width = 4 [default = 0];
+inline bool Railing::has_railing_width() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void Railing::set_has_railing_width() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void Railing::clear_has_railing_width() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void Railing::clear_railing_width() {
+  railing_width_ = 0;
+  clear_has_railing_width();
+}
+inline float Railing::railing_width() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Railing.railing_width)
+  return railing_width_;
+}
+inline void Railing::set_railing_width(float value) {
+  set_has_railing_width();
+  railing_width_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Railing.railing_width)
+}
+
+// -------------------------------------------------------------------
+
+// Theta_range
+
+// required float min_theta = 1;
+inline bool Theta_range::has_min_theta() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Theta_range::set_has_min_theta() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Theta_range::clear_has_min_theta() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Theta_range::clear_min_theta() {
+  min_theta_ = 0;
+  clear_has_min_theta();
+}
+inline float Theta_range::min_theta() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Theta_range.min_theta)
+  return min_theta_;
+}
+inline void Theta_range::set_min_theta(float value) {
+  set_has_min_theta();
+  min_theta_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Theta_range.min_theta)
+}
+
+// required float max_theta = 2;
+inline bool Theta_range::has_max_theta() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void Theta_range::set_has_max_theta() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void Theta_range::clear_has_max_theta() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void Theta_range::clear_max_theta() {
+  max_theta_ = 0;
+  clear_has_max_theta();
+}
+inline float Theta_range::max_theta() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Theta_range.max_theta)
+  return max_theta_;
+}
+inline void Theta_range::set_max_theta(float value) {
+  set_has_max_theta();
+  max_theta_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Theta_range.max_theta)
+}
+
+// -------------------------------------------------------------------
+
+// Hardware_parameter
+
+// repeated .Hardware_limit.Railing railing_parameter = 1;
+inline int Hardware_parameter::railing_parameter_size() const {
+  return railing_parameter_.size();
+}
+inline void Hardware_parameter::clear_railing_parameter() {
+  railing_parameter_.Clear();
+}
+inline const ::Hardware_limit::Railing& Hardware_parameter::railing_parameter(int index) const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.railing_parameter)
+  return railing_parameter_.Get(index);
+}
+inline ::Hardware_limit::Railing* Hardware_parameter::mutable_railing_parameter(int index) {
+  // @@protoc_insertion_point(field_mutable:Hardware_limit.Hardware_parameter.railing_parameter)
+  return railing_parameter_.Mutable(index);
+}
+inline ::Hardware_limit::Railing* Hardware_parameter::add_railing_parameter() {
+  // @@protoc_insertion_point(field_add:Hardware_limit.Hardware_parameter.railing_parameter)
+  return railing_parameter_.Add();
+}
+inline ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Railing >*
+Hardware_parameter::mutable_railing_parameter() {
+  // @@protoc_insertion_point(field_mutable_list:Hardware_limit.Hardware_parameter.railing_parameter)
+  return &railing_parameter_;
+}
+inline const ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Railing >&
+Hardware_parameter::railing_parameter() const {
+  // @@protoc_insertion_point(field_list:Hardware_limit.Hardware_parameter.railing_parameter)
+  return railing_parameter_;
+}
+
+// required float center_min_y = 2;
+inline bool Hardware_parameter::has_center_min_y() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void Hardware_parameter::set_has_center_min_y() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void Hardware_parameter::clear_has_center_min_y() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void Hardware_parameter::clear_center_min_y() {
+  center_min_y_ = 0;
+  clear_has_center_min_y();
+}
+inline float Hardware_parameter::center_min_y() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.center_min_y)
+  return center_min_y_;
+}
+inline void Hardware_parameter::set_center_min_y(float value) {
+  set_has_center_min_y();
+  center_min_y_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.center_min_y)
+}
+
+// required float center_max_y = 3;
+inline bool Hardware_parameter::has_center_max_y() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void Hardware_parameter::set_has_center_max_y() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void Hardware_parameter::clear_has_center_max_y() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void Hardware_parameter::clear_center_max_y() {
+  center_max_y_ = 0;
+  clear_has_center_max_y();
+}
+inline float Hardware_parameter::center_max_y() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.center_max_y)
+  return center_max_y_;
+}
+inline void Hardware_parameter::set_center_max_y(float value) {
+  set_has_center_max_y();
+  center_max_y_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.center_max_y)
+}
+
+// required float center_min_x = 4;
+inline bool Hardware_parameter::has_center_min_x() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void Hardware_parameter::set_has_center_min_x() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void Hardware_parameter::clear_has_center_min_x() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void Hardware_parameter::clear_center_min_x() {
+  center_min_x_ = 0;
+  clear_has_center_min_x();
+}
+inline float Hardware_parameter::center_min_x() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.center_min_x)
+  return center_min_x_;
+}
+inline void Hardware_parameter::set_center_min_x(float value) {
+  set_has_center_min_x();
+  center_min_x_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.center_min_x)
+}
+
+// required float center_max_x = 5;
+inline bool Hardware_parameter::has_center_max_x() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void Hardware_parameter::set_has_center_max_x() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void Hardware_parameter::clear_has_center_max_x() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void Hardware_parameter::clear_center_max_x() {
+  center_max_x_ = 0;
+  clear_has_center_max_x();
+}
+inline float Hardware_parameter::center_max_x() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.center_max_x)
+  return center_max_x_;
+}
+inline void Hardware_parameter::set_center_max_x(float value) {
+  set_has_center_max_x();
+  center_max_x_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.center_max_x)
+}
+
+// required float corner_min_y = 6;
+inline bool Hardware_parameter::has_corner_min_y() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void Hardware_parameter::set_has_corner_min_y() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void Hardware_parameter::clear_has_corner_min_y() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void Hardware_parameter::clear_corner_min_y() {
+  corner_min_y_ = 0;
+  clear_has_corner_min_y();
+}
+inline float Hardware_parameter::corner_min_y() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.corner_min_y)
+  return corner_min_y_;
+}
+inline void Hardware_parameter::set_corner_min_y(float value) {
+  set_has_corner_min_y();
+  corner_min_y_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.corner_min_y)
+}
+
+// required float corner_max_y = 7;
+inline bool Hardware_parameter::has_corner_max_y() const {
+  return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void Hardware_parameter::set_has_corner_max_y() {
+  _has_bits_[0] |= 0x00000020u;
+}
+inline void Hardware_parameter::clear_has_corner_max_y() {
+  _has_bits_[0] &= ~0x00000020u;
+}
+inline void Hardware_parameter::clear_corner_max_y() {
+  corner_max_y_ = 0;
+  clear_has_corner_max_y();
+}
+inline float Hardware_parameter::corner_max_y() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.corner_max_y)
+  return corner_max_y_;
+}
+inline void Hardware_parameter::set_corner_max_y(float value) {
+  set_has_corner_max_y();
+  corner_max_y_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.corner_max_y)
+}
+
+// repeated .Hardware_limit.Theta_range theta_range = 8;
+inline int Hardware_parameter::theta_range_size() const {
+  return theta_range_.size();
+}
+inline void Hardware_parameter::clear_theta_range() {
+  theta_range_.Clear();
+}
+inline const ::Hardware_limit::Theta_range& Hardware_parameter::theta_range(int index) const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.theta_range)
+  return theta_range_.Get(index);
+}
+inline ::Hardware_limit::Theta_range* Hardware_parameter::mutable_theta_range(int index) {
+  // @@protoc_insertion_point(field_mutable:Hardware_limit.Hardware_parameter.theta_range)
+  return theta_range_.Mutable(index);
+}
+inline ::Hardware_limit::Theta_range* Hardware_parameter::add_theta_range() {
+  // @@protoc_insertion_point(field_add:Hardware_limit.Hardware_parameter.theta_range)
+  return theta_range_.Add();
+}
+inline ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Theta_range >*
+Hardware_parameter::mutable_theta_range() {
+  // @@protoc_insertion_point(field_mutable_list:Hardware_limit.Hardware_parameter.theta_range)
+  return &theta_range_;
+}
+inline const ::google::protobuf::RepeatedPtrField< ::Hardware_limit::Theta_range >&
+Hardware_parameter::theta_range() const {
+  // @@protoc_insertion_point(field_list:Hardware_limit.Hardware_parameter.theta_range)
+  return theta_range_;
+}
+
+// required float height = 9;
+inline bool Hardware_parameter::has_height() const {
+  return (_has_bits_[0] & 0x00000040u) != 0;
+}
+inline void Hardware_parameter::set_has_height() {
+  _has_bits_[0] |= 0x00000040u;
+}
+inline void Hardware_parameter::clear_has_height() {
+  _has_bits_[0] &= ~0x00000040u;
+}
+inline void Hardware_parameter::clear_height() {
+  height_ = 0;
+  clear_has_height();
+}
+inline float Hardware_parameter::height() const {
+  // @@protoc_insertion_point(field_get:Hardware_limit.Hardware_parameter.height)
+  return height_;
+}
+inline void Hardware_parameter::set_height(float value) {
+  set_has_height();
+  height_ = value;
+  // @@protoc_insertion_point(field_set:Hardware_limit.Hardware_parameter.height)
+}
+
+#ifdef __GNUC__
+  #pragma GCC diagnostic pop
+#endif  // __GNUC__
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+}  // namespace Hardware_limit
+
+// @@protoc_insertion_point(global_scope)
+
+#endif  // PROTOBUF_hardware_5flimit_2eproto__INCLUDED

+ 30 - 0
verify/hardware_limit.proto

@@ -0,0 +1,30 @@
+syntax="proto2";
+package Hardware_limit;
+
+//栏杆
+message Railing
+{
+    required float pa=1;
+    required float pb=2;
+    required float pc=3;
+    optional float railing_width=4 [default=0];
+}
+
+message Theta_range
+{
+    required float min_theta=1;
+    required float max_theta=2;
+}
+
+message Hardware_parameter
+{
+    repeated Railing railing_parameter=1;
+    required float center_min_y=2;
+    required float center_max_y=3;
+    required float center_min_x=4;
+    required float center_max_x=5;
+    required float corner_min_y=6;
+    required float corner_max_y=7;
+    repeated Theta_range theta_range=8;
+    required float height=9;
+}

+ 81 - 0
verify/verify_uml.wsd

@@ -0,0 +1,81 @@
+@startuml
+title 测量结果检验模块
+
+
+class Railing
+{
+
+    + * 构造函数()
+    + * a,b,c代表栏杆所在直线方程, ax+by+c=0()
+    + * width:表示栏杆的宽()
+    +Railing(float a,float b,float c,float width);
+    + * 检验结果框,是否会与栏杆冲突()
+    +Error_manager verify(cv::RotatedRect rotate_rect);
+
+    -float m_a;
+    -float m_b;
+    -float m_c;
+    -float m_width;
+}
+note left of Railing
+    栏杆检验类
+    检验测量结果是否碰撞栏杆
+    栏杆信息包括:栏杆斜角,宽度
+end note
+
+class Terminal_region_limit
+{
+    +Terminal_region_limit(Railing* left_railing,Railing* right_railing);
+  
+    + * 检验是否碰撞左右栏杆,()
+    + * 返回结果:左边碰撞,右边碰撞,左右都碰撞,正确()
+    +Error_manager verify(cv::RotatedRect rect);
+
+    -//左边栏杆
+    -Railing*                     mp_left_railing;
+    -//右边栏杆
+    -Railing*                     mp_right_railing;
+}
+note left of Terminal_region_limit
+    硬件场地检验类
+    检验测量结果是否满足现场安全要求
+end note
+
+class Verify_result
+{
+    + * 构造函数
+    + * parameter:硬件限制配置参数
+    +Verify_result(Hardware_limit::Hardware_parameter parameter);
+
+    + * 检验硬件限制
+    + * rotate_rect:待检验的旋转矩形
+    + * height:输入高度
+    + * verify_vertex:只检验中心点,不检验顶角
+    +Error_manager verify(cv::RotatedRect rotate_rect,float height,bool verify_vertex=true);
+
+    + * 检验硬件限制
+    + * rotate_rect:待检验的旋转矩形
+    + * height:输入高度
+    + * terminal_id:终端编号,终端对应的左右栏杆号为: id,id+1
+    + * code:返回超界状态(前后左右,按位或运算)
+    + * 主要用于电子围栏,检验栏杆及前后
+    +Error_manager verify(cv::RotatedRect rotate_rect,int terminal_id,int& code);
+
+    -Hardware_limit::Hardware_parameter          m_hardware_parameter;
+}
+note left of Verify_result
+    测量结果检测器
+    根据现场硬件要求
+    检验测量结果是否合法(安全性)
+end note
+
+note left of Hardware_parameter
+    硬件配置类
+    配置现场硬件参数
+    包括 前后左右超界范围,栏杆参数等
+end note 
+Terminal_region_limit --> Railing
+Verify_result --> Terminal_region_limit
+Verify_result --> Hardware_parameter
+
+@enduml