Przeglądaj źródła

20211125, outlet singlechip communicaton

huli 3 lat temu
rodzic
commit
33a1d7af16

+ 2 - 2
dispatch/dispatch_communication.cpp

@@ -256,8 +256,8 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
 	t_index += sizeof(unsigned char)*1;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_data_validity", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
-	
-	
+
+
 
 	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[3] = t_snap7_buf;

+ 1 - 1
dispatch/dispatch_communication.h

@@ -453,7 +453,7 @@ public:
 		float					m_response_uniformed_car_x = 0;					//转角复位后,车辆中心点x
 		float					m_response_uniformed_car_y = 0;					//转角复位后,车辆中心点y
 		unsigned char			m_response_locate_correct = 0;				//数据是否有效, 0=无效, 1=有效
-			
+
 		unsigned char			m_reserved45_48[3] = {0};							//预留
 		unsigned char			m_response_heartbeat = 0;							//心跳位, 0-255循环
 		unsigned char			m_response_communication_mode = 0;					//通信模式	0 = 未知, 1=自动循环模式,2=手动刷新模式

+ 4 - 4
dispatch/dispatch_coordinates.cpp

@@ -421,7 +421,7 @@ Error_manager Dispatch_coordinates::carrier_try_space_lock(int row_min, int colu
 			}
 		}
 	}
-	
+
 	if ( try_flag )
 	{
 		for (int i = row_min; i <= row_max; ++i)
@@ -431,12 +431,12 @@ Error_manager Dispatch_coordinates::carrier_try_space_lock(int row_min, int colu
 				mpp_space_lock[i][j].m_carrier_id = carrier_id;
 			}
 		}
-	    return Error_code::SUCCESS;
+		return Error_code::SUCCESS;
 	}
 	else
 	{
-	    return Error_manager(Error_code::DISPATCH_COORDINATES_CAN_NOT_LOCK, Error_level::MINOR_ERROR,
-	    					" Dispatch_coordinates::carrier_try_space_lock error ");
+		return Error_manager(Error_code::DISPATCH_COORDINATES_CAN_NOT_LOCK, Error_level::MINOR_ERROR,
+							 " Dispatch_coordinates::carrier_try_space_lock error ");
 	}
 }
 //抓取器尝试空间加锁

+ 2 - 2
dispatch/dispatch_ground_lidar.cpp

@@ -93,10 +93,10 @@ void Dispatch_ground_lidar::execute_thread_fun()
 
 			std::this_thread::yield();
 
