Explorar o código

消息统一,底层工具微调,屏蔽测量节点

youchen %!s(int64=3) %!d(string=hai) anos
pai
achega
191433f016

+ 9 - 5
communication/communication_message.cpp

@@ -55,14 +55,14 @@ bool Communication_message::is_over_time()
 }
 
 
-void Communication_message::reset(const message::Base_info& base_msg, std::string receive_string)
+void Communication_message::reset(const message::Base_info& base_info, std::string receive_string)
 {
-	m_message_type = (Message_type)(base_msg.msg_type());
+	m_message_type = (Message_type)(base_info.msg_type());
 
 	m_receive_time = std::chrono::system_clock::now();
-	m_timeout_ms = std::chrono::milliseconds(base_msg.timeout_ms());
-	m_sender = (Communicator)(base_msg.sender());
-	m_receiver = (Communicator)(base_msg.receiver());
+	m_timeout_ms = std::chrono::milliseconds(base_info.timeout_ms());
+	m_sender = (Communicator)(base_info.sender());
+	m_receiver = (Communicator)(base_info.receiver());
 	m_message_buf = receive_string;
 }
 
@@ -83,6 +83,10 @@ std::string& Communication_message::get_message_buf()
 	return m_message_buf;
 }
 
+std::chrono::system_clock::time_point Communication_message::get_receive_time()
+{
+	return m_receive_time;
+}
 
 
 

+ 66 - 32
communication/communication_message.h

@@ -25,52 +25,85 @@ public:
 		eBase_msg=0x00,
 		eCommand_msg=0x01,                      //指令消息
 
+
 		eLocate_status_msg=0x11,                //定位模块状态消息
 		eLocate_request_msg=0x12,               //定位请求消息
 		eLocate_response_msg=0x13,              //定位反馈消息
 
-        eDispatch_status_msg=0x21,                //调度模块硬件状态消息
-        eDispatch_request_msg=0x22,              //请求调度消息
-        eDispatch_response_msg=0x23,             //调度结果反馈消息
-
-        eParkspace_allocation_status_msg = 0x31,   //车位分配模块状态消息,包括车位信息
-        eParkspace_allocation_request_msg = 0x32,  //请求分配车位消息
-        eParkspace_allocation_response_msg = 0x33, //分配车位结果反馈消息
-        eParkspace_search_request_msg = 0x34,    //查询车位请求消息
-        eParkspace_search_response_msg = 0x35,    //查询车位反馈消息
-        eParkspace_release_request_msg = 0x36,    //释放车位请求消息
-        eParkspace_release_response_msg = 0x37,    //释放车位反馈消息
-        eParkspace_force_update_request_msg = 0x38,	//手动修改车位消息
-        eParkspace_force_update_response_msg = 0x39,//手动修改车位反馈消息
-        eParkspace_confirm_alloc_request_msg = 0x3A,//确认分配车位请求消息
-        eParkspace_confirm_alloc_response_msg = 0x3B,//确认分配车位反馈消息
+		eLocate_sift_request_msg = 0x14,            //预测算法请求消息
+		eLocate_sift_response_msg = 0x15,           //预测算法反馈消息
+
+		eDispatch_status_msg=0x21,                //调度模块硬件状态消息
+		eDispatch_request_msg=0x22,              //请求调度消息
+		eDispatch_response_msg=0x23,             //调度结果反馈消息
+
+		eParkspace_allocation_status_msg=0x31,  //车位分配模块状态消息,包括车位信息
+		eParkspace_allocation_request_msg=0x32, //请求分配车位消息
+		eParkspace_allocation_response_msg=0x33,//分配车位结果反馈消息
+		eParkspace_search_request_msg = 0x34,		//查询车位请求消息
+		eParkspace_search_response_msg = 0x35,		//查询车位反馈消息
+		eParkspace_release_request_msg = 0x36,		//释放车位请求消息
+		eParkspace_release_response_msg = 0x37,		//释放车位反馈消息
+		eParkspace_force_update_request_msg = 0x38,	//手动修改车位消息
+		eParkspace_force_update_response_msg = 0x39,//手动修改车位反馈消息
+		eParkspace_confirm_alloc_request_msg = 0x3A,//确认分配车位请求消息
+		eParkspace_confirm_alloc_response_msg = 0x3B,//确认分配车位反馈消息
         eParkspace_refresh_request_msg=0x3C,        //请求更新车位数据
-        eParkspace_allocation_data_msg=0x3D,
+        eParkspace_allocation_data_response_msg=0x3D,
+
+		eStore_command_request_msg=0x41,        //终端停车请求消息
+		eStore_command_response_msg=0x42,       //停车请求反馈消息
+		ePickup_command_request_msg=0x43,       //取车请求消息
+		ePickup_command_response_msg=0x44,       //取车请求反馈消息
+
+
+
+		eStoring_process_statu_msg=0x90,        //停车指令进度条消息
+		ePicking_process_statu_msg=0x91,        //取车指令进度消息
 
-        eStore_command_request_msg=0x41,                    //终端停车请求消息
-        eStore_command_response_msg=0x42,                   //停车请求反馈消息
-        ePickup_command_request_msg=0x43,                   //取车请求消息
-        ePickup_command_response_msg=0x44,                  //取车请求反馈消息
 
-        eStoring_process_statu_msg=0x90,                    //停车进度条消息
-        ePicking_process_statu_msg=0x91,                    //取车进度消息
+		eCentral_controller_statu_msg=0xa0,     //中控系统状态消息
 
-        eCentral_controller_statu_msg=0xa0,                 //中控状态消息
 
-        eEntrance_manual_operation_msg=0xb0,            //针对出入口状态操作的手动消息
-        eProcess_manual_operation_msg=0xb1,
-    };
+		eEntrance_manual_operation_msg=0xb0,            //针对出入口状态操作的手动消息
+		eProcess_manual_operation_msg=0xb1,             //针对流程的手动消息
+
+		eDispatch_plan_request_msg          = 0xe0,     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
+		eDispatch_plan_response_msg         = 0xe1,     //调度总规划的答复(调度算法->调度管理)
+		eDispatch_control_request_msg       = 0xe2,     //调度控制的任务请求(调度算法->调度管理)
+		eDispatch_control_response_msg      = 0xe3,     //调度控制的任务答复(调度管理->调度算法)
+		eDispatch_manager_status_msg        = 0xea,     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
+		eDispatch_manager_data_msg          = 0xeb,     //调度管理的设备详细的数据信息
+		
+		
+		eGround_detect_request_msg=0xf0,        //地面雷达测量请求消息
+    	eGround_detect_response_msg=0xf1,       //地面雷达测量反馈消息
+
+
+	};
 
 //通讯单元
 	enum Communicator
 	{
-		eEmpty=0x0000,		//空
-		eMain=0x0001,    	//主流程
-		eTerminor=0x0100,	//终端
-		eTable=0x0200,		//数据表
-		eMeasurer=0x0300,	//测量单元
-		eProcess=0x0400,	//调度机构
+		eEmpty=0x0000,
+		eMain=0x0001,    //主流程
+
+		eTerminor=0x0100,
+		//车位表
+		eParkspace=0x0200,
+		//测量单元
+		eMeasurer=0x0300,
+		//测量单元
+		eMeasurer_sift_server=0x0301,
+
+		//调度机构
+		eDispatch_mamager=0x0400,
+		//调度机构
+		eDispatch_control=0x0401,
 		//...
+
+		//地面测量单元
+		eGround_measurer=0x0f00,
 	};
 public:
 	Communication_message();
@@ -88,6 +121,7 @@ public://get or set member variable
 	Communicator get_sender();
 	Communicator get_receiver();
 	std::string& get_message_buf();
+	std::chrono::system_clock::time_point get_receive_time();
 
 protected://member variable
 	Message_type								m_message_type;				//消息类型

+ 77 - 60
communication/communication_socket_base.cpp

@@ -12,6 +12,9 @@ Communication_socket_base::Communication_socket_base()
 	mp_analysis_data_thread = NULL;
 	mp_send_data_thread = NULL;
 	mp_encapsulate_data_thread = NULL;
+
+	m_analysis_cycle_time = 1000;//默认1000ms,就自动解析(接受list)
+	m_encapsulate_cycle_time = 1000;//默认1000ms,就自动发送一次状态信息
 }
 
 Communication_socket_base::~Communication_socket_base()
@@ -36,7 +39,6 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(std::s
 		return Error_manager(COMMUNICATION_READ_PROTOBUF_ERROR,MINOR_ERROR,
 		"Communication_socket_base read_proto_param  failed");
 	}
-
 	return communication_init_from_protobuf(t_communication_parameter_all);
 }
 
@@ -54,8 +56,8 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(Commun
 			return t_error;
 		}
 	}
-	std::cout << "communication_parameter_all.communication_parameters().connect_string_vector_size() " <<
-		communication_parameter_all.communication_parameters().connect_string_vector_size()<< std::endl;
+//	std::cout << "communication_parameter_all.communication_parameters().connect_string_vector_size() " <<
+//		communication_parameter_all.communication_parameters().connect_string_vector_size()<< std::endl;
 	for(int i=0;i<communication_parameter_all.communication_parameters().connect_string_vector_size();++i)
 	{
 		t_error = communication_connect( communication_parameter_all.communication_parameters().connect_string_vector(i) );
@@ -64,7 +66,6 @@ Error_manager Communication_socket_base::communication_init_from_protobuf(Commun
 			return t_error;
 		}
 	}
-
 	//启动通信, run thread
 	communication_run();
 
@@ -107,7 +108,7 @@ Error_manager Communication_socket_base::communication_bind(std::string bind_str
 		return Error_manager(Error_code::COMMUNICATION_BIND_ERROR, Error_level::MINOR_ERROR,
 							 " m_socket.bind error ");
 	}
-	//LOG(INFO) << " ---Communication_socket_base::communication_bind() bind::  "<< bind_string << "  " << this;
+	LOG(INFO) << " ---Communication_socket_base::communication_bind() bind::  "<< bind_string << "  " << this;
 
 	return Error_code::SUCCESS;
 }
@@ -137,6 +138,8 @@ Error_manager Communication_socket_base::communication_connect(std::string conne
 		return Error_manager(Error_code::COMMUNICATION_CONNECT_ERROR, Error_level::MINOR_ERROR,
 							 " m_socket.connect error ");
 	}
+	LOG(INFO) << " ---Communication_socket_base::communication_connect() connect::  "<< connect_string << "  " << this;
+
 	return Error_code::SUCCESS;
 }
 //启动通信, run thread
@@ -222,30 +225,39 @@ Error_manager Communication_socket_base::communication_uninit()
 }
 
 
-
+void Communication_socket_base::set_analysis_cycle_time(unsigned int analysis_cycle_time)
+{
+	m_analysis_cycle_time = analysis_cycle_time;
+}
+void Communication_socket_base::set_encapsulate_cycle_time(unsigned int encapsulate_cycle_time)
+{
+	m_encapsulate_cycle_time = encapsulate_cycle_time;
+}
 
 
 
 
 //mp_receive_data_thread 接受线程执行函数,
 //receive_data_thread 内部线程负责接受消息
