Pārlūkot izejas kodu

20210922,test s7 123

huli 3 gadi atpakaļ
vecāks
revīzija
0ca80abcc1

+ 14 - 10
dispatch/dispatch_communication.cpp

@@ -87,16 +87,18 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
 	t_index += sizeof(unsigned char)*20;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
 	t_index += sizeof(unsigned char)*20;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved188_207", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
-	t_index += sizeof(unsigned char)*20;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", 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_reserved189_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 21 });
+	t_index += sizeof(unsigned char)*21;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_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_reserved209_213", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
 	t_index += sizeof(unsigned char)*5;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base_exact_value", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved218_229", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 12 });
-	t_index += sizeof(unsigned char)*12;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
+	t_index += sizeof(unsigned char)*25;
 
 	t_snap7_buf.init(DISPATCH_REQUEST_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 50, sizeof(Dispatch_request_from_manager_to_plc_for_data), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_send_buf_map[0] = t_snap7_buf;
@@ -168,16 +170,18 @@ Error_manager Dispatch_communication::communication_init(int plc_id)
 	t_index += sizeof(unsigned char)*20;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved168_187", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
 	t_index += sizeof(unsigned char)*20;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved188_207", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 20 });
-	t_index += sizeof(unsigned char)*20;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_type", 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_reserved189_209", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 21 });
+	t_index += sizeof(unsigned char)*21;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_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_reserved209_213", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved211_215", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 5 });
 	t_index += sizeof(unsigned char)*5;
 	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_request_car_wheel_base_exact_value", typeid(float).name(), t_index,sizeof(float), 1 });
 	t_index += sizeof(float)*1;
-	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved218_229", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 12 });
-	t_index += sizeof(unsigned char)*12;
+	t_variable_information_vector.push_back(Snap7_buf::Variable_information{"m_reserved217_231", typeid(unsigned char).name(), t_index,sizeof(unsigned char), 25 });
+	t_index += sizeof(unsigned char)*25;
 
 	t_snap7_buf.init(DISPATCH_PLC_STATUS_FROM_MANAGER_TO_PLC_DBNUMBER_0 +m_plc_id*100, 0, sizeof(Dispatch_response_from_plc_to_manager), t_variable_information_vector, Snap7_buf::LOOP_COMMUNICATION);
 	m_receive_buf_map[0] = t_snap7_buf;

+ 16 - 10
dispatch/dispatch_communication.h

@@ -322,13 +322,16 @@ public:
 		float  					m_request_car_wheel_width = 0;				//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车, 单位:米 m
 		unsigned char			m_request_car_license[20] = {0};			//车牌号(汽车唯一标示)	例如: 鄂A12345
 		unsigned char			m_reserved168_187[20] = {0};							//预留
-		unsigned char			m_reserved188_207[20] = {0};							//预留
-		//防撞雷达
+
+		unsigned char			m_request_car_type = 0;						//0=未知,1=小车,2=中车,3=大车 ..188
+		unsigned char			m_reserved189_209[21] = {0};							//预留
+
+		//防撞雷达 ..210
 		unsigned char			m_request_anticollision_lidar_flag = 0;		//汽车是否停到正确的位置, 防撞雷达	预留, 楚天暂时不用,0=未知,1=位置正常,2=位置异常
-		unsigned char			m_reserved209_213[5] = {0};							//预留
-		//轮距雷达
+		unsigned char			m_reserved211_215[5] = {0};							//预留
+		//轮距雷达 ..216
 		float  					m_request_car_wheel_base_exact_value = 0;	//汽车前后轮距,轮距雷达的精确值	预留, 楚天暂时不用,单位:米 m
-		unsigned char			m_reserved218_229[12] = {0};				//预留
+		unsigned char			m_reserved217_231[25] = {0};				//预留
 
 	};
 //调度管理给plc发送调度指令 的结构体
@@ -374,13 +377,16 @@ public:
 		float  					m_response_car_wheel_width = 0;				//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车, 单位:米 m
 		unsigned char			m_response_car_license[20] = {0};			//车牌号(汽车唯一标示)	例如: 鄂A12345
 		unsigned char			m_reserved168_187[20] = {0};							//预留
