Browse Source

20210913,修改snape7的DB块

huli 3 years ago
parent
commit
8fb70fbe39
2 changed files with 30 additions and 8 deletions
  1. 18 4
      dispatch/dispatch_communication.cpp
  2. 12 4
      dispatch/dispatch_communication.h

+ 18 - 4
dispatch/dispatch_communication.cpp

@@ -226,9 +226,9 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_locate_correct", 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);
+	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, 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;
-	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 0, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_1 +m_plc_id*100, 4, sizeof(Ground_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[4] = t_snap7_buf;
 
 	t_index = 0;
@@ -239,6 +239,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_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	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_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[5] = t_snap7_buf;
@@ -253,6 +255,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_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	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_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Ground_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
 	m_receive_buf_map[2] = t_snap7_buf;
@@ -264,10 +268,16 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
 //防撞雷达
 	t_index = 0;
 	t_variable_information_vector.clear();
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"Anticollision_lidar_response_from_manager_to_plc_for_data", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_anticollision_lidar_flag", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	t_index += sizeof(unsigned char)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved5_7", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 3 });
+	t_index += sizeof(unsigned char)*3;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_x", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_response_offset_angle", typeid(float).name(), t_index,sizeof(float), 1 });
+	t_index += sizeof(float)*1;
 
-	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	t_snap7_buf.init(GROUND_LIDAR_RESPONSE_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 4, sizeof(Anticollision_lidar_response_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[7] = t_snap7_buf;
 
 	t_index = 0;
@@ -278,6 +288,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_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	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(Anticollision_lidar_response_from_manager_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[8] = t_snap7_buf;
@@ -291,6 +303,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_refresh_command", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
 	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_REQUEST_FROM_PLC_TO_MANAGER_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Anticollision_lidar_request_from_plc_to_manager), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
 	m_receive_buf_map[4] = t_snap7_buf;

+ 12 - 4
dispatch/dispatch_communication.h

@@ -414,8 +414,10 @@ public:
 	struct Ground_lidar_response_from_manager_to_plc_for_key
 	{
 		unsigned char			m_heartbeat = 0;							//心跳位, 0-255循环
-		unsigned char			m_communication_mode = 0;					//通信模式	0=自动循环模式,1=手动刷新模式
+		unsigned char			m_communication_mode = 0;					//通信模式	0 = 未知, 1=自动循环模式,2=手动刷新模式
 		unsigned char			m_refresh_command = 0;						//刷新指令 0-255任意数字,与上一次不同即可
+		unsigned char			m_data_validity = 0;						//数据有效性, 0 = 未知, 1 = 有效, 2 = 无效
+
 	};
 
 	struct Ground_lidar_response_from_manager_to_plc_for_data
@@ -439,8 +441,9 @@ public:
 	struct Ground_lidar_request_from_plc_to_manager
 	{
 		unsigned char			m_heartbeat = 0;							//心跳位, 0-255循环
-		unsigned char			m_communication_mode = 0;					//通信模式	0=自动循环模式,1=手动刷新模式
+		unsigned char			m_communication_mode = 0;					//通信模式	0 = 未知, 1=自动循环模式,2=手动刷新模式
 		unsigned char			m_refresh_command = 0;						//刷新指令 0-255任意数字,与上一次不同即可
+		unsigned char			m_data_validity = 0;						//数据有效性, 0 = 未知, 1 = 有效, 2 = 无效
 	};
 
 
@@ -449,14 +452,18 @@ public:
 	struct Anticollision_lidar_response_from_manager_to_plc_for_key
 	{
 		unsigned char			m_heartbeat = 0;							//心跳位, 0-255循环
-		unsigned char			m_communication_mode = 0;					//通信模式	0=自动循环模式,1=手动刷新模式
+		unsigned char			m_communication_mode = 0;					//通信模式	0 = 未知, 1=自动循环模式,2=手动刷新模式
 		unsigned char			m_refresh_command = 0;						//刷新指令 0-255任意数字,与上一次不同即可
+		unsigned char			m_data_validity = 0;						//数据有效性, 0 = 未知, 1 = 有效, 2 = 无效
 
 	};
 
 	struct Anticollision_lidar_response_from_manager_to_plc_for_data
 	{
 		unsigned char			m_response_anticollision_lidar_flag = 0;		//汽车是否停到正确的位置, 防撞雷达	预留, 楚天暂时不用,0=未知,1=位置正常,2=位置异常
+		unsigned char			m_reserved5_7[3] = {0};							//预留
+		float					m_response_offset_x = 0;						//汽车x轴的偏移量, -1.0~+1.0, 单位米
+		float					m_response_offset_angle = 0;					//汽车角度的偏移量, -7~+7, 单位度
 	};
 
 	//plc给防撞雷达
@@ -464,8 +471,9 @@ public:
 	struct Anticollision_lidar_request_from_plc_to_manager
 	{
 		unsigned char			m_heartbeat = 0;							//心跳位, 0-255循环
-		unsigned char			m_communication_mode = 0;					//通信模式	0=自动循环模式,1=手动刷新模式
+		unsigned char			m_communication_mode = 0;					//通信模式	0 = 未知, 1=自动循环模式,2=手动刷新模式
 		unsigned char			m_refresh_command = 0;						//刷新指令 0-255任意数字,与上一次不同即可
+		unsigned char			m_data_validity = 0;						//数据有效性, 0 = 未知, 1 = 有效, 2 = 无效
 	};
 
 #pragma pack(pop)		//取消对齐