-void Communication_socket_base::receive_data_thread(Communication_socket_base* communicator)
+void Communication_socket_base::receive_data_thread()
 {
-	//LOG(INFO) << " Communication_socket_base::receive_data_thread start "<< communicator;
+	LOG(INFO) << " Communication_socket_base::receive_data_thread start "<< this;
 
 	//通信接受线程, 负责接受socket消息, 并存入 m_receive_data_list
-	while (communicator->m_receive_condition.is_alive())
+	while (m_receive_condition.is_alive())
 	{
-        std::this_thread::yield();
-        //usleep(1);
-        communicator->m_receive_condition.wait_for_ex(std::chrono::microseconds(1));
-		if ( communicator->m_receive_condition.is_alive() )
+		m_receive_condition.wait_for_ex(std::chrono::microseconds(1));
+		if ( m_receive_condition.is_alive() )
 		{
+			std::this_thread::yield();
 
-			std::unique_lock<std::mutex> lk(communicator->m_mutex);
-			//flags为1, 非阻塞接受消息, 如果接收到消息, 那么接受数据长度大于0
-			std::string t_receive_string = communicator->m_socket.recv<std::string>(1);
-			if ( t_receive_string.length()>0 )
+			std::string t_receive_string;
+			{//这个大括号表示只对 recv 和 send 加锁, 不要因为后面的复杂逻辑影响通信效率
+				std::unique_lock<std::mutex> lk(m_mutex);
+				//flags为1, 非阻塞接受消息, 如果接收到消息, 那么接受数据长度大于0
+				t_receive_string = m_socket.recv<std::string>(1);
+			}
+			if ( t_receive_string.size()>0 )
 			{
 				//如果这里接受到了消息, 在这提前解析消息最前面的Base_msg (消息公共内容), 用于后续的check
 				message::Base_msg t_base_msg;
@@ -255,14 +267,14 @@ void Communication_socket_base::receive_data_thread(Communication_socket_base* c
 					Communication_message  * tp_communication_message = new Communication_message;
 					tp_communication_message->reset(t_base_msg.base_info(), t_receive_string);
 					//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
-					if ( communicator->check_msg(tp_communication_message) == SUCCESS )
+					if ( check_msg(tp_communication_message) == SUCCESS )
 					{
-						bool is_push = communicator->m_receive_data_list.push(tp_communication_message);
+						bool is_push = m_receive_data_list.push(tp_communication_message);
 						//push成功之后, tp_communication_message内存的管理权限交给链表, 如果失败就要回收内存
 						if ( is_push )
 						{
 							//唤醒解析线程一次,
-                            communicator->m_analysis_data_condition.notify_all(false, true);
+							m_analysis_data_condition.notify_all(false, true);
 						}
 						else
 						{
@@ -279,6 +291,7 @@ void Communication_socket_base::receive_data_thread(Communication_socket_base* c
 						tp_communication_message = NULL;
 					}
 
+
 				}
 				//解析失败, 就当做什么也没发生, 认为接收消息无效,
 			}
@@ -286,7 +299,7 @@ void Communication_socket_base::receive_data_thread(Communication_socket_base* c
 		}
 	}
 
-	//LOG(INFO) << " Communication_socket_base::receive_data_thread end "<< communicator;
+	LOG(INFO) << " Communication_socket_base::receive_data_thread end "<< this;
 	return;
 }
 
@@ -302,25 +315,24 @@ Error_manager Communication_socket_base::check_msg(Communication_message*  p_msg
 	}
 	else
 	{
-		//认为接受人
-		return Error_code::INVALID_MESSAGE;
-	}
+		//无效的消息,
+		return Error_manager(Error_code::INVALID_MESSAGE, Error_level::NEGLIGIBLE_ERROR,
+							 " INVALID_MESSAGE error ");	}
 }
 
 //mp_analysis_data_thread 解析线程执行函数,
 //analysis_data_thread 内部线程负责解析消息
 void Communication_socket_base::analysis_data_thread()
 {
-	//LOG(INFO) << " Communication_socket_base::analysis_data_thread start "<< this;
+	LOG(INFO) << " Communication_socket_base::analysis_data_thread start "<< this;
 
 	//通信解析线程, 负责巡检m_receive_data_list, 并解析和处理消息
 	while (m_analysis_data_condition.is_alive())
 	{
-        std::this_thread::yield();
-		bool t_pass_flag = m_analysis_data_condition.wait_for_millisecond(1000);
+		bool t_pass_flag = m_analysis_data_condition.wait_for_millisecond(m_analysis_cycle_time);
 		if ( m_analysis_data_condition.is_alive() )
 		{
-
+			std::this_thread::yield();
 			//如果解析线程被主动唤醒, 那么就表示 收到新的消息, 那就遍历整个链表
 			if ( t_pass_flag )
 			{
@@ -334,7 +346,7 @@ void Communication_socket_base::analysis_data_thread()
 		}
 	}
 
-	//LOG(INFO) << " Communication_socket_base::analysis_data_thread end "<< this;
+	LOG(INFO) << " Communication_socket_base::analysis_data_thread end "<< this;
 	return;
 }
 
@@ -366,10 +378,10 @@ Error_manager Communication_socket_base::analysis_receive_list()
 				{
 					//处理消息
 					t_error = execute_msg(tp_msg);
-				if ( t_error!=SUCCESS )
-				{
-					fprintf(stderr,"%s\n",t_error.to_string().c_str());
-				}
+//				if ( t_error )
+//				{
+//					//执行结果不管
+//				}
 //				else
 //				{
 //					//执行结果不管
@@ -412,6 +424,9 @@ Error_manager Communication_socket_base::check_executer(Communication_message*
 
 	if ( p_msg->is_over_time() )
 	{
+		std::cout << "Communication_socket_base::check_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+		std::cout << "Communication_socket_base::check_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
+		std::cout << "COMMUNICATION_ANALYSIS_TIME_OUT , " << std::endl;
 		return Error_code::COMMUNICATION_ANALYSIS_TIME_OUT;
 	}
 	else
@@ -419,7 +434,10 @@ Error_manager Communication_socket_base::check_executer(Communication_message*
 		bool executer_is_ready = false;
 		//通过 p_msg->get_message_type() 和 p_msg->get_receiver() 找到处理模块的实例对象, 查询执行人是否可以处理这条消息
 		//这里子类重载时, 增加判断逻辑, 以后再写.
-//		executer_is_ready = true;
+		executer_is_ready = true;
+
+		std::cout << "Communication_socket_base::check_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+		std::cout << "Communication_socket_base::check_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
 
 		if ( executer_is_ready )
 		{
@@ -450,36 +468,38 @@ Error_manager Communication_socket_base::execute_msg(Communication_message*  p_m
 	//这里不应该长时间阻塞或者处理复杂的逻辑,
 	//请执行者另开线程来处理任务.
 
+	std::cout << "Communication_socket_base::excute_msg  p_buf =  " << p_msg->get_message_buf() << std::endl;
+	std::cout << "Communication_socket_base::excute_msg   size =  " << p_msg->get_message_buf().size() << std::endl;
 	return Error_code::SUCCESS;
 }
 
 //mp_send_data_thread 发送线程执行函数,
 //send_data_thread 内部线程负责发送消息
-void Communication_socket_base::send_data_thread(Communication_socket_base* communicator)
+void Communication_socket_base::send_data_thread()
 {
-	//LOG(INFO) << " Communication_socket_base::send_data_thread start "<< communicator;
+	LOG(INFO) << " Communication_socket_base::send_data_thread start "<< this;
 
 	//通信发送线程, 负责巡检m_send_data_list, 并发送消息
-	while (communicator->m_send_data_condition.is_alive())
+	while (m_send_data_condition.is_alive())
 	{
-        std::this_thread::yield();
-        communicator->m_send_data_condition.wait();
-		if ( communicator->m_send_data_condition.is_alive() )
+		m_send_data_condition.wait();
+		if ( m_send_data_condition.is_alive() )
 		{
-
+			std::this_thread::yield();
 
 			Communication_message* tp_msg = NULL;
 			//这里 wait_and_pop 会使用链表内部的 m_data_cond 条件变量来控制等待,
 			//封装线程使用push的时候, 会唤醒线程并通过等待, 此时 m_send_data_condition 是一直通过的.
 			//如果需要退出, 那么就要 m_send_data_list.termination_list();	和 m_send_data_condition.kill_all();
-			bool is_pop = communicator->m_send_data_list.wait_and_pop(tp_msg);
+			bool is_pop = m_send_data_list.wait_and_pop(tp_msg);
 			if ( is_pop )
 			{
 				if ( tp_msg != NULL )
 				{
-					std::unique_lock<std::mutex> lk(communicator->m_mutex);
-					int send_size = communicator->m_socket.send(tp_msg->get_message_buf());
-
+					{//这个大括号表示只对 recv 和 send 加锁, 不要因为后面的复杂逻辑影响通信效率
+						std::unique_lock<std::mutex> lk(m_mutex);
+						m_socket.send(tp_msg->get_message_buf());
+					}
 					delete(tp_msg);
 					tp_msg = NULL;
 				}
@@ -493,7 +513,7 @@ void Communication_socket_base::send_data_thread(Communication_socket_base* comm
 		}
 	}
 
-	//LOG(INFO) << " Communication_socket_base::send_data_thread end "<< communicator;
+	LOG(INFO) << " Communication_socket_base::send_data_thread end "<< this;
 	return;
 }
 
@@ -501,16 +521,16 @@ void Communication_socket_base::send_data_thread(Communication_socket_base* comm
 //encapsulate_data_thread 内部线程负责封装消息
 void Communication_socket_base::encapsulate_data_thread()
 {
-	//LOG(INFO) << " Communication_socket_base::encapsulate_data_thread start "<< this;
+	LOG(INFO) << " Communication_socket_base::encapsulate_data_thread start "<< this;
 
 	//通信封装线程, 负责定时封装消息, 并存入 m_send_data_list
 	while (m_encapsulate_data_condition.is_alive())
 	{
-        std::this_thread::yield();
-		bool t_pass_flag = m_encapsulate_data_condition.wait_for_millisecond(1000);
+		bool t_pass_flag = m_encapsulate_data_condition.wait_for_millisecond(m_encapsulate_cycle_time);
+
 		if ( m_encapsulate_data_condition.is_alive() )
 		{
-
+			std::this_thread::yield();
 			//如果封装线程被主动唤醒, 那么就表示 需要主动发送消息,
 			if ( t_pass_flag )
 			{
@@ -524,7 +544,7 @@ void Communication_socket_base::encapsulate_data_thread()
 		}
 	}
 
-	//LOG(INFO) << " Communication_socket_base::encapsulate_data_thread end "<< this;
+	LOG(INFO) << " Communication_socket_base::encapsulate_data_thread end "<< this;
 	return;
 }
 
@@ -536,12 +556,12 @@ Error_manager Communication_socket_base::encapsulate_send_data()
 //	static unsigned int t_heartbeat = 0;
 //	sprintf(buf, "Communication_socket_base, heartbeat = %d\0\0\0, test\0", t_heartbeat);
 //	t_heartbeat++;
-
-	message::Base_info t_base_msg;
-	t_base_msg.set_msg_type(message::Message_type::eBase_msg);
-	t_base_msg.set_timeout_ms(5000);
-	t_base_msg.set_sender(message::Communicator::eMain);
-	t_base_msg.set_receiver(message::Communicator::eMain);
+    return SUCCESS;
+	message::Base_msg t_base_msg;
+	t_base_msg.mutable_base_info()->set_msg_type(message::Message_type::eBase_msg);
+	t_base_msg.mutable_base_info()->set_timeout_ms(5000);
+	t_base_msg.mutable_base_info()->set_sender(message::Communicator::eMain);
+	t_base_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
 
 	Communication_message* tp_msg = new Communication_message(t_base_msg.SerializeAsString());
 	bool is_push = m_send_data_list.push(tp_msg);
@@ -576,10 +596,7 @@ Error_manager Communication_socket_base::encapsulate_msg(std::string message)
 Error_manager Communication_socket_base::encapsulate_msg(Communication_message* p_msg)
 {
 	Communication_message* tp_msg = new Communication_message(*p_msg);
-
 	bool is_push = m_send_data_list.push(tp_msg);
-
-
 	if ( is_push == false )
 	{
 		delete(tp_msg);

+ 28 - 6
communication/communication_socket_base.h

@@ -14,7 +14,8 @@
 #ifndef __COMMUNICATION_SOCKET_BASE__HH__
 #define __COMMUNICATION_SOCKET_BASE__HH__
 
-
+#include <mutex>
+#include <thread>
 #include <nnxx/message>
 #include <nnxx/socket.h>
 #include <nnxx/bus.h>
@@ -29,7 +30,7 @@
 #include "../communication/communication_message.h"
 
 #include "../message/message_base.pb.h"
-#include "../message/measure_message.pb.h"
+//#include "../message/measure_message.pb.h"
 
 
 
@@ -75,13 +76,15 @@ public://API functions
 	
 	
 public://get or set member variable
+	void set_analysis_cycle_time(unsigned int analysis_cycle_time);
+	void set_encapsulate_cycle_time(unsigned int encapsulate_cycle_time);
 
 protected:
 	//mp_receive_data_thread 接受线程执行函数,
 	//receive_data_thread 内部线程负责接受消息
-	static void receive_data_thread(Communication_socket_base* communicator);
+	void receive_data_thread();
 
-	//检查消息是否可以被解析, 需要子类重载
+	//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
 	virtual Error_manager check_msg(Communication_message* p_msg);
 
 	//mp_analysis_data_thread 解析线程执行函数,
@@ -91,7 +94,7 @@ protected:
 	//遍历接受链表, 解析消息,
 	Error_manager analysis_receive_list();
 
-	//检查消息是否可以被解析, 需要子类重载
+	//检查执行者的状态, 判断能否处理这条消息, 需要子类重载
 	virtual Error_manager check_executer(Communication_message* p_msg);
 
 	//处理消息, 需要子类重载
@@ -99,7 +102,7 @@ protected:
 
 	//mp_send_data_thread 发送线程执行函数,
 	//send_data_thread 内部线程负责发送消息
-	static void send_data_thread(Communication_socket_base* communicator);
+	void send_data_thread();
 
 	//mp_encapsulate_data_thread 封装线程执行函数,
 	//encapsulate_data_thread 内部线程负责封装消息
@@ -129,6 +132,7 @@ protected://member variable
 	Thread_condition					m_receive_condition;			//接受的条件变量
 	std::thread*						mp_analysis_data_thread;    	//解析的线程指针
 	Thread_condition					m_analysis_data_condition;		//解析的条件变量
+	unsigned int 						m_analysis_cycle_time;			//自动解析的时间周期
 
 	//发送模块,
 	Thread_safe_list<Communication_message*>		m_send_data_list;				//发送的list容器
@@ -136,9 +140,27 @@ protected://member variable
 	Thread_condition					m_send_data_condition;			//发送的条件变量
 	std::thread*						mp_encapsulate_data_thread;    	//封装的线程指针
 	Thread_condition					m_encapsulate_data_condition;	//封装的条件变量
+	unsigned int 						m_encapsulate_cycle_time;		//自动封装的时间周期
+
+
 
 private:
 
 };
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 #endif //__COMMUNICATION_SOCKET_BASE__HH__

+ 74 - 221
error_code/error_code.cpp

@@ -15,45 +15,38 @@ Error_manager::Error_manager()
 {
     m_error_code = SUCCESS;
     m_error_level = NORMAL;
-    pm_error_description = 0;
-    m_description_length = 0;
-    return ;
 }
 //拷贝构造
 Error_manager::Error_manager(const Error_manager & error_manager)
 {
     this->m_error_code = error_manager.m_error_code;
     this->m_error_level = error_manager.m_error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(error_manager.pm_error_description, error_manager.m_description_length);
+	this->m_error_description=error_manager.m_error_description;
     return ;
 }
 //赋值构造
 Error_manager::Error_manager(Error_code error_code, Error_level error_level,
-    const char* p_error_description, int description_length)
+    const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+    if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //赋值构造
 Error_manager::Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    pm_error_description = NULL;
-    m_description_length = 0;
-    reallocate_memory_and_copy_string(error_aggregate_string);
-    return ;
+    m_error_description=error_aggregate_string;
+	return ;
 }
 //析构函数
 Error_manager::~Error_manager()
 {
-    free_description();
 }
 
 //初始化
@@ -62,44 +55,49 @@ void Error_manager::error_manager_init()
     error_manager_clear_all();
     return;
 }
-//初始化
-void Error_manager::error_manager_init(Error_code error_code, Error_level error_level, const char* p_error_description, int description_length)
+void Error_manager::error_manager_init(Error_code error_code, Error_level error_level, const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //初始化
 void Error_manager::error_manager_init(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(error_aggregate_string);
+    m_error_description=error_aggregate_string;
     return ;
 }
 //重置
-void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description, int description_length)
+void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level, const char* p_error_description)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description!= nullptr)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return ;
 }
 //重置
 void Error_manager::error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string)
 {
     m_error_code = error_code;
     m_error_level = error_level;
-    reallocate_memory_and_copy_string(error_aggregate_string);
-    return ;
+    m_error_description=error_aggregate_string;
+	return;
 }
 //重置
 void Error_manager::error_manager_reset(const Error_manager & error_manager)
 {
     this->m_error_code = error_manager.m_error_code;
     this->m_error_level = error_manager.m_error_level;
-    reallocate_memory_and_copy_string(error_manager.pm_error_description, error_manager.m_description_length);
+	this->m_error_description=error_manager.m_error_description;
     return ;
 }
 //清除所有内容
@@ -107,24 +105,27 @@ void Error_manager::error_manager_clear_all()
 {
     m_error_code = SUCCESS;
     m_error_level = NORMAL;
-    free_description();
+	m_error_description.clear();
+	return;
 }
 
 //重载=
 Error_manager& Error_manager::operator=(const Error_manager & error_manager)
 {
     error_manager_reset(error_manager);
+	return *this;
 }
 //重载=,支持Error_manager和Error_code的直接转化,会清空错误等级和描述
 Error_manager& Error_manager::operator=(Error_code error_code)
 {
     error_manager_clear_all();
     set_error_code(error_code);
+	return *this;
 }
 //重载==
 bool Error_manager::operator==(const Error_manager & error_manager)
 {
-    is_equal_error_manager(error_manager);
+	return is_equal_error_manager(error_manager);
 }
 //重载==,支持Error_manager和Error_code的直接比较
 bool Error_manager::operator==(Error_code error_code)
@@ -142,7 +143,7 @@ bool Error_manager::operator==(Error_code error_code)
 //重载!=
 bool Error_manager::operator!=(const Error_manager & error_manager)
 {
-    ! is_equal_error_manager(error_manager);
+	return (! is_equal_error_manager(error_manager));
 }
 //重载!=,支持Error_manager和Error_code的直接比较
 bool Error_manager::operator!=(Error_code error_code)
@@ -174,48 +175,28 @@ Error_level Error_manager::get_error_level()
     return m_error_level;
 }
 //获取错误描述的指针,(浅拷贝)
-char* Error_manager::get_error_description()
+std::string Error_manager::get_error_description()
 {
-    if(pm_error_description== nullptr)
-        return "";
-    return pm_error_description;
+    return m_error_description;
 }
 
 //复制错误描述,(深拷贝)
 //output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
 //output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
-void Error_manager::copy_error_description(const char* p_error_description, int description_length)
+void Error_manager::copy_error_description(const char* p_error_description)
 {
-    if(p_error_description != NULL && pm_error_description != NULL)
+    if(p_error_description != NULL)
     {
-        char *pt_source = (char *)p_error_description;
-        char* pt_destination = pm_error_description;
-
-        int t_length_min = m_description_length;
-        if(m_description_length > description_length)
-        {
-            t_length_min = description_length;
-        }
-
-        for(int i=0;i<t_length_min; i++)
-        {
-            *pt_destination = *pt_source;
-            pt_destination++;
-            pt_source++;
-        }
+        m_error_description=std::string(p_error_description);
     }
-
-    return;
+	return;
 }
 //复制错误描述,(深拷贝)
 //output:error_description_string     错误描述的string
 void Error_manager::copy_error_description(std::string & error_description_string)
 {
-    if( (!error_description_string.empty() ) && pm_error_description != NULL)
-    {
-        error_description_string = pm_error_description;
-    }
-    return;
+    m_error_description=error_description_string;
+	return;
 }
 
 //设置错误码
@@ -249,64 +230,33 @@ void Error_manager::set_error_level_location(Error_level error_level)
     return;
 }
 //设置错误描述
-void Error_manager::set_error_description(const char* p_error_description, int description_length)
+void Error_manager::set_error_description(const char* p_error_description)
 {
-    reallocate_memory_and_copy_string(p_error_description, description_length);
-    return ;
+	if(p_error_description != NULL)
+	{
+		m_error_description=std::string(p_error_description);
+	}
+	return;
 }
 //设置错误描述
 void Error_manager::set_error_description(std::string & error_description_string)
 {
-    reallocate_memory_and_copy_string(error_description_string);
-    return ;
+	m_error_description = error_description_string;
+	return ;
 }
 
 //尾部追加错误描述
-void Error_manager::add_error_description(const char* p_error_description, int description_length)
+void Error_manager::add_error_description(const char* p_error_description)
 {
     if(p_error_description !=NULL)
     {
-        char* pt_description_front = pm_error_description;
-        int t_description_front_length = m_description_length;
-        char* pt_description_back = (char *)p_error_description;
-        int t_description_back_length = 0;
-
-        if(description_length == 0)
-        {
-            t_description_back_length = 0;
-            while (*pt_description_back != '\0')
-            {
-                t_description_back_length++;
-                pt_description_back++;
-            }
-            t_description_back_length++;
-            pt_description_back = (char *)p_error_description;
-        }
-        else
-        {
-            t_description_back_length = description_length;
-        }
-
-        int t_description_new_length = t_description_front_length + 5 + t_description_back_length - 1;
-        char* pt_description_new =  (char*) malloc(t_description_new_length );
-
-        sprintf(pt_description_new, "%s ### %s", pt_description_front, pt_description_back);
-        free_description();
-        pm_error_description = pt_description_new;
-        m_description_length = t_description_new_length;
+        m_error_description+=std::string(p_error_description);
     }
-    return ;
 }
 //尾部追加错误描述
 void Error_manager::add_error_description(std::string & error_description_string)
 {
-    if( ! error_description_string.empty() )
-    {
-        std::string t_description_string = pm_error_description ;
-        t_description_string += (" ### "+ error_description_string);
-
-        reallocate_memory_and_copy_string(t_description_string);
-    }
+    m_error_description+=error_description_string;
 }
 
 //比较错误是否相同,
@@ -338,26 +288,20 @@ void Error_manager::compare_and_cover_error(const Error_manager & error_manager)
     else
     {
         Error_manager t_error_manager_new;
-        char* pt_string_inside = NULL;
-        int t_string_inside_length = 0;
+        std::string pt_string_inside ;
         if(this->m_error_level < error_manager.m_error_level)
         {
-            t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + this->m_description_length;
-            pt_string_inside = (char*)malloc(t_string_inside_length);
-            translate_error_to_string(pt_string_inside, t_string_inside_length);
-
+            translate_error_to_string(pt_string_inside);
             error_manager_reset(error_manager);
-            add_error_description(pt_string_inside,t_string_inside_length);
+            add_error_description(pt_string_inside);
         }
         else
         {
-            t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + error_manager.m_description_length;
-            pt_string_inside = (char*)malloc(t_string_inside_length);
-			((Error_manager & )error_manager).translate_error_to_string(pt_string_inside, t_string_inside_length);
-
-            add_error_description(pt_string_inside,t_string_inside_length);
+			((Error_manager&)error_manager).translate_error_to_string(pt_string_inside);
+            add_error_description(pt_string_inside);
         }
     }
+	return;
 }
 //比较并覆盖错误,讲低级错误转为字符串存放于描述中,
 //如果错误相同,则保留this的,将输入参数转入描述。
@@ -369,90 +313,48 @@ void Error_manager::compare_and_cover_error( Error_manager * p_error_manager)
 	}
 	else if (p_error_manager->m_error_code == SUCCESS)
 	{
-		//
+		return;
 	}
 	else
 	{
 		Error_manager t_error_manager_new;
-		char* pt_string_inside = NULL;
-		int t_string_inside_length = 0;
+		std::string pt_string_inside;
 		if(this->m_error_level < p_error_manager->m_error_level)
 		{
-			t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + this->m_description_length;
-			pt_string_inside = (char*)malloc(t_string_inside_length);
-			translate_error_to_string(pt_string_inside, t_string_inside_length);
-
+			translate_error_to_string(pt_string_inside);
 			error_manager_reset(*p_error_manager);
-			add_error_description(pt_string_inside,t_string_inside_length);
+			add_error_description(pt_string_inside);
 		}
 		else
 		{
-			t_string_inside_length = ERROR_NAMAGER_TO_STRING_FRONT_LENGTH + p_error_manager->m_description_length;
-			pt_string_inside = (char*)malloc(t_string_inside_length);
-			p_error_manager->translate_error_to_string(pt_string_inside, t_string_inside_length);
-
-			add_error_description(pt_string_inside,t_string_inside_length);
+			p_error_manager->translate_error_to_string(pt_string_inside);
+			add_error_description(pt_string_inside);
 		}
 	}
 }
 