-		unsigned char			m_reserved188_207[20] = {0};							//预留
-		//防撞雷达
+
+		unsigned char			m_response_car_type = 0;						//0=未知,1=小车,2=中车,3=大车 ..188
+		unsigned char			m_reserved189_209[21] = {0};							//预留
+
+		//防撞雷达 ..210
 		unsigned char			m_response_anticollision_lidar_flag = 0;		//汽车是否停到正确的位置, 防撞雷达	预留, 楚天暂时不用,0=未知,1=位置正常,2=位置异常
-		unsigned char			m_reserved209_213[5] = {0};							//预留
-		//轮距雷达
+		unsigned char			m_reserved211_215[5] = {0};							//预留
+		//轮距雷达 ..216
 		float  					m_response_car_wheel_base_exact_value = 0;	//汽车前后轮距,轮距雷达的精确值	预留, 楚天暂时不用,单位:米 m
-		unsigned char			m_reserved218_229[12] = {0};				//预留
+		unsigned char			m_reserved217_231[25] = {0};				//预留
 
 	};
 

+ 51 - 2
dispatch/dispatch_plc.cpp

@@ -272,6 +272,9 @@ Error_manager Dispatch_plc::encapsulate_dispatch_request_to_plc()
 		//车位朝向, 小号朝前朝南, 大号朝后朝北
 		m_request_parkingspace_direction = (Common_data::Parkingspace_direction)m_dispatch_request_msg.parkspace_info_ex(0).parkingspace_direction();
 		m_request_car_license = m_dispatch_request_msg.parkspace_info_ex(0).car_info().license();
