Преглед изворни кода

20210317, 优化通信协议的message

huli пре 4 година
родитељ
комит
301b468c66
4 измењених фајлова са 107 додато и 14 уклоњено
  1. 97 4
      main.cpp
  2. 3 3
      message/dispatch_control.pb.cc
  3. 2 2
      message/dispatch_control.pb.h
  4. 5 5
      message/dispatch_control.proto

+ 97 - 4
main.cpp

@@ -101,10 +101,15 @@ int main(int argc,char* argv[])
 	std::cout << " ---------------------------------------------------" << std::endl;
 	std::cout << " ---------------------------------------------------" << std::endl;
 
+
+
+
+
+
+
 	Catcher t_catcher;
 	t_error = t_catcher.dispatch_device_base_init(1);
 	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
-
 	std::this_thread::sleep_for(std::chrono::seconds(2));
 
 	std::shared_ptr<Task_Base> tp_task_Base(new Catcher_task);
@@ -119,18 +124,70 @@ int main(int argc,char* argv[])
 	tp_catcher_task->m_request_d2 = 444;
 	tp_catcher_task->m_request_wheelbase = 555;
 	tp_catcher_task->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
+	t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
+	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
+	std::cout << " ---------------------------------------------------" << std::endl;
 
+	char zxczxcxzc ;
+	std::cin >> zxczxcxzc ;
 
-	t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
+	while ( 1 )
+	{
+		std::cout << " huli test :::: " << "  ===================================== "   << std::endl;
+		std::cout << " huli test :::: " << " tp_catcher_task->get_task_statu = " << tp_catcher_task->get_task_statu() << std::endl;
+		std::cout << " huli test :::: " << " tp_catcher_task->m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
+
+
+		std::cout << " huli test :::: " << " m_respons_key = " << tp_catcher_task->m_respons_key << std::endl;
+		std::cout << " huli test :::: " << " m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
+		std::cout << " huli test :::: " << " m_respons_x = " << tp_catcher_task->m_respons_x << std::endl;
+		std::cout << " huli test :::: " << " m_respons_y = " << tp_catcher_task->m_respons_y << std::endl;
+		std::cout << " huli test :::: " << " m_respons_b = " << tp_catcher_task->m_respons_b << std::endl;
+		std::cout << " huli test :::: " << " m_respons_z = " << tp_catcher_task->m_respons_z << std::endl;
+		std::cout << " huli test :::: " << " m_respons_d1 = " << tp_catcher_task->m_respons_d1 << std::endl;
+		std::cout << " huli test :::: " << " m_respons_d2 = " << tp_catcher_task->m_respons_d2 << std::endl;
+		std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_catcher_task->m_respons_wheelbase << std::endl;
+		std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_catcher_task->m_respons_clamp_motion << std::endl;
+
+
+		std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_dispatch_device_status() << std::endl;
+		std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_actual_device_status() << std::endl;
+
+
+		std::cout << " ---------------------------------------------------" << std::endl;
+		std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+
+	}
+
+
+
+
+
+
+	Catcher t_catcher;
+	t_error = t_catcher.dispatch_device_base_init(1);
 	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
+	std::this_thread::sleep_for(std::chrono::seconds(2));
 
+	std::shared_ptr<Task_Base> tp_task_Base(new Catcher_task);
+	Catcher_task * tp_catcher_task = (Catcher_task *)tp_task_Base.get();
+	tp_catcher_task->task_init(NULL,std::chrono::milliseconds(15000));
+	tp_catcher_task->m_request_key = "ABCDEF";
+	tp_catcher_task->m_request_x = 123;
+	tp_catcher_task->m_request_y = 456;
+	tp_catcher_task->m_request_b = 80;
+	tp_catcher_task->m_request_z = 789;
+	tp_catcher_task->m_request_d1 = 333;
+	tp_catcher_task->m_request_d2 = 444;
+	tp_catcher_task->m_request_wheelbase = 555;
+	tp_catcher_task->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
+	t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
+	std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
 	std::cout << " ---------------------------------------------------" << std::endl;
 
-
 	char zxczxcxzc ;
 	std::cin >> zxczxcxzc ;
 
-
 	while ( 1 )
 	{
 		std::cout << " huli test :::: " << "  ===================================== "   << std::endl;
@@ -159,6 +216,32 @@ int main(int argc,char* argv[])
 
 	}
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 	char ch123 ;
 	std::cin >> ch123 ;
 
@@ -169,6 +252,16 @@ int main(int argc,char* argv[])
 
 
 
+
+
+
+
+
+
+
+
+
+
 	int t_dispatch_id = 0;
 //	std::cin >> t_dispatch_id ;
 	if ( argc == 2 )

+ 3 - 3
message/dispatch_control.pb.cc

@@ -304,7 +304,7 @@ void AddDescriptorsImpl() {
       "INISH\020\036\022\023\n\017DISPATCH_CANCEL\020\037\022\022\n\016DISPATCH"
       "_PAUSE\020(\022\025\n\021DISPATCH_RESERVED\0202*\370\001\n\024Disp"
       "atch_device_type\022\013\n\007ROBOT_1\020e\022\013\n\007ROBOT_2"
-      "\020f\022\016\n\tCARRIER_1\020\311\001\022\016\n\tCARRIER_2\020\312\001\022\016\n\tCA"
+      "\020f\022\016\n\tCARRIER_1\020\310\001\022\016\n\tCARRIER_2\020\317\001\022\016\n\tCA"
       "RRIER_3\020\313\001\022\021\n\014PASSAGEWAY_0\020\254\002\022\021\n\014PASSAGE"
       "WAY_1\020\255\002\022\021\n\014PASSAGEWAY_2\020\256\002\022\021\n\014PASSAGEWA"
       "Y_3\020\257\002\022\021\n\014PASSAGEWAY_4\020\260\002\022\021\n\014PASSAGEWAY_"
@@ -375,9 +375,9 @@ bool Dispatch_device_type_IsValid(int value) {
   switch (value) {
     case 101:
     case 102:
-    case 201:
-    case 202:
+    case 200:
     case 203:
+    case 207:
     case 300:
     case 301:
     case 302:

+ 2 - 2
message/dispatch_control.pb.h

@@ -118,8 +118,8 @@ inline bool Dispatch_task_type_Parse(
 enum Dispatch_device_type {
   ROBOT_1 = 101,
   ROBOT_2 = 102,
-  CARRIER_1 = 201,
-  CARRIER_2 = 202,
+  CARRIER_1 = 200,
+  CARRIER_2 = 207,
   CARRIER_3 = 203,
   PASSAGEWAY_0 = 300,
   PASSAGEWAY_1 = 301,

+ 5 - 5
message/dispatch_control.proto

@@ -71,11 +71,11 @@ enum Dispatch_device_type
 //调度设备的目标状态, 设备完成 调度控制的任务请求 之后 将设备状态改为这个
 enum Dispatch_device_target_status
 {
-    E_UNKNOW               	= 0;    //未知
-    E_IDLE                  = 1;    //空闲
-    E_BUSY					= 2; 	//工作正忙
-    E_READY               	= 3;    //准备就绪
-    E_WAIT               	= 4;    //等待
+    E_TARGET_STATUS_UNKNOW               	= 0;    //未知
+    E_TARGET_STATUS_IDLE                    = 1;    //空闲
+    E_TARGET_STATUS_BUSY					= 2; 	//工作正忙
+    E_TARGET_STATUS_READY               	= 3;    //准备就绪
+    E_TARGET_STATUS_WAIT               	    = 4;    //等待
 }
 
 //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)