-//将所有的错误信息,格式化为字符串,用作日志打印。
-//output:p_error_description     错误汇总的字符串指针,不可以为NULL,必须要有实际的内存
-//output:description_length      错误汇总的字符串长度,不可以为0,长度最好足够大,一般256即可。
-void Error_manager::translate_error_to_string(char* p_error_aggregate, int aggregate_length )
-{
-    char t_string_array[ERROR_NAMAGER_TO_STRING_FRONT_LENGTH] = {0};
-    char* pt_index_front = t_string_array;
-    char* pt_index_back = pm_error_description;
-    char* pt_index = p_error_aggregate;
 
-    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:", m_error_code , m_error_level );
-
-    int t_length_min = m_description_length + ERROR_NAMAGER_TO_STRING_FRONT_LENGTH -1;
-    if(t_length_min > aggregate_length)
-    {
-        t_length_min = aggregate_length;
-    }
-
-    for(int i=0;i<t_length_min; i++)
-    {
-        if(i < ERROR_NAMAGER_TO_STRING_FRONT_LENGTH -1)
-        {
-            *pt_index = *pt_index_front;
-            pt_index++;
-            pt_index_front++;
-        }
-        else
-        {
-            *pt_index = *pt_index_back;
-            pt_index++;
-            pt_index_back++;
-        }
-    }
-}
 //output:error_description_string     错误汇总的string
 void Error_manager::translate_error_to_string(std::string & error_aggregate_string)
 {
-    char t_string_array[ERROR_NAMAGER_TO_STRING_FRONT_LENGTH] = {0};
-    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:", m_error_code , m_error_level );
+    char t_string_array[255] = {0};
+    sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
 
     error_aggregate_string = t_string_array ;
-    if(pm_error_description != NULL)
-    {
-        error_aggregate_string += pm_error_description;
-    }
-    else
-    {
-        //error_aggregate_string += "NULL";
-    }
+	error_aggregate_string+= m_error_description;
+	return;
 }
 //错误码转字符串的简易版,可支持cout<<
 //return     错误汇总的string
 std::string Error_manager::to_string()
 {
-    std::string t_string;
-    translate_error_to_string(t_string);
-    return t_string;
+	char t_string_array[255] = {0};
+	sprintf(t_string_array, "error_code:0x%08x, error_level:%02d, error_description:",
+            m_error_code , m_error_level);
+    std::string error_aggregate_string = t_string_array ;
+	error_aggregate_string+= m_error_description;
+	return error_aggregate_string;
 }
 
 
@@ -461,12 +363,6 @@ std::string Error_manager::to_string()
 //释放错误描述的内存,
 void Error_manager::free_description()
 {
-    if(pm_error_description != NULL)
-    {
-        free (pm_error_description);
-        pm_error_description = NULL;
-    }
-    m_description_length = 0;
 }
 
 //重新分配错误描述的内存,并从外部拷贝新的(深拷贝)
@@ -474,40 +370,6 @@ void Error_manager::free_description()
 //input:description_length      错误描述的字符串长度,如果为0,则从p_error_description里面获取有效的长度
 void Error_manager::reallocate_memory_and_copy_string(const char* p_error_description, int description_length)
 {
-    free_description();
-
-    if(p_error_description != NULL)
-    {
-        char* pt_source = (char *)p_error_description;
-        char* pt_destination = NULL;
-
-        if(description_length == 0)
-        {
-            m_description_length = 0;
-            while (*pt_source != '\0')
-            {
-                m_description_length++;
-                pt_source++;
-            }
-            m_description_length++;
-            pt_source = (char *)p_error_description;
-        }
-        else
-        {
-            m_description_length = description_length;
-        }
-
-        pm_error_description =  (char*) malloc(m_description_length );
-        pt_destination = pm_error_description;
-
-        for(int i=0;i<m_description_length; i++)
-        {
-            *pt_destination = *pt_source;
-            pt_destination++;
-            pt_source++;
-        }
-    }
-
     return;
 }
 