+
+		m_request_car_type = (Common_data::Car_type)m_dispatch_request_msg.parkspace_info_ex(0).car_type();
+
 	}
 	else
 	{
@@ -287,7 +290,7 @@ Error_manager Dispatch_plc::update_dispatch_plc_communication()
 {
 	std::unique_lock<std::mutex> t_lock(m_lock);
 	std::unique_lock<std::mutex> t_lock1(Dispatch_communication::get_instance_references().m_data_lock);
-
+/*
 	//请求消息, 调度->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;
@@ -295,6 +298,41 @@ Error_manager Dispatch_plc::update_dispatch_plc_communication()
 	& Dispatch_communication::get_instance_references().m_dispatch_request_from_manager_to_plc_for_key;
 	memset(m_dispatch_request_from_manager_to_plc_for_key->m_request_key, 0, 50);
 	int t_size1 = m_request_key.size()<=50 ? m_request_key.size() : 50 ;
+	m_request_key = "123456789";
+	memcpy(m_dispatch_request_from_manager_to_plc_for_key->m_request_key, m_request_key.c_str(), t_size1);
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_dispatch_motion_direction = 01;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_passageway_id = 02;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_passageway_direction = 03;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_parkingspace_index_id = 04;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_parkingspace_unit_id = 05;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_parkingspace_floor_id = 6;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_parkingspace_room_id = 7;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_parkingspace_direction = 8;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_center_x = 11;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_center_y = 12;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_angle = 13;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_front_theta = 14;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_length = 15;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_width = 16;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_height = 17;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_wheel_base = 18;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_wheel_width = 19;
+	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 ;
+	m_request_car_license = "ABCDEF";
+	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 = 33;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_anticollision_lidar_flag = 44;
+	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_wheel_base_exact_value = 55;
+*/
+
+ 	//请求消息, 调度->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 =
+	& Dispatch_communication::get_instance_references().m_dispatch_request_from_manager_to_plc_for_key;
+	memset(m_dispatch_request_from_manager_to_plc_for_key->m_request_key, 0, 50);
+	int t_size1 = m_request_key.size()<=50 ? m_request_key.size() : 50 ;
 	memcpy(m_dispatch_request_from_manager_to_plc_for_key->m_request_key, m_request_key.c_str(), t_size1);
 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_dispatch_motion_direction = m_request_dispatch_motion_direction;
 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_passageway_id = m_request_passageway_id;
@@ -316,9 +354,15 @@ 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_anticollision_lidar_flag = m_request_anticollision_lidar_flag;
 	tp_dispatch_request_from_manager_to_plc_for_data->m_request_car_wheel_base_exact_value = m_request_car_wheel_base_exact_value;
 
+
+
+
+
+
 	//答复消息, plc->调度
 	Dispatch_communication::Dispatch_response_from_plc_to_manager * tp_dispatch_response_from_plc_to_manager =
 	& Dispatch_communication::get_instance_references().m_dispatch_response_from_plc_to_manager;
@@ -342,6 +386,7 @@ Error_manager Dispatch_plc::update_dispatch_plc_communication()
 	m_response_car_wheel_base = tp_dispatch_response_from_plc_to_manager->m_response_car_wheel_base;
 	m_response_car_wheel_width = tp_dispatch_response_from_plc_to_manager->m_response_car_wheel_width;
 	m_response_car_license = (char*) tp_dispatch_response_from_plc_to_manager->m_response_car_license;
+	m_response_car_type = (Common_data::Car_type) tp_dispatch_response_from_plc_to_manager->m_response_car_type;
 	m_response_anticollision_lidar_flag = (Common_data::Anticollision_lidar_flag)tp_dispatch_response_from_plc_to_manager->m_response_anticollision_lidar_flag;
 	m_response_car_wheel_base_exact_value = tp_dispatch_response_from_plc_to_manager->m_response_car_wheel_base_exact_value;
 
@@ -382,7 +427,11 @@ Error_manager Dispatch_plc::check_response_from_plc()
 	{
 		return Error_code::SUCCESS;
 	}
-
+	//返回没有收到数据
+	else
+	{
+		return Error_code::NODATA;
+	}
 
 
 	//检查唯一码

+ 4 - 0
dispatch/dispatch_plc.h

@@ -129,6 +129,8 @@ protected://member variable
 	float  											m_request_car_wheel_base = 0;			//整车的轮距, 前后轮的距离, 用于机器人或agv的抓车, 单位:米 m
 	float  											m_request_car_wheel_width = 0;			//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车, 单位:米 m
 	std::string										m_request_car_license;					//车牌号(汽车唯一标示)	例如: 鄂A12345
+
+	Common_data::Car_type							m_request_car_type;					//车的大小
 	//防撞雷达
 	Common_data::Anticollision_lidar_flag			m_request_anticollision_lidar_flag ;		//汽车是否停到正确的位置, 防撞雷达	预留, 楚天暂时不用,0=未知,1=位置正常,2=位置异常
 	//轮距雷达
@@ -158,6 +160,8 @@ protected://member variable
 	float  											m_response_car_wheel_base = 0;			//整车的轮距, 前后轮的距离, 用于机器人或agv的抓车, 单位:米 m
 	float  											m_response_car_wheel_width = 0;			//整车的轮距, 左右轮的距离, 用于机器人或agv的抓车, 单位:米 m
 	std::string										m_response_car_license;					//车牌号(汽车唯一标示)	例如: 鄂A12345
+
+	Common_data::Car_type							m_response_car_type;					//车的大小
 	//防撞雷达
 	Common_data::Anticollision_lidar_flag			m_response_anticollision_lidar_flag ;	//汽车是否停到正确的位置, 防撞雷达	预留, 楚天暂时不用,0=未知,1=位置正常,2=位置异常
 	//轮距雷达

+ 3 - 0
message/message_base.proto

@@ -145,6 +145,9 @@ message Locate_information
     optional bool locate_correct = 9[default = false];		    //整车的校准标记位
 
     optional float locate_front_theta = 10[default = 0];	    //整车的前轮的旋转角
+    
+    optional float uniformed_car_x = 11;        //转角复位后,车辆中心点x
+    optional float uniformed_car_y = 12;        //转角复位后,车辆中心点y
 }
 
 //车辆基本信息

+ 1 - 0
tool/common_data.h

@@ -293,6 +293,7 @@ public:
 		PASSAGEWAY_DIRECTION_OUTLET							= 2,    //
 	};
 
+
 	//楼上车位方向   0=未知,1=朝南,2=朝北
 	enum Parkingspace_direction
 	{