Explorar o código

20210507, 版本代码同步

huli %!s(int64=4) %!d(string=hai) anos
pai
achega
7b5c4ee5e3
Modificáronse 3 ficheiros con 42 adicións e 101 borrados
  1. 20 0
      dispatch/dispatch_coordinates.cpp
  2. 22 7
      dispatch/dispatch_coordinates.h
  3. 0 94
      main.cpp

+ 20 - 0
dispatch/dispatch_coordinates.cpp

@@ -136,5 +136,25 @@ Error_manager Dispatch_coordinates::dispatch_coordinates_init_from_protobuf(Disp
 
 	m_carrier_default_x_left = dispatch_coordinates_parameter_all.carrier_default_x_left();
 	m_carrier_default_x_right = dispatch_coordinates_parameter_all.carrier_default_x_right();
+
+	m_passageway_terminal_id_min = dispatch_coordinates_parameter_all.passageway_terminal_id_min();
+	m_passageway_terminal_id_max = dispatch_coordinates_parameter_all.passageway_terminal_id_max();
+	m_passageway_terminal_number = dispatch_coordinates_parameter_all.passageway_terminal_number();
+	size = dispatch_coordinates_parameter_all.passageway_functioning_patterns_size();
+	for (int i = m_passageway_terminal_id_min; i < size; ++i)
+	{
+		m_passageway_functioning_pattern_map[i] = (Passageway_functioning_pattern)dispatch_coordinates_parameter_all.passageway_functioning_patterns(i);
+	}
+	if ( m_passageway_terminal_number != m_passageway_terminal_id_max - m_passageway_terminal_id_min +1 ||
+		 m_passageway_terminal_number != size)
+	{
+		return Error_manager(Error_code::PARAMETER_ERROR, Error_level::MINOR_ERROR,
+							 " Dispatch_coordinates::dispatch_coordinates_init_from_protobuf PARAMRTER ERROR ");
+	}
+
+
+	m_car_wheel_base_min = dispatch_coordinates_parameter_all.car_wheel_base_min();
+	m_car_wheel_base_max = dispatch_coordinates_parameter_all.car_wheel_base_max();
+
 	return Error_code::SUCCESS;
 }

+ 22 - 7
dispatch/dispatch_coordinates.h

@@ -16,20 +16,28 @@
 class Dispatch_coordinates:public Singleton<Dispatch_coordinates>
 {
 // 子类必须把父类设定为友元函数,这样父类才能使用子类的私有构造函数。
-   friend class Singleton<Dispatch_coordinates>;
+	friend class Singleton<Dispatch_coordinates>;
 
 public:
 #define DISPATCH_COORDINATES_PARAMETER_PATH "../setting/dispatch_coordinates.prototxt"
 
+	//出入口的功能模式
+	enum Passageway_functioning_pattern
+	{
+		PASSAGEWAY_FUNCTIONING_PATTERN_UNKNOWN          = 0,    //未知
+		PASSAGEWAY_FUNCTIONING_PATTERN_INLET            = 1,    //单向入口
+		PASSAGEWAY_FUNCTIONING_PATTERN_OUTLET           = 2,    //单向出口
+		PASSAGEWAY_FUNCTIONING_PATTERN_BIDIRECTION      = 3,    //双向口
+	};
 
 private:
- // 父类的构造函数必须保护,子类的构造函数必须私有。
-   Dispatch_coordinates();
+	// 父类的构造函数必须保护,子类的构造函数必须私有。
+	Dispatch_coordinates();
 public:
-    //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
-    Dispatch_coordinates(const Dispatch_coordinates& other) = delete;
-    Dispatch_coordinates& operator =(const Dispatch_coordinates& other) = delete;
-    ~Dispatch_coordinates();
+	//必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+	Dispatch_coordinates(const Dispatch_coordinates& other) = delete;
+	Dispatch_coordinates& operator =(const Dispatch_coordinates& other) = delete;
+	~Dispatch_coordinates();
 public://API functions
 	//初始化 调度的坐标系 模块。如下三选一
 	virtual Error_manager dispatch_coordinates_init();
@@ -95,6 +103,13 @@ public://member variable
 	float									m_carrier_default_x_left;		//中跑车的默认x, 左侧电梯井 1mm
 	float									m_carrier_default_x_right;		//中跑车的默认x, 左侧电梯井 32600mm
 
+	int										m_passageway_terminal_id_min;		//通道口终端id最小值, 默认0
+	int										m_passageway_terminal_id_max;		//通道口终端id最大值, 默认7
+	int										m_passageway_terminal_number;		//通道口终端个数, 默认8
+	std::map<int, Passageway_functioning_pattern>	m_passageway_functioning_pattern_map;//出入口的功能模式
+
+	int										m_car_wheel_base_min;			//汽车轮距最小值, 默认1000
+	int										m_car_wheel_base_max;			//汽车轮距最大值, 默认4000
 private:
 
 };

+ 0 - 94
main.cpp

@@ -119,100 +119,6 @@ int main(int argc,char* argv[])
 	FLAGS_stop_logging_if_full_disk = true;
 
 