@@ -516,16 +378,7 @@ void Error_manager::reallocate_memory_and_copy_string(const char* p_error_descri
 //input:error_aggregate_string     错误描述的string
 void Error_manager::reallocate_memory_and_copy_string(std::string & error_aggregate_string)
 {
-    free_description();
-
-    if( ! error_aggregate_string.empty())
-    {
-        m_description_length = error_aggregate_string.length()+1;
-
-        pm_error_description =  (char*) malloc( m_description_length );
-
-        strcpy(pm_error_description ,   error_aggregate_string.c_str()  );
-    }
+    return;
 }
 
 

+ 452 - 176
error_code/error_code.h

@@ -1,4 +1,8 @@
 
+#define MAIN_TEST 1
+//#define PROCESS_TEST 1
+//#define TIME_TEST 1
+
 //Error_code是错误码的底层通用模块,
 //功能:用作故障分析和处理。
 
@@ -48,21 +52,24 @@ enum Error_code
 
 
     //基本错误码,
-    FAILED                          = 0x00000001,//失败
-    ERROR                           = 0x00000002,//错误
-    WARNING                         = 0x00000003,//警告
+    ERROR                           = 0x00000001,//错误
     PARTIAL_SUCCESS                 = 0x00000002,//部分成功
+    WARNING                         = 0x00000003,//警告
+    FAILED                          = 0x00000004,//失败
 
-
-    NO_DATA                         = 0x00000010,//没有数据,传入参数容器内部没有数据时,
+    NODATA                          = 0x00000010,//没有数据,传入参数容器内部没有数据时,
 	INVALID_MESSAGE					= 0x00000011, //无效的消息,
-    RESPONSE_TIMEOUT                = 0x00000012,
+	PARSE_FAILED					= 0x00000012,//解析失败
+
     PAUSE                           = 0x00000013,   //急停
     TASK_CANCEL                     = 0x00000014,   //任务取消
 
     DISCONNECT                      = 0x00000020,   //通讯中断/断开连接
     UNKNOW_STATU                    = 0x00000021,   //未知状态
 
+    TASK_TIMEOVER					= 0x00000020,//任务超时
+	RESPONSE_TIMEOUT                = 0x00000021,//答复超时
+
     POINTER_IS_NULL                 = 0x00000101,//空指针
     PARAMETER_ERROR                 = 0x00000102,//参数错误,传入参数不符合规范时,
     POINTER_MALLOC_FAIL             = 0x00000103,//手动分配内存失败
@@ -71,6 +78,9 @@ enum Error_code
 
 	CONTAINER_IS_TERMINATE			= 0x00000301,//容器被终止
 
+
+
+
 //    错误码的规范,
 //    错误码是int型,32位,十六进制。
 //    例如0x12345678
@@ -81,6 +91,9 @@ enum Error_code
 //    注:错误码的制定从1开始,不要从0开始,
 //        0用作错误码的基数,用来位运算,来判断错误码的范围。
 
+
+	//主控通信
+	LOCATER_MSG_TABLE_NOT_EXIST  				= 0xa0010000,
     LOCATER_MSG_RESPONSE_TYPE_ERROR,                                //测量反馈消息类型错误(致命)
     LOCATER_MSG_RESPONSE_INFO_ERROR,
     LOCATER_MSG_REQUEST_CANCELED,
@@ -91,7 +104,7 @@ enum Error_code
    /*
     * parkspace error code
     */
-    PARKSPACE_REQUEST_MSG_TYPE_ERROR                = 0x04010000,
+    PARKSPACE_REQUEST_MSG_TYPE_ERROR            = 0xa1010000,
     PARKSPACE_ALLOCMSG_RESPONSE_HAS_NO_REQUEST,
     PARKSPACE_SEARCHMSG_RESPONSE_HAS_NO_REQUEST,
     PARKSPACE_RELEASEMSG_RESPONSE_HAS_NO_REQUEST,
@@ -116,6 +129,282 @@ enum Error_code
     PARKSPACE_RELEASE_REQUEST_CANCELED,
 
 
+
+
+
+
+//    laser扫描模块
+    LASER_ERROR_BASE                = 0x01000000,
+
+//    laser_base基类
+	LASER_BASE_ERROR_BASE			= 0x01010000,
+    LASER_TASK_PARAMETER_ERROR      = 0x01010001,   //雷达基类模块, 任务输入参数错误
+    LASER_CONNECT_FAILED,							//雷达基类模块, 连接失败
+	LASER_START_FAILED,								//雷达基类模块, 开始扫描失败
+	LASER_CHECK_FAILED,								//雷达基类模块, 检查失败
+	LASER_STATUS_BUSY,								//雷达基类模块, 状态正忙
+	LASER_STATUS_ERROR,								//雷达基类模块, 状态错误
+	LASER_TASK_OVER_TIME,							//雷达基类模块, 任务超时
+	LASER_QUEUE_ERROR,								//雷达基类模块, 数据缓存错误
+
+
+//   livox  大疆雷达
+    LIVOX_ERROR_BASE                = 0x01020000,
+    LIVOX_START_FAILE,								//livox模块,开始扫描失败
+	LIVOX_TASK_TYPE_ERROR,							//livox模块,任务类型错误
+	lIVOX_CANNOT_PUSH_DATA,							//livox模块,不能添加扫描的数据
+	lIVOX_CHECK_FAILED,								//livox模块,检查失败
+	lIVOX_STATUS_BUSY,								//livox模块,状态正忙
+	lIVOX_STATUS_ERROR,								//livox模块,状态错误
+
+	//laser_manager 雷达管理模块
+	LASER_MANAGER_ERROR_BASE						= 0x01030000,
+	LASER_MANAGER_READ_PROTOBUF_ERROR,				//雷达管理模块,读取参数错误
+	LASER_MANAGER_STATUS_BUSY,						//雷达管理模块,状态正忙
+	LASER_MANAGER_STATUS_ERROR,						//雷达管理模块,状态错误
+	LASER_MANAGER_TASK_TYPE_ERROR,					//雷达管理模块,任务类型错误
+	LASER_MANAGER_IS_NOT_READY,						//雷达管理模块,不在准备状态
+	LASER_MANAGER_TASK_OVER_TIME,					//雷达管理模块,任务超时
+	LASER_MANAGER_LASER_INDEX_ERRPR,				//雷达管理模块,雷达索引错误,编号错误。
+	LASER_MANAGER_LASER_INDEX_REPEAT,				//雷达管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+
+//livox_driver 雷达livox驱动模块
+	LIVOX_DRIVER_ERROR_BASE							= 0x01040000,
+	LIVOX_DRIVER_SN_REPEAT,							//livox驱动模块, 雷达广播码重复
+	LIVOX_DRIVER_SN_ERROR,							//livox驱动模块, 雷达广播码错误
+	LIVOX_SKD_INIT_FAILED,							//livox驱动模块, livox_sdk初始化失败
+	LIVOX_DRIVER_NOT_READY,							//livox驱动模块, livox没有准备好.
+
+
+
+
+     //PLC error code  ...
+    PLC_ERROR_BASE                  				= 0x02010000,
+    PLC_UNKNOWN_ERROR,								//plc未知错误
+    PLC_EMPTY_TASK,									//plc任务为空
+    PLC_IP_PORT_ERROR,								//plc的ip端口错误
+    PLC_SLAVE_ID_ERROR,								//plc的身份id错误
+    PLC_CONNECTION_FAILED,							//PLC连接失败
+    PLC_READ_FAILED,								//plc读取失败
+    PLC_WRITE_FAILED,								//plc写入失败
+    PLC_NOT_ENOUGH_DATA_ERROR,						//PLC没有足够的数据错误
+
+
+
+    //locate 定位模块,
+	LOCATER_ERROR_BASE                				= 0x03000000,
+	//LASER_MANAGER 定位管理模块
+	LOCATER_MANAGER_ERROR_BASE                		= 0x03010000,
+	LOCATER_MANAGER_READ_PROTOBUF_ERROR,				//定位管理模块,读取参数错误
+	LOCATER_MANAGER_STATUS_BUSY,						//定位管理模块,状态正忙
+	LOCATER_MANAGER_STATUS_ERROR,						//定位管理模块,状态错误
+	LOCATER_MANAGER_TASK_TYPE_ERROR,					//定位管理模块,任务类型错误
+	LOCATER_MANAGER_IS_NOT_READY,						//定位管理模块,不在准备状态
+	LOCATER_MANAGER_CLOUD_MAP_ERROR,					//定位管理模块,任务输入点云map的error
+	LOCATER_MANAGER_TASK_OVER_TIME,						//定位管理模块,任务超时
+
+
+	//Locater  算法模块	
+	LOCATER_ALGORITHM_ERROR_BASE					= 0x03020000,
+	LOCATER_TASK_INIT_CLOUD_EMPTY,						//定位任务初始化点云为空
+	LOCATER_TASK_ERROR,									//定位任务错误
+	LOCATER_TASK_INPUT_CLOUD_UNINIT,					//定位任务输入点云为空
+	LOCATER_INPUT_CLOUD_EMPTY,							//定位输入点云为空
+	LOCATER_YOLO_UNINIT,								//定位yolo未初始化
+	LOCATER_POINTSIFT_UNINIT,							//定位POINTSIFT未初始化
+	LOCATER_3DCNN_UNINIT,								//定位3DCNN未初始化
+	LOCATER_INPUT_YOLO_CLOUD_EMPTY,						//定位输入yolo点云为空
+	LOCATER_Y_OUT_RANGE_BY_PLC,							//定位超出plc的限制范围
+	LOCATER_MEASURE_HEIGHT_CLOUD_UNINIT,				//定位测量高点云未初始化
+	LOCATER_MEASURE_HEIGHT_CLOUD_EMPTY,					//定位测量高点云为空
+	LOCATER_INPUT_CLOUD_UNINIT,							//定位输入点云未初始化
+
+
+    //point sift from 0x03010100-0x030101FF
+	LOCATER_SIFT_ERROR_BASE							=0x03020100,
+   	LOCATER_SIFT_INIT_FAILED,							//定位过滤模块,初始化失败
+    LOCATER_SIFT_INPUT_CLOUD_UNINIT,					//定位过滤模块,输入点云未初始化
+	LOCATER_SIFT_INPUT_CLOUD_EMPTY,						//定位过滤模块,输入点云为空
+	LOCATER_SIFT_GRID_ERROR,							//定位过滤模块,筛选网格错误
+	LOCATER_SIFT_SELECT_ERROR,							//定位过滤模块,筛选选择错误
+	LOCATER_SIFT_CLOUD_VERY_LITTLE,						//定位过滤模块,筛选点云很少
+	LOCATER_SIFT_CREATE_INPUT_DATA_FAILED,				//定位过滤模块,筛选创建输入数据失败
+	LOCATER_SIFT_PREDICT_FAILED,						//定位过滤模块,预测失败
+	LOCATER_SIFT_PREDICT_TIMEOUT,						//定位过滤模块,预测超时
+	LOCATER_SIFT_PREDICT_NO_WHEEL_POINT,				//定位过滤模块,预测结果没有车轮点云
+	LOCATER_SIFT_PREDICT_NO_CAR_POINT,					//定位过滤模块,预测结果没有车身点云
+
+    LOCATER_SIFT_FILTE_OBS_FAILED,						//定位过滤模块,过滤OBS失败
+    LOCATER_SIFT_INPUT_BOX_PARAMETER_FAILED,			//定位过滤模块,输入范围参数错误
+
+//    //yolo 
+//    LOCATER_YOLO_ERROR_BASE						=0x03020200,
+//    LOCATER_YOLO_DETECT_FAILED,
+//    LOCATER_YOLO_DETECT_NO_TARGET,
+//    LOCATER_YOLO_PARAMETER_INVALID,
+//    LOCATER_YOLO_INPUT_CLOUD_UNINIT,
+
+    //3dcnn from 0x03010300-0x030103FF
+    LOCATER_3DCNN_ERROR_BASE						=0x03020300,
+    LOCATER_3DCNN_INIT_FAILED,							//定位3DCNN模块,初始化失败
+    LOCATER_3DCNN_INPUT_CLOUD_UNINIT,					//定位3DCNN模块,输入点云未初始化
+	LOCATER_3DCNN_INPUT_CLOUD_EMPTY,					//定位3DCNN模块,输入点云为空
+	LOCATER_3DCNN_INPUT_CLOUD_MAP_ERROR,				//定位3DCNN模块,输入点云的map错误
+	LOCATER_3DCNN_PCA_OUT_ERROR,						//定位3DCNN模块,pca错误
+	LOCATER_3DCNN_EXTRACT_RECT_ERROR,					//定位3DCNN模块,提取矩形错误
+	LOCATER_3DCNN_RECT_SIZE_ERROR,						//定位3DCNN模块,矩形范围错误
+
+    LOCATER_3DCNN_PREDICT_FAILED,						//定位3DCNN模块,预测失败
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_3,					//定位3DCNN模块,验证矩形失败3
+    LOCATER_3DCNN_VERIFY_RECT_FAILED_4,					//定位3DCNN模块,验证矩形失败4
+    LOCATER_3DCNN_KMEANS_FAILED,						//定位3DCNN模块,k均值失败
+    LOCATER_3DCNN_IIU_FAILED,							//定位3DCNN模块,IIU失败
+    LOCATER_3DCNN_PCA_OUT_CLOUD_EMPTY,					//定位3DCNN模块,pca输出点云为空
+
+    //System_manager error from 0x04010000-0x0401FFFF
+    SYSTEM_READ_PARAMETER_ERROR						=0x04010100,
+    SYSTEM_PARAMETER_ERROR,
+    SYSTEM_INPUT_TERMINOR_NO_LASERS,
+
+    //terminor_command_executor.cpp from 0x04010200-0x040102FF
+    TERMINOR_NOT_READY								=0x04010200,
+    TERMINOR_INPUT_LASER_NULL,
+    TERMINOR_NOT_CONTAINS_LASER,
+    TERMINOR_INPUT_PLC_NULL,
+    TERMINOR_INPUT_LOCATER_NULL,
+    TERMINOR_CREATE_WORKING_THREAD_FAILED,
+    TERMINOR_FORCE_QUIT,
+    TERMINOR_LASER_TIMEOUT,
+    TERMINOR_POST_PLC_TIMEOUT,
+    TERMINOR_CHECK_RESULTS_ERROR,
+
+    ////Hardware limit from 0x05010000 - 0x0501ffff
+    ///railing.cpp from 0x05010100-0x050101ff
+    HARDWARE_LIMIT_LEFT_RAILING						=0x05010100,         //左栏杆限制
+    HARDWARE_LIMIT_RAILING_PARAMETER_ERROR,
+    HARDWARE_LIMIT_RAILING_ERROR,
+    HARDWARE_LIMIT_CENTER_X_LEFT,
+    HARDWARE_LIMIT_CENTER_X_RIGHT,
+    HARDWARE_LIMIT_CENTER_Y_TOP,
+    HARDWARE_LIMIT_CENTER_Y_BOTTOM,
+    HARDWARE_LIMIT_HEIGHT_OUT_RANGE,
+    HARDWARE_LIMIT_ANGLE_OUT_RANGE,
+    //termonal_limit from 0x05010200-0x050102ff
+    HARDWARE_LIMIT_TERMINAL_LEFT_ERROR,
+    HARDWARE_LIMIT_TERMINAL_RIGHT_ERROR,
+    HARDWARE_LIMIT_TERMINAL_LR_ERROR,
+
+
+//万集设备模块,
+    WANJI_LIDAR_DEVICE_ERROR_BASE								=0x06080000,//万集设备模块,错误基类
+	WANJI_LIDAR_DEVICE_STATUS_BUSY,									//万集设备模块,状态正忙
+	WANJI_LIDAR_DEVICE_STATUS_ERROR,								//万集设备模块,状态错误
+	WANJI_LIDAR_DEVICE_TASK_TYPE_ERROR,								//万集设备模块,任务类型错误
+	WANJI_LIDAR_DEVICE_TASK_OVER_TIME,								//万集设备模块,任务超时
+	WANJI_LIDAR_DEVICE_NO_CLOUD,									//万集设备模块,没有点云
+    // velodyne设备模块
+    VELODYNE_LIDAR_DEVICE_ERROR_BASE,								//velodyne设备模块,错误基类
+    VELODYNE_LIDAR_DEVICE_STATUS_BUSY,									//velodyne设备模块,状态正忙
+	VELODYNE_LIDAR_DEVICE_STATUS_ERROR,								//velodyne设备模块,状态错误
+	VELODYNE_LIDAR_DEVICE_TASK_TYPE_ERROR,								//velodyne设备模块,任务类型错误
+	VELODYNE_LIDAR_DEVICE_TASK_OVER_TIME,								//velodyne设备模块,任务超时
+	VELODYNE_LIDAR_DEVICE_NO_CLOUD,									//velodyne设备模块,没有点云
+
+
+	//万集通信wj_lidar error from 0x06010000-0x0601FFFF
+	WJ_LIDAR_COMMUNICATION_ERROR_BASE				=0x06010000,
+	WJ_LIDAR_COMMUNICATION_UNINITIALIZED,							//万集通信,未初始化
+	WJ_LIDAR_COMMUNICATION_DISCONNECT,								//万集通信,断连
+	WJ_LIDAR_COMMUNICATION_FAULT,									//万集通信,故障
+	WJ_LIDAR_CONNECT_FAILED,										//万集通信,连接失败
+    WJ_LIDAR_UNINITIALIZED,											//万集通信,未初始化
+    WJ_LIDAR_READ_FAILED,											//万集通信,读取失败
+    WJ_LIDAR_WRITE_FAILED,											//万集通信,写入失败
+    WJ_LIDAR_GET_CLOUD_TIMEOUT,										//万集通信,获取点云超时
+    // velodyne通信
+    VELODYNE_LIDAR_COMMUNICATION_UNINITIALIZED,							//velodyne通信,未初始化
+	VELODYNE_LIDAR_COMMUNICATION_DISCONNECT,								//velodyne通信,断连
+	VELODYNE_LIDAR_COMMUNICATION_FAULT,									//velodyne通信,故障
+	VELODYNE_LIDAR_CONNECT_FAILED,										//velodyne通信,连接失败
+    VELODYNE_LIDAR_UNINITIALIZED,											//velodyne通信,未初始化
+    VELODYNE_LIDAR_READ_FAILED,											//velodyne通信,读取失败
+    VELODYNE_LIDAR_WRITE_FAILED,											//velodyne通信,写入失败
+    VELODYNE_LIDAR_GET_CLOUD_TIMEOUT,										//velodyne通信,获取点云超时
+
+    //万集解析 wj lidar protocol error from 0x06020000-0x0602FFFF
+        WJ_PROTOCOL_ERROR_BASE						=0x06020000,
+	WJ_PROTOCOL_STATUS_BUSY,										//万集解析, 状态正忙
+	WJ_PROTOCOL_STATUS_ERROR,										//万集解析, 状态错误
+    WJ_PROTOCOL_INTEGRITY_ERROR,									//万集解析, 完整性错误								
+    WJ_PROTOCOL_PARSE_FAILED,										//万集解析, 解析失败
+    WJ_PROTOCOL_EMPTY_PACKAGE,										//万集解析, 空包
+    WJ_PROTOCOL_EXCEED_MAX_SIZE,									//万集解析, 超出最大范围
+
+    //万集测量范围 wj region detect error from 0x06030000-0x0603FFFF
+	WJ_REGION_ERROR_BASE							= 0x06030000,
+	WJ_REGION_EMPTY_CLOUD,											//万集测量,空点云	
+	WJ_REGION_EMPTY_NO_WHEEL_INFORMATION,							//万集测量,没有车轮信息
+    WJ_REGION_RECTANGLE_ANGLE_ERROR,								//万集测量,矩形旋转角错误
+    WJ_REGION_RECTANGLE_SIZE_ERROR,									//万集测量,矩形大小错误
+    WJ_REGION_RECTANGLE_SYMMETRY_ERROR,								//万集测量,矩形对称错误
+    WJ_REGION_CLUSTER_SIZE_ERROR,									//万集测量,簇大小错误
+    WJ_REGION_CERES_SOLVE_ERROR,                                    //万集测量,优化失败
+    //velodyne测量范围
+	VELODYNE_REGION_ERROR_BASE,
+	VELODYNE_REGION_EMPTY_CLOUD,											//velodyne测量,空点云	
+	VELODYNE_REGION_EMPTY_NO_WHEEL_INFORMATION,							//velodyne测量,没有车轮信息
+    VELODYNE_REGION_RECTANGLE_ANGLE_ERROR,								//velodyne测量,矩形旋转角错误
+    VELODYNE_REGION_RECTANGLE_SIZE_ERROR,									//velodyne测量,矩形大小错误
+    VELODYNE_REGION_RECTANGLE_SYMMETRY_ERROR,								//velodyne测量,矩形对称错误
+    VELODYNE_REGION_CLUSTER_SIZE_ERROR,									//velodyne测量,簇大小错误
+    VELODYNE_REGION_CERES_SOLVE_ERROR,                                    //velodyne测量,优化失败
+
+    //万集管理模块 wj manager error from 0x06040000-0x0604FFFF
+	WJ_MANAGER_ERROR_BASE										= 0x06040000,
+    WJ_MANAGER_UNINITIALIZED,									//万集管理模块,未初始化
+    WJ_MANAGER_LIDAR_DISCONNECTED,								//万集管理模块,雷达断链
+    WJ_MANAGER_PLC_DISCONNECTED,								//万集管理模块,plc断链
+    WJ_MANAGER_EMPTY_CLOUD,										//万集管理模块,空点云
+	WJ_MANAGER_READ_PROTOBUF_ERROR,								//万集管理模块,读取参数错误
+	WJ_MANAGER_INIT_ERROR,										//万集管理模块,初始化error
+	WJ_MANAGER_TASK_TYPE_ERROR,									//万集管理模块,任务类型错误
+	WJ_MANAGER_STATUS_BUSY,										//万集管理模块,状态正忙
+	WJ_MANAGER_STATUS_ERROR,									//万集管理模块,状态错误
+	WJ_MANAGER_LASER_INDEX_ERRPR,								//万集管理模块,雷达索引错误,编号错误。
+	WJ_MANAGER_LASER_INDEX_REPEAT,								//万集管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	WJ_MANAGER_TASK_OVER_TIME,									//万集管理模块,任务超时
+    VELODYNE_MANAGER_ERROR_BASE,										
+    VELODYNE_MANAGER_UNINITIALIZED,									//velodyne管理模块,未初始化
+    VELODYNE_MANAGER_LIDAR_DISCONNECTED,								//velodyne管理模块,雷达断链
+    VELODYNE_MANAGER_EMPTY_CLOUD,										//velodyne管理模块,空点云
+	VELODYNE_MANAGER_READ_PROTOBUF_ERROR,								//velodyne管理模块,读取参数错误
+	VELODYNE_MANAGER_INIT_ERROR,										//velodyne管理模块,初始化error
+	VELODYNE_MANAGER_TASK_TYPE_ERROR,									//velodyne管理模块,任务类型错误
+	VELODYNE_MANAGER_STATUS_BUSY,										//velodyne管理模块,状态正忙
+	VELODYNE_MANAGER_STATUS_ERROR,									//velodyne管理模块,状态错误
+	VELODYNE_MANAGER_LASER_INDEX_ERRPR,								//velodyne管理模块,雷达索引错误,编号错误。
+	VELODYNE_MANAGER_LASER_INDEX_REPEAT,								//velodyne管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
+	VELODYNE_MANAGER_TASK_OVER_TIME,									//velodyne管理模块,任务超时
+
+//万集任务模块
+	WJ_LIDAR_TASK_ERROR_BASE									=0x06050000,
+	WJ_LIDAR_TASK_EMPTY_RESULT,									//万集任务模块,空结果
+    WJ_LIDAR_TASK_EMPTY_TASK,									//万集任务模块,空任务
+    WJ_LIDAR_TASK_WRONG_TYPE,									//万集任务模块,错误类型
+    WJ_LIDAR_TASK_INVALID_TASK,									//万集任务模块,无效任务
+    WJ_LIDAR_TASK_MEASURE_FAILED,								//万集任务模块,测量失败
+
+    // 万集滤波
+    WJ_FILTER_ERROR_BASE                                        =0x06060000,
+    WJ_FILTER_LACK_OF_RESULT,                                   //万集滤波,结果不足以进行滤波
+    WJ_FILTER_FLUCTUATING,                                      //万集滤波,结果波动过大
+
+    //task module, 任务模块  error from 0x10010000-0x1001FFFF
+	TASK_MODULE_ERROR_BASE 							= 0x10010000,
+	TASK_TYPE_IS_UNKNOW,
+	TASK_NO_RECEIVER,
+
+
 	//Communication module, 通信模块
 	COMMUNICATION_BASE_ERROR_BASE					= 0x11010000,
 	COMMUNICATION_READ_PROTOBUF_ERROR,				//模块,读取参数错误
@@ -127,162 +416,153 @@ enum Error_code
 
 
 
-    DISPATCH_ERROR_BASE=	0x13000000,
-    DISPATCH_MANAGER_ERROR_BASE	=0x13010000,
-    DISPATCH_MANAGER_READ_PROTOBUF_ERROR,		//调度管理模块,读取参数错误
-    DISPATCH_MANAGER_STATUS_BUSY,		//调度管理模块,状态正忙
-    DISPATCH_MANAGER_STATUS_ERROR,		//调度管理模块,状态错误
-    DISPATCH_MANAGER_TASK_TYPE_ERROR,		//调度管理模块,任务类型错误
-    DISPATCH_MANAGER_IS_NOT_READY,		//调度管理模块,不在准备状态
-    CARRIER_ERROR_BASE	=0x13020000,
-    CARRIER_READ_PROTOBUF_ERROR	,	//搬运器模块,读取参数错误
-    CARRIER_STATUS_BUSY	,	//搬运器模块,状态正忙
-    CARRIER_STATUS_ERROR,		//搬运器模块,状态错误
-    CARRIER_STATUS_DISCONNECT,		//搬运器模块,状态断连
-    CARRIER_TASK_TYPE_ERROR	,	//搬运器模块,任务类型错误
-    CARRIER_TASK_OVER_TIME	,	//搬运器模块,任务超时
-    CARRIER_IS_NOT_READY	,	//搬运器模块,不在准备状态
-    CARRIER_RESPONS_ERROR	,	//搬运器模块,指令的执行失败
-    CARRIER_TASK_NOTHINGNESS,		//搬运器模块,任务不存在
-    SNAP7_ERROR_BASE	= 0x1401000,
-    SNAP7_READ_PROTOBUF_ERROR	,	//snap7通信模块,读取参数错误
-    SNAP7_CONNECT_ERROR	,	//snap7通信模块,连接错误
-    SNAP7_DISCONNECT_ERROR	,	//snap7通信模块,断连错误
-    SNAP7_READ_ERROR	,	//snap7通信模块,读取错误
-    SNAP7_WRITE_ERROR	,	//snap7通信模块,写入错误
-    SNAP7_ANALYSIS_TIME_OUT	,	//解析超时
-    SNAP7_EXCUTER_IS_BUSY	,	//处理器正忙 请稍等
-
-
-    LASER_ERROR_BASE	=0x01000000,
-    LASER_BASE_ERROR_BASE	=0x01010000,
-    LASER_TASK_PARAMETER_ERROR	=0x01010001,	//雷达基类模块,任务输入参数错误
-    LASER_CONNECT_FAILED,		//雷达基类模块,连接失败
-    LASER_START_FAILED,		//雷达基类模块,开始扫描失败
-    LASER_CHECK_FAILED,		//雷达基类模块,检查失败
-    LASER_STATUS_BUSY,		//雷达基类模块,状态正忙
-    LASER_STATUS_ERROR,		//雷达基类模块,状态错误
-    LASER_TASK_OVER_TIME,		//雷达基类模块,任务超时
-    LASER_QUEUE_ERROR,		//雷达基类模块,数据缓存错误
-    LIVOX_ERROR_BASE	=0x01020000,
-    LIVOX_START_FAILE,		//livox模块,开始扫描失败
-    LIVOX_TASK_TYPE_ERROR,		//livox模块,任务类型错误
-    lIVOX_CANNOT_PUSH_DATA,		//livox模块,不能添加扫描的数据
-    lIVOX_CHECK_FAILED,		//livox模块,检查失败
-    lIVOX_STATUS_BUSY,		//livox模块,状态正忙
-    lIVOX_STATUS_ERROR,		//livox模块,状态错误
-    LASER_MANAGER_ERROR_BASE=	0x01030000,
-    LASER_MANAGER_READ_PROTOBUF_ERROR,		//雷达管理模块,读取参数错误
-    LASER_MANAGER_STATUS_BUSY,		//雷达管理模块,状态正忙
-    LASER_MANAGER_STATUS_ERROR,		//雷达管理模块,状态错误
-    LASER_MANAGER_TASK_TYPE_ERROR,		//雷达管理模块,任务类型错误
-    LASER_MANAGER_IS_NOT_READY,		//雷达管理模块,不在准备状态
-    LASER_MANAGER_TASK_OVER_TIME,		//雷达管理模块,任务超时
-    LASER_MANAGER_LASER_INDEX_ERRPR,		//雷达管理模块,雷达索引错误,编号错误。
-    LASER_MANAGER_LASER_INDEX_REPEAT,		//雷达管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
-    LIVOX_DRIVER_ERROR_BASE	=0x01040000,
-    LIVOX_DRIVER_SN_REPEAT,		//livox驱动模块,雷达广播码重复
-    LIVOX_DRIVER_SN_ERROR,		//livox驱动模块,雷达广播码错误
-    LIVOX_SKD_INIT_FAILED,		//livox驱动模块,livox_sdk初始化失败
-    LIVOX_DRIVER_NOT_READY,		//livox驱动模块,livox没有准备好.
-
-    LOCATER_ERROR_BASE	=0x03000000,
-    LOCATER_MANAGER_ERROR_BASE	=0x03010000,
-    LOCATER_MANAGER_READ_PROTOBUF_ERROR,		//定位管理模块,读取参数错误
-    LOCATER_MANAGER_STATUS_BUSY,		//定位管理模块,状态正忙
-    LOCATER_MANAGER_STATUS_ERROR,		//定位管理模块,状态错误
-    LOCATER_MANAGER_TASK_TYPE_ERROR,		//定位管理模块,任务类型错误
-    LOCATER_MANAGER_IS_NOT_READY,		//定位管理模块,不在准备状态
-    LOCATER_MANAGER_CLOUD_MAP_ERROR,		//定位管理模块,任务输入点云map的error
-    LOCATER_MANAGER_TASK_OVER_TIME,		//定位管理模块,任务超时
-    LOCATER_ALGORITHM_ERROR_BASE	=0x03020000,
-    LOCATER_TASK_INIT_CLOUD_EMPTY	,	//定位任务初始化点云为空
-    LOCATER_TASK_ERROR,		//定位任务错误
-    LOCATER_TASK_INPUT_CLOUD_UNINIT,		//定位任务输入点云为空
-    LOCATER_INPUT_CLOUD_EMPTY,		//定位输入点云为空
-    LOCATER_YOLO_UNINIT,		//定位yolo未初始化
-    LOCATER_POINTSIFT_UNINIT,		//定位POINTSIFT未初始化
-    LOCATER_3DCNN_UNINIT,		//定位3DCNN未初始化
-    LOCATER_INPUT_YOLO_CLOUD_EMPTY,		//定位输入yolo点云为空
-    LOCATER_Y_OUT_RANGE_BY_PLC,		//定位超出plc的限制范围
-    LOCATER_MEASURE_HEIGHT_CLOUD_EMPTY,		//定位测量高点云为空
-    LOCATER_SIFT_ERROR_BASE	=0x03020100,
-    LOCATER_SIFT_INIT_FAILED,		//定位过滤模块,初始化失败
-    LOCATER_SIFT_INPUT_CLOUD_UNINIT,		//定位过滤模块,输入点云未初始化
-    LOCATER_SIFT_INPUT_CLOUD_EMPTY,		//定位过滤模块,输入点云为空
-    LOCATER_SIFT_GRID_ERROR,		//定位过滤模块,筛选网格错误
-    LOCATER_SIFT_SELECT_ERROR,		//定位过滤模块,筛选选择错误
-    LOCATER_SIFT_CLOUD_VERY_LITTLE,		//定位过滤模块,筛选点云很少
-    LOCATER_SIFT_CREATE_INPUT_DATA_FAILED,		//定位过滤模块,筛选创建输入数据失败
-    LOCATER_SIFT_PREDICT_FAILED,		//定位过滤模块,预测失败
-    LOCATER_SIFT_PREDICT_TIMEOUT,		//定位过滤模块,预测超时
-    LOCATER_SIFT_PREDICT_NO_WHEEL_POINT,		//定位过滤模块,预测结果没有车轮点云
-    LOCATER_SIFT_PREDICT_NO_CAR_POINT,		//定位过滤模块,预测结果没有车身点云
-    LOCATER_SIFT_FILTE_OBS_FAILED,		//定位过滤模块,过滤OBS失败
-    LOCATER_SIFT_INPUT_BOX_PARAMETER_FAILED,		//定位过滤模块,输入范围参数错误
-    LOCATER_3DCNN_ERROR_BASE	=0x03020300,
-    LOCATER_3DCNN_INIT_FAILED,		//定位3DCNN模块,初始化失败
-    LOCATER_3DCNN_INPUT_CLOUD_UNINIT,		//定位3DCNN模块,输入点云未初始化
-    LOCATER_3DCNN_INPUT_CLOUD_EMPTY,		//定位3DCNN模块,输入点云为空
-    LOCATER_3DCNN_INPUT_CLOUD_MAP_ERROR,		//定位3DCNN模块,输入点云的map错误
-    LOCATER_3DCNN_PCA_OUT_ERROR,		//定位3DCNN模块,pca错误
-    LOCATER_3DCNN_EXTRACT_RECT_ERROR,		//定位3DCNN模块,提取矩形错误
-    LOCATER_3DCNN_RECT_SIZE_ERROR,		//定位3DCNN模块,矩形范围错误
-    LOCATER_3DCNN_PREDICT_FAILED,		//定位3DCNN模块,预测失败
-    LOCATER_3DCNN_VERIFY_RECT_FAILED_3,		//定位3DCNN模块,验证矩形失败3
-    LOCATER_3DCNN_VERIFY_RECT_FAILED_4,		//定位3DCNN模块,验证矩形失败4
-    LOCATER_3DCNN_KMEANS_FAILED,		//定位3DCNN模块,k均值失败
-    LOCATER_3DCNN_IIU_FAILED,		//定位3DCNN模块,IIU失败
-    LOCATER_3DCNN_PCA_OUT_CLOUD_EMPTY,		//定位3DCNN模块,pca输出点云为空
-
-    WANJI_LIDAR_DEVICE_ERROR_BASE	=0x06080000,	//万集设备模块,错误基类
-    WANJI_LIDAR_DEVICE_STATUS_BUSY,		//万集设备模块,状态正忙
-    WANJI_LIDAR_DEVICE_STATUS_ERROR,		//万集设备模块,状态错误
-    WANJI_LIDAR_DEVICE_TASK_TYPE_ERROR,		//万集设备模块,任务类型错误
-    WANJI_LIDAR_DEVICE_TASK_OVER_TIME,		//万集设备模块,任务超时
-    WANJI_LIDAR_DEVICE_NO_CLOUD,		//万集设备模块,没有点云
-    WJ_LIDAR_COMMUNICATION_ERROR_BASE	=0x06010000,
-    WJ_LIDAR_COMMUNICATION_UNINITIALIZED,		//万集通信,未初始化
-    WJ_LIDAR_COMMUNICATION_DISCONNECT,		//万集通信,断连
-    WJ_LIDAR_COMMUNICATION_FAULT,		//万集通信,故障
-    WJ_LIDAR_CONNECT_FAILED,		//万集通信,连接失败
-    WJ_LIDAR_UNINITIALIZED,		//万集通信,未初始化
-    WJ_LIDAR_READ_FAILED,		//万集通信,读取失败
-    WJ_LIDAR_WRITE_FAILED,		//万集通信,写入失败
-    WJ_LIDAR_GET_CLOUD_TIMEOUT,		//万集通信,获取点云超时
-    WJ_PROTOCOL_ERROR_BASE	=0x06020000,
-    WJ_PROTOCOL_STATUS_BUSY,		//万集解析,状态正忙
-    WJ_PROTOCOL_STATUS_ERROR,		//万集解析,状态错误
-    WJ_PROTOCOL_INTEGRITY_ERROR,		//万集解析,完整性错误
-    WJ_PROTOCOL_PARSE_FAILED,		//万集解析,解析失败
-    WJ_PROTOCOL_EMPTY_PACKAGE,		//万集解析,空包
-    WJ_PROTOCOL_EXCEED_MAX_SIZE,		//万集解析,超出最大范围
-    WJ_REGION_ERROR_BASE	=0x06030000,
-    WJ_REGION_EMPTY_CLOUD,		//万集测量,空点云
-    WJ_REGION_EMPTY_NO_WHEEL_INFORMATION,		//万集测量,没有车轮信息
-    WJ_REGION_RECTANGLE_ANGLE_ERROR,		//万集测量,矩形旋转角错误
-    WJ_REGION_RECTANGLE_SIZE_ERROR,		//万集测量,矩形大小错误
-    WJ_REGION_RECTANGLE_SYMMETRY_ERROR,		//万集测量,矩形对称错误
-    WJ_REGION_CLUSTER_SIZE_ERROR,		//万集测量,簇大小错误
-    WJ_MANAGER_ERROR_BASE	=0x06040000,
-    WJ_MANAGER_UNINITIALIZED,		//万集管理模块,未初始化
-    WJ_MANAGER_LIDAR_DISCONNECTED,		//万集管理模块,雷达断链
-    WJ_MANAGER_PLC_DISCONNECTED,		//万集管理模块,plc断链
-    WJ_MANAGER_EMPTY_CLOUD,		//万集管理模块,空点云
-    WJ_MANAGER_READ_PROTOBUF_ERROR,		//万集管理模块,读取参数错误
-    WJ_MANAGER_INIT_ERROR,		//万集管理模块,重复初始化
-    WJ_MANAGER_TASK_TYPE_ERROR,		//万集管理模块,任务类型错误
-    WJ_MANAGER_STATUS_BUSY,		//万集管理模块,状态正忙
-    WJ_MANAGER_STATUS_ERROR,		//万集管理模块,状态错误
-    WJ_MANAGER_LASER_INDEX_ERRPR,		//万集管理模块,雷达索引错误,编号错误。
-    WJ_MANAGER_LASER_INDEX_REPEAT,		//万集管理模块,需要扫描的雷达索引重复,可忽略的错误,提示作用
-    WJ_MANAGER_TASK_OVER_TIME,		//万集管理模块,任务超时
-    WJ_LIDAR_TASK_ERROR_BASE	=0x06050000,
-    WJ_LIDAR_TASK_EMPTY_RESULT,		//万集任务模块,空结果
-    WJ_LIDAR_TASK_EMPTY_TASK,		//万集任务模块,空任务
-    WJ_LIDAR_TASK_WRONG_TYPE,		//万集任务模块,错误类型
-    WJ_LIDAR_TASK_INVALID_TASK,		//万集任务模块,无效任务
-    WJ_LIDAR_TASK_MEASURE_FAILED,		//万集任务模块,测量失败
+	//system module, 系统模块
+	SYSTEM_EXECUTOR_ERROR_BASE						= 0x12010000,		//系统执行模块,
+	SYSTEM_EXECUTOR_PARSE_ERROR,										//系统执行模块, 解析消息错误
+	SYSTEM_EXECUTOR_STATUS_BUSY,										//系统执行模块, 状态正忙
+	SYSTEM_EXECUTOR_STATUS_ERROR,										//系统执行模块, 状态错误
+	SYSTEM_EXECUTOR_CHECK_ERROR,										//系统执行模块, 检查错误
+
+
+
+	//Dispatch 调度 模块 错误码
+	DISPATCH_ERROR_BASE								= 0x13000000,
+
+	//Dispatch_manager 调度管理模块 错误码
+	DISPATCH_MANAGER_ERROR_BASE						= 0x13010000,
+	DISPATCH_MANAGER_READ_PROTOBUF_ERROR,				//调度管理模块,读取参数错误
+	DISPATCH_MANAGER_STATUS_BUSY,						//调度管理模块,状态正忙
+	DISPATCH_MANAGER_STATUS_ERROR,						//调度管理模块,状态错误
+	DISPATCH_MANAGER_TASK_TYPE_ERROR,					//调度管理模块,任务类型错误
+	DISPATCH_MANAGER_IS_NOT_READY,						//调度管理模块,不在准备状态
+	DISPATCH_MANAGER_SPACE_LOCK_ERROR,					//调度管理模块,空间锁错误
+
+
+	DISPATCH_PROCESS_ERROR_BASE								= 0x13020000,
+	DISPATCH_PROCESS_IS_NOT_READY,						//调度流程, 不在准备状态
+	DISPATCH_PROCESS_DEVICE_TYPE_ERROR,					//调度流程, 设备类型错误
+	DISPATCH_PROCESS_DEVICE_STATUS_ERROR,				//调度流程, 设备状态错误
+	DISPATCH_PROCESS_TASK_STATUS_ERROR,					//调度流程, 任务类型错误
+	DISPATCH_PROCESS_COMMAND_KEY_REPEAT,				//调度流程, 唯一码错误
+	DISPATCH_PROCESS_INIT_ERROR,						//调度流程, 初始化错误
+
+
+	DISPATCH_DEVICE_ERROR_BASE								= 0x13030000,
+	DISPATCH_DEVICE_READ_PROTOBUF_ERROR,				//调度设备模块,读取参数错误
+	DISPATCH_DEVICE_STATUS_BUSY,						//调度设备模块,状态正忙
+	DISPATCH_DEVICE_STATUS_ERROR,						//调度设备模块,状态错误
+	DISPATCH_DEVICE_STATUS_DISCONNECT,					//调度设备模块,状态断连
+	DISPATCH_DEVICE_TASK_TYPE_ERROR,					//调度设备模块,任务类型错误
+	DISPATCH_DEVICE_TASK_OVER_TIME,						//调度设备模块,任务超时
+	DISPATCH_DEVICE_TASK_REPEAT,						//调度设备模块,任务重复, 任务已经存在
+	DISPATCH_DEVICE_IS_NOT_READY,						//调度设备模块,不在准备状态
+	DISPATCH_DEVICE_RESPONS_ERROR,						//调度设备模块,指令的执行失败
+	DISPATCH_DEVICE_TASK_NOTHINGNESS,					//调度设备模块,任务不存在
+	DISPATCH_DEVICE_TASK_LEVEL_ERROR,					//调度设备模块,任务等级错误
+
+
+	CARRIER_ERROR_BASE								= 0x13040000,
+	CARRIER_READ_PROTOBUF_ERROR,				//搬运器模块,读取参数错误
+	CARRIER_STATUS_BUSY,						//搬运器模块,状态正忙
+	CARRIER_STATUS_ERROR,						//搬运器模块,状态错误
+	CARRIER_STATUS_DISCONNECT,					//搬运器模块,状态断连
+	CARRIER_TASK_TYPE_ERROR,					//搬运器模块,任务类型错误
+	CARRIER_TASK_OVER_TIME,						//搬运器模块,任务超时
+	CARRIER_IS_NOT_READY,						//搬运器模块,不在准备状态
+	CARRIER_RESPONS_ERROR,						//搬运器模块,指令的执行失败
+	CARRIER_TASK_NOTHINGNESS,					//搬运器模块,任务不存在
+	CARRIER_POSE_ERROR,							//搬运器模块,姿态错误
+	CARRIER_CONRTOL_PARAMETER_ERROR,			//搬运器模块,控制参数错误
+
+	CATCHER_ERROR_BASE								= 0x13050000,
+	CATCHER_READ_PROTOBUF_ERROR,				//抓取器模块,读取参数错误
+	CATCHER_STATUS_BUSY,						//抓取器模块,状态正忙
+	CATCHER_STATUS_ERROR,						//抓取器模块,状态错误
+	CATCHER_STATUS_DISCONNECT,					//抓取器模块,状态断连
+	CATCHER_TASK_TYPE_ERROR,					//抓取器模块,任务类型错误
+	CATCHER_TASK_OVER_TIME,						//抓取器模块,任务超时
+	CATCHER_IS_NOT_READY,						//抓取器模块,不在准备状态
+	CATCHER_RESPONS_ERROR,						//抓取器模块,指令的执行失败
+	CATCHER_TASK_NOTHINGNESS,					//抓取器模块,任务不存在
+	CATCHER_POSE_ERROR,							//抓取器模块,姿态错误
+	CATCHER_CONRTOL_PARAMETER_ERROR,			//抓取器模块,控制参数错误
+
+	PASSAGEWAY_ERROR_BASE								= 0x13060000,
+	PASSAGEWAY_READ_PROTOBUF_ERROR,				//通道口模块,读取参数错误
+	PASSAGEWAY_STATUS_BUSY,						//通道口模块,状态正忙
+	PASSAGEWAY_STATUS_ERROR,						//通道口模块,状态错误
+	PASSAGEWAY_STATUS_DISCONNECT,					//通道口模块,状态断连
+	PASSAGEWAY_TASK_TYPE_ERROR,					//通道口模块,任务类型错误
+	PASSAGEWAY_TASK_OVER_TIME,						//通道口模块,任务超时
+	PASSAGEWAY_IS_NOT_READY,						//通道口模块,不在准备状态
+	PASSAGEWAY_RESPONS_ERROR,						//通道口模块,指令的执行失败
+	PASSAGEWAY_TASK_NOTHINGNESS,					//通道口模块,任务不存在
+
+
+	//DISPATCH_COORDINATES module, 通信模块
+	DISPATCH_COORDINATES_ERROR_BASE					= 0x13060000,
+	DISPATCH_COORDINATES_READ_PROTOBUF_ERROR,				//调度坐标模块,读取参数错误
+	DISPATCH_COORDINATES_ID_ERROR,							//调度坐标模块,坐标id错误
+	DISPATCH_COORDINATES_PATH_ERROR,						//调度坐标模块,路径方向错误
+	DISPATCH_COORDINATES_CAN_NOT_LOCK,						//调度坐标模块,不能加锁
+
+	//Dispatch_plc 调度plc模块
+	DISPATCH_PLC_ERROR_BASE							= 0x13070000,
+	DISPATCH_PLC_REQUEST_ERROR,								//调度plc模块,请求错误
+	DISPATCH_PLC_RESPONS_ERROR,								//调度plc模块,指令的执行失败
+	DISPATCH_PLC_STATUS_ERROR,								//调度plc模块,状态错误
+	DISPATCH_PLC_TIME_OUT,									//调度plc模块,超时
+
+
+	//snap7 通信模块 错误码
+	SNAP7_ERROR_BASE								= 0x1401000,
+	SNAP7_READ_PROTOBUF_ERROR,							//snap7通信模块,读取参数错误
+	SNAP7_CONNECT_ERROR,								//snap7通信模块,连接错误
+	SNAP7_DISCONNECT_ERROR,								//snap7通信模块,断连错误
+	SNAP7_READ_ERROR,									//snap7通信模块,读取错误
+	SNAP7_WRITE_ERROR,									//snap7通信模块,写入错误
+	SNAP7_ANALYSIS_TIME_OUT,									//解析超时,
+	SNAP7_EXCUTER_IS_BUSY,										//处理器正忙, 请稍等
+	
+	
+	
+	
+    
+    //parkspace allocator,车位分配模块
+    PARKSPACE_ALLOCATOR_ERROR_BASE                  = 0x20010000,     
+    PARKSPACE_ALLOCATOR_MSG_REQUEST_TYPE_ERROR,    //反馈车位消息类型错误 
+    PARKSPACE_ALLOCATOR_MSG_RESPONSE_TYPE_ERROR,    //反馈车位消息类型错误
+    PARKSPACE_ALLOCATOR_MSG_PARSE_ERROR,            //请求消息解析错误
+    PARKSPACE_ALLOCATOR_SPACE_EMPTY,                //空车位异常,车库无车位。或许由模块初始化异常产生
+    PARKSPACE_ALLOCATOR_ALLOCATE_FAILED,            //无合适车位,分配失败
+    PARKSPACE_ALLOCATOR_SEARCH_FAILED,              //未找到车辆对应车位
+    PARKSPACE_ALLOCATOR_RELEASE_FAILED,             //未找到匹配的车位,车位未释放
+    PARKSPACE_ALLOCATOR_FORCE_UPDATE_FAILED,        //手动更新失败,未找到匹配车位
+    PARKSPACE_ALLOCATOR_PARAM_ERROR,                //传入参数错误
+    PARKSPACE_ALLOCATOR_CONFIRM_ALLOC_ERROR,        //确认分配车位错误
+    PARKSPACE_ALLOCATOR_CAR_ALREADY_EXIST,          //车辆已存在
+
+    // 数据库操作
+    DB_ERROR_BASE                                   = 0x20020000,
+    DB_INIT_FAILED,									//数据库初始化失败
+    DB_CONNECT_FAILED,                              //数据库连接失败
+    DB_STATUS_ERROR,								//数据库状态错误
+	DB_MANAGER_STATUS_ERROR,						//数据库管理状态错误
+    DB_INSERT_FAILED,                               //数据库插入失败
+    DB_DELETE_FAILED,                               //数据库删除失败
+    DB_UPDATE_FAILED,                               //数据库更新失败
+    DB_QUERY_FAILED,                                //数据库查询失败
+    DB_UNINITIALIZED,                               //数据库外层未初始化
+    DB_DISCONNECTED,                                //数据库外层连接失去
+    DB_RESULT_SET_EMPTY,                            //数据库外层查询返回结果空指针
+    DB_RESULT_SET_PARSE_ERROR,                      //数据库外层查询结果解析失败
+    DB_CONNECT_CHANNEL_NOT_FOUND,					//数据库连接通道未找到
+    DB_CONNECT_CHANNEL_NUMBER_ERROR,				//数据库连接通道数量错误
+    DB_QUERY_DATA_REPEAT,							//数据库查询数据重复
+    DB_QUERY_NOT_DATA,								//数据库未查询到数据
+	DB_QUERY_DATA_FAILED,							//数据库查询数据错误
+	DB_NOT_QUERY_EMPTY_PARKSPACE,					//数据库未查询到空车位
+	DB_PROTOBUF_ERROR								//数据库配置参数读取错误
 
 
 };