-			
+
 			if (m_ground_status_msg_updata_flag)
 			{
-			
+
 				std::unique_lock<std::mutex> t_lock(Dispatch_communication::get_instance_references().m_data_lock);
 				std::unique_lock<std::mutex> t_lock2(m_lock);
 

+ 3 - 3
dispatch/dispatch_manager.cpp

@@ -341,9 +341,9 @@ Error_manager Dispatch_manager::execute_for_singlechip_data_msg(message::Singlec
 	if ( singlechip_data_msg.has_terminalid() && singlechip_data_msg.has_dispatchdirection() )
 	{
 		if ( singlechip_data_msg.terminalid() >=0 &&
-		singlechip_data_msg.terminalid() <=5 &&
-		singlechip_data_msg.dispatchdirection() >=1 &&
-		singlechip_data_msg.dispatchdirection() <=2 )
+			 singlechip_data_msg.terminalid() <=5 &&
+			 singlechip_data_msg.dispatchdirection() >=1 &&
+			 singlechip_data_msg.dispatchdirection() <=2 )
 		{
 			int t_temp = (singlechip_data_msg.terminalid() %2) + (singlechip_data_msg.dispatchdirection()-1)*2;
 			return	m_dispatch_singlechip[t_temp].execute_for_singlechip_data_msg(singlechip_data_msg, validity);

+ 7 - 7
dispatch/dispatch_manager.h

@@ -54,7 +54,7 @@ typedef struct Locate_information
 class Dispatch_manager:public Singleton<Dispatch_manager>
 {
 // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
-   friend class Singleton<Dispatch_manager>;
+	friend class Singleton<Dispatch_manager>;
 
 public:
 //调度设备参数
@@ -83,13 +83,13 @@ public:
 
 
 private:
- // 父类的构造函数必须保护,子类的构造函数必须私有。
-   Dispatch_manager();
+	// 父类的构造函数必须保护,子类的构造函数必须私有。
+	Dispatch_manager();
 public:
-    //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
-    Dispatch_manager(const Dispatch_manager& other) = delete;
-    Dispatch_manager& operator =(const Dispatch_manager& other) = delete;
-    ~Dispatch_manager();
+	//必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+	Dispatch_manager(const Dispatch_manager& other) = delete;
+	Dispatch_manager& operator =(const Dispatch_manager& other) = delete;
+	~Dispatch_manager();
 public://API functions
 	//调度管理 初始化
 	Error_manager dispatch_manager_init(int dispatch_manager_id);

+ 7 - 7
dispatch/dispatch_plc.cpp

@@ -57,7 +57,7 @@ Error_manager Dispatch_plc::dispatch_plc_uninit()
 //调度plc 执行请求
 Error_manager Dispatch_plc::execute_for_dispatch_request_msg(message::Dispatch_request_msg& dispatch_request_msg)
 {
-	
+
 	if ( m_dispatch_plc_status == Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_READY )
 	{
 		std::unique_lock<std::mutex> t_lock(m_lock);
@@ -87,7 +87,7 @@ Error_manager Dispatch_plc::execute_for_dispatch_request_msg(message::Dispatch_r
 		else
 		{
 			return Error_manager(Error_code::DISPATCH_PLC_REQUEST_ERROR, Error_level::MINOR_ERROR,
-								" dispatch_request_msg.dispatch_motion_direction() PARAMRTER ERROR ");
+								 " dispatch_request_msg.dispatch_motion_direction() PARAMRTER ERROR ");
 		}
 
 		m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_TYPE_UNKNOW;
@@ -95,8 +95,8 @@ Error_manager Dispatch_plc::execute_for_dispatch_request_msg(message::Dispatch_r
 	}
 	else
 	{
-	    return Error_manager(Error_code::DISPATCH_PLC_STATUS_ERROR, Error_level::MINOR_ERROR,
-	    					" m_dispatch_plc_status error ");
+		return Error_manager(Error_code::DISPATCH_PLC_STATUS_ERROR, Error_level::MINOR_ERROR,
+							 " m_dispatch_plc_status error ");
 	}
 
 	return Error_code::SUCCESS;
@@ -130,7 +130,7 @@ void Dispatch_plc::execute_thread_fun()
 
 			std::cout << " huli test :::: " << " m_plc_id = " << m_plc_id << std::endl;
 			std::cout << " huli test :::: " << " m_dispatch_plc_status = " << m_dispatch_plc_status << std::endl;
-			
+
 			switch ((Dispatch_plc_status) m_dispatch_plc_status)
 			{
 				case DISPATCH_PLC_READY:
@@ -400,7 +400,7 @@ Error_manager Dispatch_plc::update_dispatch_plc_communication()
 */
 
 
- 	//请求消息, 调度->plc
+	//请求消息, 调度->plc
 	Dispatch_communication::Dispatch_request_from_manager_to_plc_for_data * tp_dispatch_request_from_manager_to_plc_for_data =
 	& Dispatch_communication::get_instance_references().m_dispatch_request_from_manager_to_plc_for_data;
 	Dispatch_communication::Dispatch_request_from_manager_to_plc_for_key * m_dispatch_request_from_manager_to_plc_for_key =
@@ -429,7 +429,7 @@ Error_manager Dispatch_plc::update_dispatch_plc_communication()
 	memset(tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_license, 0, 20);
 	int t_size2 = m_request_key.size()<=20 ? m_request_key.size() : 20 ;
 	memcpy(tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_license, m_request_car_license.c_str(), t_size2);
- 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_type = m_request_car_type;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_type = m_request_car_type;
 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_uniformed_car_x = m_request_uniformed_car_x;
 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_uniformed_car_y = m_request_uniformed_car_y;
 

+ 5 - 7
dispatch/dispatch_singlechip.cpp

@@ -61,6 +61,7 @@ Error_manager Dispatch_singlechip::dispatch_singlechip_uninit()
 //调度单片机 执行状态消息
 Error_manager Dispatch_singlechip::execute_for_singlechip_data_msg(message::Singlechip_data &singlechip_data_msg, bool validity)
 {
+
 	std::unique_lock<std::mutex> t_lock2(m_lock);
 	m_singlechip_data_msg = singlechip_data_msg;
 	m_validity = validity;
@@ -80,13 +81,13 @@ Dispatch_singlechip::Dispatch_singlechip_status Dispatch_singlechip::get_dispatc
 bool Dispatch_singlechip::is_outlet_ready()
 {
 	if ( m_dispatch_singlechip_status == DISPATCH_SINGLECHIP_READY &&
-	m_singlechip_data_msg.insideexistenceflag() == 1)
+		 m_singlechip_data_msg.insideexistenceflag() == 1)
 	{
-	    return true;
+		return true;
 	}
 	else
 	{
-	    return false;
+		return false;
 	}
 }
 
@@ -107,13 +108,10 @@ void Dispatch_singlechip::execute_thread_fun()
 
 			std::this_thread::yield();
 
-//			std::cout << " huli test :::: " << " m_singlechip_data_msg = " << m_singlechip_data_msg.DebugString() << std::endl;
-
-
 			if (m_singlechip_data_msg_updata_flag)
 			{
 
-				std::cout << " huli test :::: " << " m_singlechip_data_msg = " << m_singlechip_data_msg.DebugString() << std::endl;
+//				std::cout << " huli test :::: " << " m_singlechip_data_msg = " << m_singlechip_data_msg.DebugString() << std::endl;
 
 
 				std::unique_lock<std::mutex> t_lock(Dispatch_communication::get_instance_references().m_data_lock);

+ 1 - 1
dispatch/dispatch_singlechip.h

@@ -26,7 +26,7 @@ public:
 	{
 		DISPATCH_SINGLECHIP_UNKNOW               	= 0,    //未知
 		DISPATCH_SINGLECHIP_READY               	= 1,    //准备,待机
-		
+
 		DISPATCH_SINGLECHIP_FAULT					= 10,	//故障
 		DISPATCH_SINGLECHIP_DISCONNECT			= 11, 	//断连
 

+ 8 - 7
proto.sh

@@ -10,14 +10,15 @@ protoc -I=./message dispatch_message.proto --cpp_out=./message
 protoc -I=./message dispatch_control.proto --cpp_out=./message
 protoc -I=./message parkspace_allocation_message.proto --cpp_out=./message
 
-
-protoc -I=./message central_control_message.proto --cpp_out=./message
-protoc -I=./message log_process.proto --cpp_out=./message
-protoc -I=./message notify_message.proto --cpp_out=./message
-protoc -I=./message process_message.proto --cpp_out=./message
 protoc -I=./message singlechip_msg.proto --cpp_out=./message
-protoc -I=./message terminal_message.proto --cpp_out=./message
-protoc -I=./message UnNormalized_module_message.proto --cpp_out=./message
+protoc -I=./message notify_message.proto --cpp_out=./message
+
+
+#protoc -I=./message central_control_message.proto --cpp_out=./message
+#protoc -I=./message log_process.proto --cpp_out=./message
+#protoc -I=./message process_message.proto --cpp_out=./message
+#protoc -I=./message terminal_message.proto --cpp_out=./message
+#protoc -I=./message UnNormalized_module_message.proto --cpp_out=./message
 
 
 

+ 1 - 0
system/system_executor.cpp

@@ -128,6 +128,7 @@ Error_manager System_executor::check_msg(Communication_message* p_msg)
 			case Communication_message::Message_type::eNotify_status_msg:
 			{
 				message::Notify_status_msg t_notify_status_msg;
+
 				//针对消息类型, 对消息进行二次解析
 				if (t_notify_status_msg.ParseFromString(p_msg->get_message_buf()))
 				{