Procházet zdrojové kódy

20210316, 完成所有调度设备和plc的通信

huli před 4 roky
rodič
revize
7896eef736

+ 24 - 16
dispatch/carrier.cpp

@@ -59,10 +59,10 @@ Carrier::~Carrier()
 Error_manager Carrier::check_task_type(std::shared_ptr<Task_Base> p_task)
 {
 	//检查任务类型,
-	if (p_task->get_task_type() != CATCHER_TASK)
+	if (p_task->get_task_type() != CARRIER_TASK)
 	{
-		return Error_manager(Error_code::CATCHER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
-							 "Carrier::check_task_type  get_task_type() != CATCHER_TASK ");
+		return Error_manager(Error_code::CARRIER_TASK_TYPE_ERROR, Error_level::MINOR_ERROR,
+							 "Carrier::check_task_type  get_task_type() != CARRIER_TASK ");
 	}
 
 	return Error_code::SUCCESS;
@@ -122,12 +122,15 @@ Error_manager Carrier::update_device_communication()
 	memcpy(tp_carrier_request_from_dispatch_to_plc_for_key->m_request_key, m_request_key.c_str(), m_request_key.size());
 	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_x = m_request_x;
 	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y = m_request_y;
-	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_b = m_request_b;
 	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_z = m_request_z;
-	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_clamp_motion = m_request_clamp_motion;
-	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_wheelbase = m_request_wheelbase;
 	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y1 = m_request_y1;
 	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_y2 = m_request_y2;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_clamp_motion = m_request_clamp_motion;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_joint_motion_x = m_request_joint_motion_x;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_joint_motion_y = m_request_joint_motion_y;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_space_id = m_request_space_id;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_floor_id = m_request_floor_id;
+	tp_carrier_request_from_dispatch_to_plc_for_data->m_request_wheelbase = m_request_wheelbase;
 
 
 
@@ -138,12 +141,15 @@ Error_manager Carrier::update_device_communication()
 	m_respons_status = (Dispatch_device_base::Respons_status)tp_carrier_response_from_plc_to_dispatch->m_respons_status;
 	m_respons_x = tp_carrier_response_from_plc_to_dispatch->m_respons_x;
 	m_respons_y = tp_carrier_response_from_plc_to_dispatch->m_respons_y;
-	m_respons_b = tp_carrier_response_from_plc_to_dispatch->m_respons_b;
 	m_respons_z = tp_carrier_response_from_plc_to_dispatch->m_respons_z;
-	m_respons_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_carrier_response_from_plc_to_dispatch->m_respons_clamp_motion;
-	m_respons_wheelbase = tp_carrier_response_from_plc_to_dispatch->m_respons_wheelbase;
 	m_respons_y1 = tp_carrier_response_from_plc_to_dispatch->m_respons_y1;
 	m_respons_y2 = tp_carrier_response_from_plc_to_dispatch->m_respons_y2;
+	m_respons_clamp_motion = (Dispatch_device_base::Clamp_motion)tp_carrier_response_from_plc_to_dispatch->m_respons_clamp_motion;
+	m_respons_joint_motion_x = (Dispatch_device_base::Joint_motion)tp_carrier_response_from_plc_to_dispatch->m_respons_joint_motion_x;
+	m_respons_joint_motion_y = (Dispatch_device_base::Joint_motion)tp_carrier_response_from_plc_to_dispatch->m_respons_joint_motion_y;
+	m_respons_space_id = tp_carrier_response_from_plc_to_dispatch->m_respons_space_id;
+	m_respons_floor_id = tp_carrier_response_from_plc_to_dispatch->m_respons_floor_id;
+	m_respons_wheelbase = tp_carrier_response_from_plc_to_dispatch->m_respons_wheelbase;
 
 
 	//状态消息, plc->调度
@@ -198,14 +204,14 @@ Error_manager Carrier::update_device_communication()
 		m_actual_load_status = (Dispatch_device_base::Load_status)tp_carrier_status_from_plc_to_dispatch->m_actual_load_status;
 		m_actual_x = tp_carrier_status_from_plc_to_dispatch->m_actual_x;
 		m_actual_y = tp_carrier_status_from_plc_to_dispatch->m_actual_y;
-		m_actual_b = tp_carrier_status_from_plc_to_dispatch->m_actual_b;
 		m_actual_z = tp_carrier_status_from_plc_to_dispatch->m_actual_z;
 		m_actual_y1 = tp_carrier_status_from_plc_to_dispatch->m_actual_y1;
 		m_actual_y2 = tp_carrier_status_from_plc_to_dispatch->m_actual_y2;
 		m_actual_clamp_motion1 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion1;
 		m_actual_clamp_motion2 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion2;
-		m_actual_clamp_motion3 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion3;
-		m_actual_clamp_motion4 = (Dispatch_device_base::Clamp_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_clamp_motion4;
+		m_actual_small_sports_car_motion = (Dispatch_device_base::Small_sports_car_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_small_sports_car_motion;
+		m_actual_joint_motion_x1 = (Dispatch_device_base::Joint_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_joint_motion_x1;
+		m_actual_joint_motion_x2 = (Dispatch_device_base::Joint_motion)tp_carrier_status_from_plc_to_dispatch->m_actual_joint_motion_x2;
 		memcpy(m_actual_error_code, tp_carrier_status_from_plc_to_dispatch->m_actual_error_code, 50);
 		memcpy(m_actual_warning_code, tp_carrier_status_from_plc_to_dispatch->m_actual_warning_code, 50);
 		m_actual_error_description = (char*)(tp_carrier_status_from_plc_to_dispatch->m_actual_error_description);
@@ -245,19 +251,21 @@ Error_manager Carrier::check_and_read_memory_to_task(std::shared_ptr<Task_Base>
 			tp_carrier_task->m_respons_status = (Carrier_task::Respons_status)m_respons_status;
 			tp_carrier_task->m_respons_x = m_respons_x;
 			tp_carrier_task->m_respons_y = m_respons_y;
-			tp_carrier_task->m_respons_b = m_respons_b;
 			tp_carrier_task->m_respons_z = m_respons_z;
-			tp_carrier_task->m_respons_space_id = m_respons_space_id;
 			tp_carrier_task->m_respons_y1 = m_respons_y1;
 			tp_carrier_task->m_respons_y2 = m_respons_y2;
-			tp_carrier_task->m_respons_wheelbase = m_respons_wheelbase;
 			tp_carrier_task->m_respons_clamp_motion = (Carrier_task::Clamp_motion)m_respons_clamp_motion;
+			tp_carrier_task->m_respons_joint_motion_x = (Carrier_task::Joint_motion)m_respons_joint_motion_x;
+			tp_carrier_task->m_respons_joint_motion_y = (Carrier_task::Joint_motion)m_respons_joint_motion_y;
+			tp_carrier_task->m_respons_space_id = m_respons_space_id;
+			tp_carrier_task->m_respons_floor_id = m_respons_floor_id;
+			tp_carrier_task->m_respons_wheelbase = m_respons_wheelbase;
 
 			//如果故障,则添加错误码
 			if ( m_respons_status == RESPONS_MINOR_ERROR || m_respons_status == RESPONS_CRITICAL_ERROR )
 			{
 				//添加错误码
-				Error_manager t_error(CATCHER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
+				Error_manager t_error(CARRIER_RESPONS_ERROR, MINOR_ERROR, "m_respons_status is error");
 				tp_carrier_task->set_task_error_manager(t_error);
 			}
 

+ 182 - 8
dispatch/dispatch_communication.cpp

@@ -311,6 +311,146 @@ Error_manager Dispatch_communication::communication_init()
 	m_receive_buf_map[9] = t_snap7_buf;
 
 
+
+
+
+
+
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved50", 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_reserved51_69", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 19 });
+	t_index += sizeof(unsigned char)*19;
+
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_inside_door_motion", 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_request_outside_door_motion", 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_request_turntable_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_0, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[10] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_send_buf_map[11] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[12] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_3, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[13] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_4, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[14] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_5, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[15] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_6, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[16] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_7, 50, sizeof(Passageway_request_from_dispatch_to_plc_for_data), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[17] = t_snap7_buf;
+
+
+
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
+
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_0, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[18] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_send_buf_map[19] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[20] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_3, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[21] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_4, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[22] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_5, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[23] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_6, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[24] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_7, 0, sizeof(Passageway_request_from_dispatch_to_plc_for_key), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_send_buf_map[25] = t_snap7_buf;
+
+
+
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_key", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_status", 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_reserved51_69", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 19 });
+	t_index += sizeof(unsigned char)*19;
+
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_respons_inside_door_motion", 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_respons_outside_door_motion", 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_respons_turntable_direction", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 1 });
+	t_index += sizeof(unsigned char)*1;
+
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_0, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[10] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_1, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_receive_buf_map[11] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[12] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_3, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[13] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_4, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[14] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_5, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[15] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_6, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[16] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_7, 0, sizeof(Passageway_response_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[17] = t_snap7_buf;
+
+
+	t_index = 0;
+	t_variable_information_vector.clear();
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_heartbeat", 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_safe_status", 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_sensor_status1", 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_sensor_status2", 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_reserved4_35", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 32 });
+	t_index += sizeof(unsigned char)*32;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_turntable_direction", 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_reserved37", 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_actual_error_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_warning_code", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 50 });
+	t_index += sizeof(unsigned char)*50;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_actual_error_description", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 256 });
+	t_index += sizeof(unsigned char)*256;
+
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_0, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[18] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_1, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
+	m_receive_buf_map[19] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_2, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[20] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_3, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[21] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_4, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[22] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_5, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[23] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_6, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[24] = t_snap7_buf;
+	t_snap7_buf.init(PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_7, 0, sizeof(Passageway_status_from_plc_to_dispatch), t_variable_information_vector, Snap7_buf::NO_COMMUNICATION);
+	m_receive_buf_map[25] = t_snap7_buf;
+
+
+
+
 	return Snap7_communication_base::communication_init();
 }
 
@@ -340,6 +480,23 @@ Error_manager Dispatch_communication::updata_receive_buf()
 	memcpy(&m_carrier_status_from_plc_to_dispatch[1], m_receive_buf_map[8].mp_buf_obverse, m_receive_buf_map[8].m_size);
 	memcpy(&m_carrier_status_from_plc_to_dispatch[2], m_receive_buf_map[9].mp_buf_obverse, m_receive_buf_map[9].m_size);
 
+	memcpy(&m_passageway_response_from_plc_to_dispatch[0], m_receive_buf_map[10].mp_buf_obverse, m_receive_buf_map[10].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[1], m_receive_buf_map[11].mp_buf_obverse, m_receive_buf_map[11].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[2], m_receive_buf_map[12].mp_buf_obverse, m_receive_buf_map[12].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[3], m_receive_buf_map[13].mp_buf_obverse, m_receive_buf_map[13].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[4], m_receive_buf_map[14].mp_buf_obverse, m_receive_buf_map[14].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[5], m_receive_buf_map[15].mp_buf_obverse, m_receive_buf_map[15].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[6], m_receive_buf_map[16].mp_buf_obverse, m_receive_buf_map[16].m_size);
+	memcpy(&m_passageway_response_from_plc_to_dispatch[7], m_receive_buf_map[17].mp_buf_obverse, m_receive_buf_map[17].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[0], m_receive_buf_map[18].mp_buf_obverse, m_receive_buf_map[18].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[1], m_receive_buf_map[19].mp_buf_obverse, m_receive_buf_map[19].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[2], m_receive_buf_map[20].mp_buf_obverse, m_receive_buf_map[20].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[3], m_receive_buf_map[21].mp_buf_obverse, m_receive_buf_map[21].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[4], m_receive_buf_map[22].mp_buf_obverse, m_receive_buf_map[22].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[5], m_receive_buf_map[23].mp_buf_obverse, m_receive_buf_map[23].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[6], m_receive_buf_map[24].mp_buf_obverse, m_receive_buf_map[24].m_size);
+	memcpy(&m_passageway_status_from_plc_to_dispatch[7], m_receive_buf_map[25].mp_buf_obverse, m_receive_buf_map[25].m_size);
+
 	return Error_code::SUCCESS;
 }
 Error_manager Dispatch_communication::updata_send_buf()
@@ -369,14 +526,31 @@ Error_manager Dispatch_communication::updata_send_buf()
 	memcpy(m_send_buf_map[9].mp_buf_obverse, &m_carrier_request_from_dispatch_to_plc_for_key[2], m_send_buf_map[9].m_size);
 
 
-//	Dispatch_communication::Catcher_request_from_dispatch_to_plc_for_key * tp_catcher_request_from_dispatch_to_plc_for_key =
-//	& Dispatch_communication::get_instance_references().m_catcher_request_from_dispatch_to_plc_for_key[1];
-//	int k1 = tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key[0];
-//	std::cout << " huli test :::: " << " k1 = " << k1 << std::endl;
-//	int k2 = tp_catcher_request_from_dispatch_to_plc_for_key->m_request_key[1];
-//	std::cout << " huli test :::: " << " k2 = " << k2 << std::endl;
-//	std::cout << " huli test :::: " << " ***************************** = " << std::endl;
-
+	m_passageway_request_from_dispatch_to_plc_for_data[0].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[1].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[2].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[3].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[4].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[5].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[6].m_reserved50 = 1;
+	m_passageway_request_from_dispatch_to_plc_for_data[7].m_reserved50 = 1;
+
+	memcpy(m_send_buf_map[10].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[0], m_send_buf_map[10].m_size);
+	memcpy(m_send_buf_map[11].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[1], m_send_buf_map[11].m_size);
+	memcpy(m_send_buf_map[12].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[2], m_send_buf_map[12].m_size);
+	memcpy(m_send_buf_map[13].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[3], m_send_buf_map[13].m_size);
+	memcpy(m_send_buf_map[14].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[4], m_send_buf_map[14].m_size);
+	memcpy(m_send_buf_map[15].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[5], m_send_buf_map[15].m_size);
+	memcpy(m_send_buf_map[16].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[6], m_send_buf_map[16].m_size);
+	memcpy(m_send_buf_map[17].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_data[7], m_send_buf_map[17].m_size);
+	memcpy(m_send_buf_map[18].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[0], m_send_buf_map[18].m_size);
+	memcpy(m_send_buf_map[19].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[1], m_send_buf_map[19].m_size);
+	memcpy(m_send_buf_map[20].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[2], m_send_buf_map[20].m_size);
+	memcpy(m_send_buf_map[21].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[3], m_send_buf_map[21].m_size);
+	memcpy(m_send_buf_map[22].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[4], m_send_buf_map[22].m_size);
+	memcpy(m_send_buf_map[23].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[5], m_send_buf_map[23].m_size);
+	memcpy(m_send_buf_map[24].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[6], m_send_buf_map[24].m_size);
+	memcpy(m_send_buf_map[25].mp_buf_obverse, &m_passageway_request_from_dispatch_to_plc_for_key[7], m_send_buf_map[25].m_size);
 
 
 

+ 92 - 0
dispatch/dispatch_communication.h

@@ -199,6 +199,93 @@ public:
 	};
 
 
+
+
+
+
+
+
+	//通道口给plc发送请求消息的DB编号
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_0		300
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_1		310
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_2		320
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_3		330
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_4		340
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_5		350
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_6		360
+#define PASSAGEWAY_REQUEST_FROM_DISPATCH_TO_PLC_DBNUMBER_7		370
+
+	//通道口给plc发送请求消息的指令结构体
+	struct Passageway_request_from_dispatch_to_plc_for_data
+	{
+		//指令信息
+		unsigned char			m_reserved50 = 0;					//预留
+		unsigned char			m_reserved51_69[19] = {0};	//预留
+		// 请求的目标坐标和动作
+		unsigned char			m_request_inside_door_motion = 0;		//通道口 内门动作
+		unsigned char			m_request_outside_door_motion = 0;		//通道口 外门动作
+		unsigned char			m_request_turntable_direction = 0;		//通道口 转台方向
+	};
+
+	//通道口给plc发送请求消息的指令结构体
+	struct Passageway_request_from_dispatch_to_plc_for_key
+	{
+		//指令信息
+		unsigned char						m_request_key[50] = {0};		//指令key(任务唯一码), 作为通信标志位
+	};
+
+	//plc给通道口发送答复消息的DB编号
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_0		301
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_1		311
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_2		321
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_3		331
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_4		341
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_5		351
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_6		361
+#define PASSAGEWAY_RESPONSE_FROM_PLC_TO_DISPATCH_DBNUMBER_7		371
+
+	//plc给通道口发送答复消息的指令结构体
+	struct Passageway_response_from_plc_to_dispatch
+	{
+		//指令信息
+		unsigned char						m_respons_key[50] = {0};	//指令key(任务唯一码), 作为通信标志位
+		unsigned char						m_respons_status = 0;		//指令完成状态, 机器人答复指令, 返回任务完成的情况
+		unsigned char						m_reserved51_69[19] = {0};	//预留
+
+		unsigned char			m_respons_inside_door_motion = 0;		//通道口 内门动作
+		unsigned char			m_respons_outside_door_motion = 0;		//通道口 外门动作
+		unsigned char			m_respons_turntable_direction = 0;		//通道口 转台方向
+	};
+
+	//plc给通道口发送状态消息的DB编号
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_0		303
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_1		313
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_2		323
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_3		333
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_4		343
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_5		353
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_6		363
+#define PASSAGEWAY_STATUS_FROM_PLC_TO_DISPATCH_DBNUMBER_7		373
+
+	//plc给通道口发送状态消息的指令结构体
+	struct Passageway_status_from_plc_to_dispatch
+	{
+		unsigned char			m_heartbeat = 0;				//心跳位, 0-255循环
+
+		unsigned char			m_safe_status = 0;				//设备的安全状态
+		unsigned char			m_sensor_status1 = 0;			//设备的传感器状态1
+		unsigned char			m_sensor_status2 = 0;			//设备的传感器状态2
+		unsigned char			m_reserved4_35[32] = {0};		//预留
+		unsigned char			m_actual_turntable_direction;	//通道口 转台方向
+		unsigned char			m_reserved37 = 0;					//预留
+
+		//故障信息
+		unsigned char			m_actual_error_code[50] = {0};		//通道口错误码
+		unsigned char			m_actual_warning_code[50] = {0};	//升降机错误码
+		unsigned char			m_actual_error_description[256] = {0};	//升降机错误描述
+	};
+
+
 #pragma pack(pop)		//取消对齐
 
 // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
@@ -241,6 +328,11 @@ public:
 	Carrier_response_from_plc_to_dispatch				m_carrier_response_from_plc_to_dispatch[3];	//plc给搬运器发送答复消息的指令结构体
 	Carrier_status_from_plc_to_dispatch					m_carrier_status_from_plc_to_dispatch[3];	//plc给搬运器发送状态消息的指令结构体
 
+	Passageway_request_from_dispatch_to_plc_for_data	m_passageway_request_from_dispatch_to_plc_for_data[8];	//通道口给plc发送请求消息的指令结构体
+	Passageway_request_from_dispatch_to_plc_for_key		m_passageway_request_from_dispatch_to_plc_for_key[8];	//通道口给plc发送请求消息的指令结构体
+	Passageway_response_from_plc_to_dispatch			m_passageway_response_from_plc_to_dispatch[8];	//plc给通道口发送答复消息的指令结构体
+	Passageway_status_from_plc_to_dispatch				m_passageway_status_from_plc_to_dispatch[8];	//plc给通道口发送状态消息的指令结构体
+
 private:
 
 };

+ 25 - 0
dispatch/dispatch_device_base.h

@@ -100,6 +100,31 @@ public:
 		HAVE_CAR               		= 1,    //有车
 		NO_CAR            			= 2,    //没车
 	};