@@ -336,7 +616,7 @@ public://外部接口函数
     Error_manager(const Error_manager & error_manager);
     //赋值构造
     Error_manager(Error_code error_code, Error_level error_level = NORMAL,
-                  const char* p_error_description = NULL, int description_length = 0);
+                  const char* p_error_description = NULL);
     //赋值构造
     Error_manager(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //析构函数
@@ -346,12 +626,12 @@ public://外部接口函数
     void error_manager_init();
     //初始化
     void error_manager_init(Error_code error_code, Error_level error_level = NORMAL,
-                            const char* p_error_description = NULL, int description_length = 0);
+                            const char* p_error_description = NULL);
     //初始化
     void error_manager_init(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //重置
     void error_manager_reset(Error_code error_code, Error_level error_level = NORMAL,
-                             const char* p_error_description = NULL, int description_length = 0);
+                             const char* p_error_description = NULL);
     //重置
     void error_manager_reset(Error_code error_code, Error_level error_level , std::string & error_aggregate_string);
     //重置
@@ -380,12 +660,12 @@ public://外部接口函数
     //获取错误等级
     Error_level get_error_level();
     //获取错误描述的指针,(浅拷贝)
-    char* get_error_description();
+    std::string get_error_description();
 
     //复制错误描述,(深拷贝)
     //output:p_error_description     错误描述的字符串指针,不可以为NULL,必须要有实际的内存
     //output:description_length      错误描述的字符串长度,不可以为0,长度最好足够大,一般256即可。