-
-	//	Dispatch_communication_test dispatchCommunicationTest;
-//	dispatchCommunicationTest.communication_init();
-//	std::this_thread::sleep_for(std::chrono::seconds(1));
-
-
-	nnxx::socket socket{nnxx::SP, nnxx::BUS};
-//
-
-	socket.bind("tcp://192.168.2.168:30000");
-	std::this_thread::sleep_for(std::chrono::seconds(1));
-//
-
-//	socket.send(sendMsg(1, 79, 7.755, "12345678901234567890123456_s1_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-//	socket.send(sendMsg(2, 78, 11.055, "12345678901234567890123456_s2_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-//	socket.send(sendMsg(3, 79, 14.655, "12345678901234567890123456_s3_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-
-
-//	socket.send(sendMsg(4, 39, 17.955, "12345678901234567890123456_s4_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-//	socket.send(sendMsg(5, 40, 21.555, "12345678901234567890123456_s5_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-//	socket.send(sendMsg(6, 27, 24.855, "12345678901234567890123456_s6_wU", message::Dispatch_motion_direction::E_STORE_CAR));
-
-//	socket.send(sendMsg(1, 79, 7.755, "12345678901234567890123456_p1_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-	socket.send(sendMsg(2, 37, 11.055, "12345678901234567890123456_p2_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-	socket.send(sendMsg(3, 36, 14.655, "12345678901234567890123456_p3_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-	socket.send(sendMsg(4, 19, 17.955, "12345678901234567890123456_p4_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-
-	socket.send(sendMsg(5, 39, 21.555, "12345678901234567890123456_p5_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-	socket.send(sendMsg(6, 40, 24.855, "12345678901234567890123456_p6_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-//	socket.send(sendMsg(7, 39, 24.855, "12345678901234567890123456_p7_wU", message::Dispatch_motion_direction::E_PICKUP_CAR));
-
-//	std::this_thread::sleep_for(std::chrono::seconds(5));
-////
-//
-//	message::Dispatch_control_request_msg control_reqeust;
-//	control_reqeust.mutable_base_info()->set_msg_type(message::eDispatch_control_request_msg);
-//	control_reqeust.mutable_base_info()->set_sender(message::eDispatch_control);
-//	control_reqeust.mutable_base_info()->set_receiver(message::eDispatch_manager);
-//	control_reqeust.mutable_base_info()->set_timeout_ms(100000000);
-//	control_reqeust.set_command_key("12345678901234567890123456_p5_wU+120");
-//	control_reqeust.set_dispatch_task_type(message::ROBOT_MOVE);
-//	control_reqeust.set_dispatch_device_type(message::ROBOT_2);
-//	control_reqeust.set_dispatch_source(0);
-//	control_reqeust.set_dispatch_destination(1403);
-//	LOG(INFO) << control_reqeust.DebugString();
-//	socket.send(control_reqeust.SerializeAsString());
-
-	while (1)
-	{
-		std::this_thread::sleep_for(std::chrono::milliseconds(1));
-		std::string str;
-		message::Base_msg base_info;
-
-		str=socket.recv<std::string>(1);
-
-		if ( str.size() > 0 )
-		{
-			base_info.ParseFromString(str);
-			if ( base_info.base_info().msg_type() == message::eDispatch_manager_status_msg )
-			{
-//				std::cout << " Time_tool::get_instance_references().get_current_time_millisecond() = " << Time_tool::get_instance_references().get_current_time_millisecond() << std::endl;
-//				std::cout <<base_info.DebugString()<< std::endl;
-			}
-			else if ( base_info.base_info().msg_type() == message::eDispatch_control_response_msg )
-			{
-				message::Dispatch_control_response_msg t_dispatch_control_response_msg;
-				t_dispatch_control_response_msg.ParseFromString(str);
-				if ( t_dispatch_control_response_msg.dispatch_device_task_status() == message::Dispatch_device_task_status::E_TASK_OVER)
-				{
-					std::cout << " Time_tool::get_instance_references().get_current_time_millisecond() = " << Time_tool::get_instance_references().get_current_time_millisecond() << std::endl;
-					std::cout <<t_dispatch_control_response_msg.DebugString()<< std::endl;
-				}
-				else
-				{
-					std::cout << " Time_tool::get_instance_references().get_current_time_millisecond() = " << Time_tool::get_instance_references().get_current_time_millisecond() << std::endl;
-					std::cout <<t_dispatch_control_response_msg.DebugString()<< std::endl;
-				}
-			}
-			else if ( base_info.base_info().msg_type() == message::eDispatch_control_request_msg )
-			{
-				message::Dispatch_control_request_msg t_dispatch_control_request_msg;
-				t_dispatch_control_request_msg.ParseFromString(str);
-				std::cout << " Time_tool::get_instance_references().get_current_time_millisecond() = " << Time_tool::get_instance_references().get_current_time_millisecond() << std::endl;
-
-				std::cout <<t_dispatch_control_request_msg.DebugString()<< std::endl;
-			}
-			else
-			{	std::cout << " Time_tool::get_instance_references().get_current_time_millisecond() = " << Time_tool::get_instance_references().get_current_time_millisecond() << std::endl;
-
-				std::cout <<base_info.DebugString()<< std::endl;
-			}
-		}
-	}
-
 #define MAIN_TEST 1
 #ifdef MAIN_TEST
 	t_error = Dispatch_coordinates::get_instance_references().dispatch_coordinates_init();