+
+	//7号出口 转台方向
+	enum Turntable_direction
+	{
+		TURNTABLE_DIRECTION_UNKNOWN				= 0,	//方向未知,
+		TURNTABLE_DIRECTION_INSIDE 				= 1,    //方向朝里,对接内门的小跑车
+		TURNTABLE_DIRECTION_OUTSIDE  			= 2,    //没车朝外,对接外门的出口
+	};
+
+	//出入口 门的开关状态
+	enum Door_motion
+	{
+		DOOR_UNKNOWN            = 0,    //门的开关状态 未知, 或者工作到一半,正在工作中.
+	    DOOR_OPEN               = 1,    //开门
+		DOOR_CLOSE				= 2,	//关门
+		DOOR_ERROR				= 3,	//
+	};
+
+	//边界判断,是否超界
+	enum Overstep_the_boundary
+	{
+		BOUNDARY_NORMAL			= 0,	//边界 正常
+		BOUNDARY_OVERSTEP       = 1,    //超界
+	};
+
 public:
 	Dispatch_device_base();
 	Dispatch_device_base(const Dispatch_device_base& other)= default;

+ 4 - 1
dispatch/dispatch_manager.h

@@ -83,9 +83,12 @@ public://get or set member variable
 protected://member variable
 
 	Dispatch_manager_status						m_dispatch_manager_status;			//调度管理 的状态
-
 	int 										m_dispatch_id;						//调度模块的id, (楚天项目就是单元号, 0~2)
 
+
+
+
+
 	int 										m_carrier_number;					//搬运器的数量, 默认3个
 	std::vector<Carrier_base*>					m_carrier_vector;					//搬运器的对象实例,内存由本类管理
 

+ 11 - 0
error_code/error_code.h

@@ -380,6 +380,17 @@ enum Error_code
 	CATCHER_RESPONS_ERROR,						//抓取器模块,指令的执行失败
 	CATCHER_TASK_NOTHINGNESS,					//抓取器模块,任务不存在
 
+	PASSAGEWAY_ERROR_BASE								= 0x13040000,
+	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,					//通道口模块,任务不存在
+
 
 
 	//snap7 通信模块 错误码

+ 1 - 0
task/task_base.h

@@ -30,6 +30,7 @@ enum Task_type
 	DISPATCH_MANAGER_TASK,					//调度管理任务
 	CARRIER_TASK,							//搬运器任务
 	CATCHER_TASK,							//抓取器任务
+	PASSAGEWAY_TASK,						//通道口任务
 
 };
 //任务状态,如果任务故障,任务状态改为TASK_OVER,然后在m_task_error_manager 补充错误码。