-    void copy_error_description(const char* p_error_description, int description_length);
+    void copy_error_description(const char* p_error_description);
     //复制错误描述,(深拷贝)
     //output:error_description_string     错误描述的string
     void copy_error_description(std::string & error_description_string);
@@ -399,12 +679,12 @@ public://外部接口函数
     //错误等级,设定到固定值
     void set_error_level_location(Error_level error_level);
     //设置错误描述
-    void set_error_description(const char* p_error_description, int description_length = 0);
+    void set_error_description(const char* p_error_description);
     //设置错误描述
     void set_error_description(std::string & error_description_string);
 
     //尾部追加错误描述
-    void add_error_description(const char* p_error_description, int description_length = 0);
+    void add_error_description(const char* p_error_description);
     //尾部追加错误描述
     void add_error_description(std::string & error_description_string);
 
@@ -418,10 +698,6 @@ public://外部接口函数
 	//如果错误相同,则保留this的,将输入参数转入描述。
 	void compare_and_cover_error( Error_manager * p_error_manager);
 
-	//将所有的错误信息,格式化为字符串,用作日志打印。
-    //output:p_error_description     错误汇总的字符串指针,不可以为NULL,必须要有实际的内存
-    //output:description_length      错误汇总的字符串长度,不可以为0,长度最好足够大,一般256即可。
-    void translate_error_to_string(char* p_error_aggregate, int aggregate_length);
     //output:error_description_string     错误汇总的string
     void translate_error_to_string(std::string & error_aggregate_string);
     //错误码转字符串的简易版,可支持cout<<
@@ -433,8 +709,7 @@ public://外部接口函数
 protected:
     Error_code              m_error_code;               //错误码
     Error_level             m_error_level;              //错误等级
-    char*                   pm_error_description;       //错误描述
-    int                     m_description_length;       //错误描述的字符长度
+    std::string             m_error_description;		// 错误描述
 
 protected://内部功能函数
 public:
@@ -456,3 +731,4 @@ public:
 
 #endif //TEST_ERROR_ERROR_CODE_H
 
+

+ 1 - 0
message/dispatch_message.proto

@@ -313,3 +313,4 @@ message Dispatch_manager_data_msg
 
 
 
+

+ 126 - 6
message/measure_message.proto

@@ -32,18 +32,61 @@ enum Locate_manager_status
 	LOCATE_MANAGER_FAULT					= 5;	//故障
 }
 	
-	
+
+//雷达管理的状态
+enum Wanji_manager_status
+{
+	WANJI_MANAGER_UNKNOWN              	= 0;    //未知
+	WANJI_MANAGER_READY               	= 1;    //准备,待机
+	WANJI_MANAGER_BUSY					= 2; 	//工作正忙
+
+	WANJI_MANAGER_ISSUED_SCAN			= 3; 	//下发任务; 获取点云
+	WANJI_MANAGER_WAIT_SCAN				= 4;	//等待任务; 扫描点云
+
+	WANJI_MANAGER_ISSUED_DETECT			= 5; 	//下发任务; 算法预测
+	WANJI_MANAGER_WAIT_DETECT			= 6; 	//等待任务; 算法预测
+
+	WANJI_MANAGER_FAULT					= 10;	//故障
+}
+
+//万集设备身状态
+enum Wanji_lidar_device_status
+{
+	WANJI_LIDAR_DEVICE_UNKNOWN              	= 0;    //未知
+	WANJI_LIDAR_DEVICE_READY	             	= 1;    //正常待机
+	WANJI_LIDAR_DEVICE_DISCONNECT			= 2;	//断连
+
+	WANJI_LIDAR_DEVICE_BUSY					= 3; 	//工作正忙
+
+	WANJI_LIDAR_DEVICE_FAULT					=10;	//故障
+}
+
+//万集区域功能的状态
+enum Region_worker_status
+{
+	REGION_WORKER_UNKNOWN              	= 0;    //未知
+	REGION_WORKER_READY               	= 1;    //准备,待机
+	REGION_WORKER_BUSY					= 2; 	//工作正忙
+
+	REGION_WORKER_FAULT					= 10;	//故障
+}
+
 //定位模块状态
 message Measure_status_msg
 {
     required Base_info                  base_info=1;                 //消息类型
     required int32                      terminal_id=2;
-    required Laser_manager_status       laser_manager_status = 3;
-    repeated Laser_statu                laser_statu_vector = 4;
-    required Locate_manager_status      locate_manager_status = 5;
 
-    optional Locate_information         locate_information_realtime=6;  //地面雷达的 实时定位信息
-    required Error_manager              error_manager = 7;
+    required Laser_manager_status       laser_manager_status = 3;       //大疆管理状态
+    repeated Laser_statu                laser_statu_vector = 4;         //大疆雷达设备状态
+    required Locate_manager_status      locate_manager_status = 5;      //大疆定位算法状态
+
+    required Wanji_manager_status       wanji_manager_status = 6;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 7;  //万集设备身状态
+    repeated Region_worker_status       region_worker_status = 8;       //万集区域功能的状态
+    repeated Locate_information         locate_information_realtime = 9;//地面雷达的 实时定位信息
+
+    required Error_manager              error_manager = 10;
 }
 
 
@@ -66,4 +109,81 @@ message Measure_response_msg
     required Error_manager              error_manager = 5;
 }
 
+//地面测量请求消息
+message Ground_detect_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+}
 
+//地面测量反馈消息
+message Ground_detect_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required int32                      terminal_id=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+// 电子围栏状态
+enum Ground_statu
+{
+    Nothing=0;
+    Noise=1;
+    Car_correct=2;
+    Car_left_out=3;
+    Car_right_out=4;
+    Car_top_out=5;
+    Car_bottom_out=6;
+}
+
+message Ground_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;
+
+    required Wanji_manager_status       wanji_manager_status = 3;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 4;  //万集设备身状态
+    required Region_worker_status       region_worker_status = 5;       //万集区域功能的状态
+    required Locate_information         locate_information_realtime = 6;//地面雷达的 实时定位信息
+    required Ground_statu               ground_status=7; // 电子围栏状态
+
+    required Error_manager              error_manager = 8;
+}
+
+//点云坐标
+message Cloud_coordinate
+{
+    required float                      x=1;
+    required float                      y=2;
+    required float                      z=3;
+}
+//点云类型
+message Cloud_type
+{
+    required int32                      type=1;
+}
+
+//筛选点云; 请求消息
+message Locate_sift_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_coordinate           cloud_coordinates=5;     //点云坐标
+}
+
+//筛选点云; 答复消息
+message Locate_sift_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required int32                      terminal_id=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_type                 cloud_type=5;            //点云类型
+    required Error_manager              error_manager = 6;      //错误码
+}

+ 29 - 16
message/message_base.proto

@@ -31,7 +31,7 @@ enum Message_type
     eParkspace_confirm_alloc_request_msg = 0x3A;//确认分配车位请求消息
     eParkspace_confirm_alloc_response_msg = 0x3B;//确认分配车位反馈消息
     eParkspace_allocation_data_msg = 0x3C;     //车位分配模块车位数据消息
-
+    eParkspace_allocation_data_response_msg =0x3D;//车位数据反馈消息
 
     eStore_command_request_msg=0x41;        //终端停车请求消息
     eStore_command_response_msg=0x42;       //停车请求反馈消息
@@ -57,6 +57,11 @@ enum Message_type
     eDispatch_manager_status_msg        = 0xea;     //调度管理的设备状态消息(调度底下所有硬件设备状态的汇总)
     eDispatch_manager_data_msg          = 0xeb;     //调度管理的设备详细的数据信息
 
+
+    eGround_detect_request_msg=0xf0;        //地面雷达测量请求消息
+    eGround_detect_response_msg=0xf1;       //地面雷达测量反馈消息
+    eGround_status_msg=0xf2;                //地面雷达状态消息
+
 }
 
 //通讯单元
@@ -79,6 +84,8 @@ enum Communicator
     //...
 
 
+    //地面测量单元
+	eGround_measurer=0x0f00;
 }
 ////base message 用于解析未知类型的消息
 message Base_info
@@ -162,11 +169,12 @@ enum Parkspace_status
     eParkspace_error            = 5;         //车位机械结构或硬件故障
 }
 
+//车位朝向, 小号朝前朝南, 大号朝后朝北
 enum Direction
 {
     eDirection_unknow = 0;
-    eForward = 1;
-    eBackward = 2;
+    eForward = 1;                   //小号朝前朝南
+    eBackward = 2;                  //大号朝后朝北
 }
 
 //车位分配路线(根据中跑车的路线来定)
@@ -203,21 +211,24 @@ message Parkspace_info
     optional int32              parkingspace_index_id = 1;            //车位ID
     optional Parkspace_type     parkingspace_type = 2;                //车位类型
     optional int32              parkingspace_unit_id = 3;            //车位单元号
-    optional int32              parkingspace_room_id = 4;             //同层编号
-    optional Direction          parkingspace_direction = 5;           //前后
-    optional int32              parkingspace_floor_id = 6;            //楼层
-    optional float              parkingspace_width = 7;               //车位宽
-    optional float              parkingspace_height = 8;              //车位高
-    optional Parkspace_status   parkingspace_status = 9;              //车位当前状态
-    optional Car_info           car_info = 10;                        //当前车位存入车辆的凭证号
-    optional string             entry_time = 11;                      //入场时间
-    optional string             leave_time = 12;                      //离场时间
+    optional int32              parkingspace_label_id = 4;            //车位单元内部ID
+    optional int32              parkingspace_room_id = 5;             //同层编号
+    optional Direction          parkingspace_direction = 6;           //前后
+    optional int32              parkingspace_floor_id = 7;            //楼层
+    optional float              parkingspace_width = 8;               //车位宽
+    optional float              parkingspace_height = 9;              //车位高
+    optional Parkspace_status   parkingspace_status = 10;              //车位当前状态
+    optional Car_info           car_info = 11;                        //车辆信息
+    optional string             entry_time = 12;                      //入场时间
+    optional string             leave_time = 13;                      //离场时间
 
 
+    optional Parkspace_path     parkspace_path = 14;            // 车位分配路线
+    optional float              path_estimate_time = 15;        //车位分配路线 time(s)
+    optional Parkspace_status   parkspace_status_target = 16;     //车位目标状态
+
+    optional Car_type           car_type = 17;                        //车辆类型
 
-    optional Parkspace_path     parkspace_path = 13;            // 车位分配路线
-    optional float              path_estimate_time = 14;        //车位分配路线 time(s)
-    optional Parkspace_status   parkspace_status_target=15;     //车位目标状态
 
 }
 
@@ -227,6 +238,7 @@ message Parkspace_info
 enum Step_type
 {
     eAlloc_step=0;
+    eMeasure_step=1;
     eCompare_step=2;
     eDispatch_step=3;
     eConfirm_step=4;
@@ -239,6 +251,7 @@ enum Step_type
 
     eBackConfirm_step=9;
     eBack_compare_step=10;
+    eBackMeasure_step=11;
     eBackAlloc_step=12;
 
     eBackWait_step=13;
@@ -274,4 +287,4 @@ enum Dispatch_device_type
     PASSAGEWAY_5                            = 305;      //5号出入口
     PASSAGEWAY_6                            = 306;      //6号出入口
     PASSAGEWAY_7                            = 307;      //7号出口(在右侧电梯井, 只能取车)
-}
+}

+ 2 - 2
message/parkspace_allocation_message.proto

@@ -106,7 +106,7 @@ message Parkspace_force_update_response_msg
     repeated Parkspace_info             manual_parkspace_info_ex=4;    //已修改后的车位信息
 }
 
-// 4.确认分配车位
+// 5.确认分配车位
 message Parkspace_confirm_alloc_request_msg
 {
     required Base_info                  base_info=1;            //消息类型
@@ -150,4 +150,4 @@ message Parkspace_allocation_data_msg
     required Base_info                  base_info=1;            //消息类型
     required Error_manager              error_manager=2;
     repeated Parkspace_info             parkspace_info_ex=3;
-}
+}

+ 1 - 1
setting/communication.prototxt

@@ -8,7 +8,7 @@ communication_parameters
  # connect_string_vector:"tcp://192.168.2.166:9002"
 
   # connect_string_vector:"tcp://192.168.2.125:9876"
-   connect_string_vector:"tcp://192.168.2.166:1234"
+  # connect_string_vector:"tcp://192.168.2.166:1234"
 
 }
 

+ 7 - 3
system/PickupProcessTask.cpp

@@ -88,8 +88,11 @@ Error_manager PickupProcessTask::search_space_step()
     /*
      * 检验汽车信息是否正常
      */
-    if(m_car_info.has_car_width()==false||m_car_info.has_car_height()== false
-        ||m_car_info.has_license()==false)
+    if(
+            // 20210812 changed by yct, only check license, terminal cannot find width height at this stage
+//            m_car_info.has_car_width()==false||m_car_info.has_car_height()== false
+//        ||
+        m_car_info.has_license()==false)
     {
         return Error_manager(INVALID_MESSAGE,CRITICAL_ERROR,"查询车位请求信息错误");
     }
@@ -242,7 +245,8 @@ void PickupProcessTask::Main()
                 //提升错误等级为三级
                 LOG(ERROR)<<"-------  取  -------  释放车位失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
                 ALOG(ERROR)<<"-------  取  -------  释放车位失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
-                Exception_solver::get_instance_pointer()->solve_exception(Error_manager(code.get_error_code(),MAJOR_ERROR,code.get_error_description()),this);
+                code.set_error_level_location(MAJOR_ERROR);
+                Exception_solver::get_instance_pointer()->solve_exception(code, this);
                 continue;
             }
         }

+ 16 - 10
system/StoreProcessTask.cpp

@@ -81,9 +81,11 @@ Error_manager StoreProcessTask::dispatch_step()
      * 判断调度所需的数据是否都正常
      */
     //1,测量信息是否存在
-    if(m_measure_response_msg.has_base_info()== false
-        ||m_measure_response_msg.has_locate_information()==false
-        ||m_parcspace_alloc_response_msg.has_base_info()== false
+    if(
+//            m_measure_response_msg.has_base_info()== false
+//        ||m_measure_response_msg.has_locate_information()==false
+//        ||
+        m_parcspace_alloc_response_msg.has_base_info()== false
         ||m_parcspace_alloc_response_msg.allocated_parkspace_info_ex_size()==0)
     {
         return Error_manager(ERROR,MAJOR_ERROR,"调度所需的前置数据(测量,车位)不存在");
@@ -98,12 +100,13 @@ Error_manager StoreProcessTask::dispatch_step()
     base_info.set_msg_type(message::eDispatch_request_msg);
     base_info.set_sender(message::eMain);
     base_info.set_receiver(message::eDispatch_manager);
-    base_info.set_timeout_ms(1000*15); //超时15s
+    base_info.set_timeout_ms(1000*60*20); //超时20min
     m_dispatch_request_msg.mutable_base_info()->CopyFrom(base_info);
 
     m_dispatch_request_msg.set_terminal_id(m_terminor_id);
     m_dispatch_request_msg.set_dispatch_motion_direction(message::E_STORE_CAR);
-    m_dispatch_response_msg.mutable_parkspace_info_ex()->CopyFrom(m_parcspace_alloc_response_msg.allocated_parkspace_info_ex());
+    // 20210812 changed by yct.
+    m_dispatch_request_msg.mutable_parkspace_info_ex()->CopyFrom(m_parcspace_alloc_response_msg.allocated_parkspace_info_ex());
 
     code=Dispatch_excutor::get_instance_pointer()->dispatch_request(m_dispatch_request_msg,
             m_dispatch_response_msg,m_cancel_condition);
@@ -224,7 +227,6 @@ Error_manager StoreProcessTask::alloc_space_step()
                 return Error_manager(ERROR,MINOR_ERROR,"分配车位反馈的车辆信息不匹配");
             }
         }
-
         return SUCCESS;
     }
     else
@@ -311,8 +313,10 @@ Error_manager StoreProcessTask::back_alloc_space_step()
      * 检查车位管理模块是否正常
      */
     Error_manager code=Parkspace_excutor::get_instance_pointer()->check_statu();
-    if(code!=SUCCESS)
-        return Error_manager(code.get_error_code(),MAJOR_ERROR,code.get_error_description());
+    if(code!=SUCCESS) {
+        code.set_error_level_location(MAJOR_ERROR);
+        return code;
+    }
 
     message::Parkspace_release_request_msg request;
     message::Base_info base_info;
@@ -334,8 +338,10 @@ Error_manager StoreProcessTask::back_alloc_space_step()
     node_log.set_description("回退分配步骤,释放车位");
     ALOG(INFO)<<node_log;
 
-    if(code!=SUCCESS)
-        return Error_manager(code.get_error_code(),MAJOR_ERROR,code.get_error_description());
+    if(code!=SUCCESS) {
+        code.set_error_level_location(MAJOR_ERROR);
+        return code;
+    }
 
     if(release_response.error_manager().error_code()==0) {
         /*LOG(WARNING)<<"停车流程异常,释放车位成功,停车终端:"<<m_terminor_id

+ 1 - 0
system/command_manager.cpp

@@ -210,6 +210,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
     if (request.base_info().msg_type() == message::eStore_command_request_msg
         && request.base_info().receiver() == message::eMain
         && request.base_info().sender() == message::eTerminor) {
+//        LOG(WARNING) << request.DebugString();
         if (request.has_locate_information() && request.has_base_info())
         {
             message::Locate_information locate_info = request.locate_information();

+ 6 - 10
tool/thread_safe_list.h

@@ -156,9 +156,8 @@ bool Thread_safe_list<T>::wait_and_pop(T& value)
 		}
 		else
 		{
-//			value = move(*m_data_list.front());
-			value = (*m_data_list.front());
-
+			value = std::move(*m_data_list.front());
+		
 			m_data_list.pop_front();
 			return true;
 		}
@@ -182,9 +181,8 @@ bool Thread_safe_list<T>::try_pop(T& value)
 		}
 		else
 		{
-//			value = move(*m_data_list.front());
-			value = (*m_data_list.front());
-
+			value = std::move(*m_data_list.front());
+	
 			m_data_list.pop();
 			return true;
 		}
@@ -256,8 +254,7 @@ bool Thread_safe_list<T>::push(T new_value)
 	}
 	else
 	{
-//		std::shared_ptr<T> data(std::make_shared<T>(move(new_value)));
-		std::shared_ptr<T> data(std::make_shared<T>((new_value)));
+		std::shared_ptr<T> data(std::make_shared<T>(std::move(new_value)));
 		std::unique_lock<std::mutex> lk(m_mutex);
 		m_data_list.push_back(data);
 		m_data_cond.notify_one();
@@ -286,8 +283,7 @@ bool Thread_safe_list<T>::clear_and_delete()
 	while (!m_data_list.empty())
 	{
 		T res = NULL;
-//		res = move(*m_data_list.front());
-		res = (*m_data_list.front());
+		res = std::move(*m_data_list.front());
 
 		m_data_list.pop_front();
 		if(res != NULL)

+ 9 - 5
tool/thread_safe_queue.h

@@ -41,7 +41,6 @@
 #include <mutex>
 #include <condition_variable>
 
-
 template<class T>
 class Thread_safe_queue
 {
@@ -104,6 +103,11 @@ private:
 
 
 
+
+
+
+
+
 template<class T>
 Thread_safe_queue<T>::Thread_safe_queue()
 {
@@ -149,7 +153,7 @@ bool Thread_safe_queue<T>::wait_and_pop(T& value)
 		}
 		else
 		{
-			value = move(*m_data_queue.front());
+			value = std::move(*m_data_queue.front());
 			m_data_queue.pop();
 			return true;
 		}
@@ -173,7 +177,7 @@ bool Thread_safe_queue<T>::try_pop(T& value)
 		}
 		else
 		{
-			value = move(*m_data_queue.front());
+			value = std::move(*m_data_queue.front());
 			m_data_queue.pop();
 			return true;
 		}
@@ -242,7 +246,7 @@ bool Thread_safe_queue<T>::push(T new_value)
 	}
 	else
 	{
-		std::shared_ptr<T> data(std::make_shared<T>(move(new_value)));
+		std::shared_ptr<T> data(std::make_shared<T>(std::move(new_value)));
 		std::unique_lock<std::mutex> lk(m_mutex);
 		m_data_queue.push(data);
 		m_data_cond.notify_one();
@@ -269,7 +273,7 @@ bool Thread_safe_queue<T>::clear_and_delete()
 	while (!m_data_queue.empty())
 	{
 		T res = NULL;
-		res = move(*m_data_queue.front());
+		res = std::move(*m_data_queue.front());
 		m_data_queue.pop();
 		if(res != NULL)
 		{