Browse Source

完成停取车流程封装

zx 4 years ago
parent
commit
9674e42e3e

+ 18 - 0
CMakeLists.txt

@@ -91,6 +91,24 @@ target_link_libraries(locate_client
         )
 
 
+add_executable(terminal_client
+        ./test/terminal_client.cpp
+        ./test/Terminal_communication.cpp
+        ./lidar_locate/Locate_communicator.cpp
+        ./error_code/error_code.cpp
+        ${message_src}
+        ${TOOL_SRC}
+        ${COMMUNICATION_SRC}
+        )
+target_link_libraries(terminal_client
+        nnxx
+        nanomsg
+        ${PROTOBUF_LIBRARIES}
+        /usr/local/lib/libglog.a
+        /usr/local/lib/libgflags.a
+        )
+
+
 add_executable(locate_test
         ./test/test_locate_sample.cpp
         ./lidar_locate/Locate_communicator.cpp

+ 7 - 0
communication/communication_message.h

@@ -40,6 +40,13 @@ public:
         eParkspace_search_response_msg = 0x35,    //查询车位反馈消息
         eParkspace_release_request_msg = 0x36,    //释放车位请求消息
         eParkspace_release_response_msg = 0x37,    //释放车位反馈消息
+
+        eStore_command_request_msg=0x41,        //终端停车请求消息
+        eStore_command_response_msg=0x42,       //停车请求反馈消息
+        ePickup_command_request_msg=0x43,       //取车请求消息
+        ePickup_command_response_msg=0x44,       //取车请求反馈消息
+
+        eEntrance_statu_msg=0x51,              //出入口状态消息
 	};
 
 //通讯单元

+ 5 - 0
communication/communication_requestor.cpp

@@ -0,0 +1,5 @@
+//
+// Created by zx on 2020/7/10.
+//
+
+#include "communication_requestor.h"

+ 15 - 0
communication/communication_requestor.h

@@ -0,0 +1,15 @@
+//
+// Created by zx on 2020/7/10.
+//
+
+#ifndef NNXX_TESTS_COMMUNICATION_REQUESTOR_H
+#define NNXX_TESTS_COMMUNICATION_REQUESTOR_H
+
+
+class communication_requestor
+{
+
+};
+
+
+#endif //NNXX_TESTS_COMMUNICATION_REQUESTOR_H

+ 4 - 6
communication/communication_socket_base.cpp

@@ -137,8 +137,6 @@ Error_manager Communication_socket_base::communication_connect(std::string conne
 		return Error_manager(Error_code::COMMUNICATION_CONNECT_ERROR, Error_level::MINOR_ERROR,
 							 " m_socket.connect error ");
 	}
-	LOG(INFO) << " ---Communication_socket_base::communication_connect() connect::  "<< connect_string << "  " << this;
-
 	return Error_code::SUCCESS;
 }
 //启动通信, run thread
@@ -368,10 +366,10 @@ Error_manager Communication_socket_base::analysis_receive_list()
 				{
 					//处理消息
 					t_error = execute_msg(tp_msg);
-//				if ( t_error )
-//				{
-//					//执行结果不管
-//				}
+				if ( t_error!=SUCCESS )
+				{
+					fprintf(stderr,"%s\n",t_error.to_string().c_str());
+				}
 //				else
 //				{
 //					//执行结果不管

+ 2 - 2
error_code/error_code.h

@@ -128,8 +128,8 @@ enum Error_code
 
 	//LASER_MANAGER 定位管理模块
 	LOCATER_MANAGER_ERROR_BASE                		= 0x03010000,
-    LOCATER_MSG_TABLE_NOT_EXIST ,
-    LOCATER_MSG_RESPONSE_TYPE_ERROR,
+    LOCATER_MSG_TABLE_NOT_EXIST ,                                   //测量反馈未找到相应的请求(致命)
+    LOCATER_MSG_RESPONSE_TYPE_ERROR,                                //测量反馈消息类型错误(致命)
     LOCATER_MSG_RESPONSE_INFO_ERROR,
     LOCATER_MSG_REQUEST_CANCELED,
     LOCATER_MSG_REQUEST_INVALID,

+ 20 - 33
lidar_locate/Locate_communicator.cpp

@@ -3,52 +3,38 @@
 //
 
 #include "Locate_communicator.h"
-//#include "locate_message.pb.h"
-
-namespace message {
-    bool operator<(const message::Measure_request_msg& msg1, const message::Measure_request_msg& msg2) {
-        return (msg1.command_id() < msg2.command_id());
-    }
-
-    bool operator==(const message::Measure_request_msg& msg1, const message::Measure_request_msg& msg2) {
-        if (msg1.base_info().msg_type() == msg2.base_info().msg_type()
-            && msg1.base_info().sender() == msg2.base_info().sender()
-            && msg1.base_info().receiver() == msg2.base_info().receiver()
-            && msg1.command_id() == msg2.command_id()
-            && msg1.terminal_id() == msg2.terminal_id()) {
-            return true;
-        }
-        return false;
-    }
-}
 
 Locate_communicator::Locate_communicator()
 {
-
 }
 Locate_communicator::~Locate_communicator()
 {
-
 }
 
-
 Error_manager Locate_communicator::encapsulate_msg(Communication_message* message)
 {
-
+    Error_manager code;
     //记录请求
-    if(message->get_message_type()==Communication_message::eLocate_request_msg)
+    switch (message->get_message_type())
     {
-        message::Measure_request_msg request;
-        request.ParseFromString(message->get_message_buf());
-        m_response_table[request]=message::Measure_response_msg();
-        //发送请求
-        return Communication_socket_base::encapsulate_msg(message);
-    }
-    else
-    {
-        return Error_manager(LOCATER_MSG_TABLE_NOT_EXIST,NEGLIGIBLE_ERROR,"message table is not exist");
+        case Communication_message::eLocate_request_msg:
+        {
+            message::Measure_request_msg request;
+            request.ParseFromString(message->get_message_buf());
+            m_response_table[request]=message::Measure_response_msg();
+            //发送请求
+            code= Communication_socket_base::encapsulate_msg(message);
+            if(code!=SUCCESS)
+            {
+                m_response_table.erase(request);
+            }
+            break;
+        }
+        default:
+            code= Error_manager(FAILED,CRITICAL_ERROR," measure发送任务类型不存在");
+            break;
     }
-
+    return code;
 
 }
 
@@ -124,6 +110,7 @@ Error_manager Locate_communicator::locate_request(message::Measure_request_msg&
         std::this_thread::yield();
         usleep(1000);
     }while(time<double(timeout));
+    m_response_table.erase(request);
     return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"measure request timeout");
 }
 

+ 6 - 5
lidar_locate/Locate_communicator.h

@@ -15,11 +15,12 @@
 
 #include "thread_safe_map.h"
 
-namespace message
-{
-    bool operator<(const message::Measure_request_msg& msg1,const message::Measure_request_msg& msg2);
-    bool operator==(const message::Measure_request_msg& msg1,const message::Measure_request_msg& msg2);
-}
+#include "message_compare.h"
+
+/*
+ * 注册消息的比较函数,用于重载==与<符号,使其可以用作map中的key
+ */
+RegistoryCompare(message,message::Measure_request_msg);
 
 
 class Locate_communicator: public Singleton<Locate_communicator>, public Communication_socket_base

+ 26 - 36
main.cpp

@@ -7,9 +7,10 @@
 #include "TaskQueue/TQFactory.h"
 #include "./communication/communication_socket_base.h"
 #include "StoreProcessTask.h"
+#include "PickupProcessTask.h"
 #include "system_communicator.h"
 #include "Locate_communicator.h"
-#include "threadSafeQueue.h"
+#include "command_manager.h"
 
 #include "pathcreator.h"
 
@@ -24,58 +25,33 @@ using google::protobuf::io::CodedOutputStream;
 using google::protobuf::Message;
 
 
-///线程池
-tq::IQueue* g_pthread_queue = nullptr;
-
 GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size);
 void init_glog();
-Error_manager Init_communicators();
+Error_manager init_communicators();
 
 
 int main(int argc,char* argv[])
 {
     init_glog();
-    Error_manager code=Init_communicators();
+    Error_manager code=init_communicators();
 	if(code!=SUCCESS)
     {
 	    LOG(ERROR)<<code.to_string();
     }
-    g_pthread_queue= tq::TQFactory::CreateDefaultQueue();
-    g_pthread_queue->Start(12);
-
-    //std::thread* pthread=new std::thread(delete_thread);
-    StoreProcessTask* task=new StoreProcessTask();
-    int N=0;
-    while(1)
-    {
 
-        StoreProcessTask* task=new StoreProcessTask();
-
-        char license[255]={0};
-        int rd=rand()%900000+100000;
-        sprintf(license,"鄂A%d",rd);
-        task->init_task(rand(),rand()%6,license);
-        if(g_pthread_queue->TaskCount()<1000)
-        {
-            g_pthread_queue->AddTask(task);
-            N++;
-            printf("task size / pushed size : %04d / %08d  license : %s\n",g_pthread_queue->TaskCount(),N,license);
-        }
-        else {
-            delete task;
-        }
-        usleep(1);
-    }
+	getchar();
 
-    g_pthread_queue->WaitForFinish();
-    delete g_pthread_queue;
 	return 0;
 }
 
 
-Error_manager Init_communicators()
+Error_manager init_communicators()
 {
     Error_manager code;
+    /*
+     * 初始化各个通讯模块,
+     */
+
     if(Locate_communicator::get_instance_pointer()== nullptr)
         return FAILED;
     code=Locate_communicator::get_instance_pointer()->communication_connect("tcp://127.0.0.1:4444");
@@ -85,18 +61,32 @@ Error_manager Init_communicators()
     }
     Locate_communicator::get_instance_pointer()->communication_run();
 
-    //
+    //初始化车位分配通讯模块
     if(Parkspace_communicator::get_instance_pointer()== nullptr)
         return FAILED;
-    code=Parkspace_communicator::get_instance_pointer()->communication_connect("tcp://192.168.2.139:7001");
+    code=Parkspace_communicator::get_instance_pointer()->communication_connect("tcp://192.168.2.125:7001");
     if(code!=SUCCESS)
     {
         return code;
     }
     Parkspace_communicator::get_instance_pointer()->communication_run();
+
     ///最后初始化与终端通讯的对象
     if(System_communicator::get_instance_pointer()== nullptr)
         return FAILED;
+    System_communicator::get_instance_pointer()->communication_bind("tcp://127.0.0.1:9001");
+    System_communicator::get_instance_pointer()->communication_run();
+    /*
+     * 初始化指令执行模块
+     */
+    if(Command_manager::get_instance_pointer()== nullptr)
+        return Error_manager(FAILED,CRITICAL_ERROR,"创建指令执行模块失败");
+    code=Command_manager::get_instance_pointer()->init();
+    if(code!=SUCCESS)
+    {
+        return code;
+    }
+
     usleep(1000*3000);
     return SUCCESS;
 }

File diff suppressed because it is too large
+ 1279 - 21
message/message_base.pb.cc


File diff suppressed because it is too large
+ 971 - 4
message/message_base.pb.h


+ 48 - 1
message/message_base.proto

@@ -25,6 +25,15 @@ enum Message_type
     eParkspace_release_request_msg = 0x36;    //释放车位请求消息
     eParkspace_release_response_msg = 0x37;    //释放车位反馈消息
 
+
+    eStore_command_request_msg=0x41;        //终端停车请求消息
+    eStore_command_response_msg=0x42;       //停车请求反馈消息
+    ePickup_command_request_msg=0x43;       //取车请求消息
+    ePickup_command_response_msg=0x44;       //取车请求反馈消息
+
+    eEntrance_statu_msg=0x51;               //出入口状态消息
+
+
 }
 
 //通讯单元
@@ -35,7 +44,7 @@ enum Communicator
 
     eTerminor=0x0100;
     //车位表
-    eTable=0x0200;
+    eParkspace=0x0200;
     //测量单元
     eMeasurer=0x0300;
     //调度机构
@@ -94,3 +103,41 @@ message Locate_information
     optional bool locate_correct = 9;		    //整车的校准标记位
 }
 
+message Car_info
+{
+    optional float                      car_length=1;           //车长
+    required float                      car_width=2;            //车宽
+    required float                      car_height=3;           //车高
+    required string                     license=4;              //车辆凭证号
+}
+
+//车位状态枚举
+enum Parkspace_status
+{
+    eParkspace_empty            = 0;         //空闲,可分配
+    eParkspace_occupied         = 1;         //被占用,不可分配
+    eParkspace_reserverd        = 2;         //被预约,预约车辆可分配
+    eParkspace_error            = 3;         //车位机械结构或硬件故障
+}
+
+enum Direction
+{
+    eForward = 1;
+    eBackward = 2;
+}
+
+//单个车位基本信息与状态信息
+message Parkspace_info
+{
+    optional int32              parkspace_id=1;         //车位编号
+    optional int32              index=2;                //同层编号
+    optional Direction          direction=3;            //前后
+    optional int32              floor=4;                //楼层
+    optional float              length=5;               //车位长
+    optional float              width=6;                //车位宽
+    optional float              height=7;               //车位高
+    optional Parkspace_status   parkspace_status=8;     //车位当前状态
+    optional Car_info           car_info=9;              //当前车位存入车辆的凭证号
+    optional string             entry_time=10;          //入场时间
+    optional string             leave_time=11;          //离场时间
+}

+ 26 - 0
message/message_compare.h

@@ -0,0 +1,26 @@
+//
+// Created by zx on 2020/7/10.
+//
+
+#ifndef NNXX_TESTS_MESSAGE_COMPARE_H__H
+#define NNXX_TESTS_MESSAGE_COMPARE_H__H
+
+#define RegistoryCompare(NAMESPACE,NAME)  \
+namespace NAMESPACE                                                         \
+{                                                                           \
+static bool operator==(const NAME& msg1,const NAME& msg2){                  \
+    if(msg1.base_info().msg_type() == msg2.base_info().msg_type()           \
+        && msg1.base_info().sender() == msg2.base_info().sender()           \
+        && msg1.base_info().receiver() == msg2.base_info().receiver()       \
+        && msg1.command_id() == msg2.command_id()){                         \
+        return true;                                                        \
+    }else{                                                                  \
+        return false;                                                       \
+    }                                                                       \
+}                                                                           \
+static bool operator<(const NAME& msg1,const NAME& msg2){                   \
+    return msg1.command_id() < msg2.command_id();                           \
+}                                                                           \
+}
+
+#endif //NNXX_TESTS_MESSAGE_COMPARE_H

File diff suppressed because it is too large
+ 259 - 1519
message/parkspace_allocation_message.pb.cc


File diff suppressed because it is too large
+ 14 - 1014
message/parkspace_allocation_message.pb.h


+ 0 - 44
message/parkspace_allocation_message.proto

@@ -2,50 +2,6 @@ syntax = "proto2";
 package message;
 import "message_base.proto";
 
-// 请求
-// 1.分配车位
-// 2.查询车辆位置
-// 3.解锁车位
-
-message Car_info
-{
-    optional float                      car_length=1;           //车长
-    required float                      car_width=2;            //车宽
-    required float                      car_height=3;           //车高
-    required string                     license=4;              //车辆凭证号
-}
-
-//车位状态枚举
-enum Parkspace_status
-{
-    eParkspace_empty            = 0;         //空闲,可分配
-    eParkspace_occupied         = 1;         //被占用,不可分配
-    eParkspace_reserverd        = 2;         //被预约,预约车辆可分配
-    eParkspace_error            = 3;         //车位机械结构或硬件故障   
-}
-
-enum Direction
-{
-    eForward = 1;
-    eBackward = 2;
-}
-
-//单个车位基本信息与状态信息
-message Parkspace_info
-{
-    required int32              parkspace_id=1;         //车位编号
-    required int32              index=2;                //同层编号
-    required Direction          direction=3;            //前后
-    required int32              floor=4;                //楼层
-    optional float              length=5;               //车位长
-    required float              width=6;                //车位宽
-    required float              height=7;               //车位高
-    required Parkspace_status   parkspace_status=8;     //车位当前状态
-    optional Car_info           car_info=9;              //当前车位存入车辆的凭证号
-    optional string             entry_time=10;          //入场时间
-    optional string             leave_time=11;          //离场时间
-}
-
 //1.分配车位请求
 message Parkspace_allocation_request_msg
 {

+ 74 - 0
message/process_message.proto

@@ -0,0 +1,74 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+enum Step_statu
+{
+    eWorking=0;             //正在执行
+    eComplete=1;            //完成
+}
+
+//停车指令预处理状态
+message Preprocess_store_statu
+{
+    optional Step_statu         statu=1;         //当前步骤状态
+}
+
+//停车指令测量状态
+message Measure_store_statu
+{
+    optional Step_statu         statu=1;         //当前步骤状态
+}
+
+//停车指令调度状态
+message Storing_statu
+{
+    optional Step_statu         statu=1;         //当前步骤状态
+}
+//停车指令收尾状态
+message Finish_store_statu
+{
+    optional Step_statu         statu=1;         //当前步骤状态
+}
+
+//取车指令预处理状态
+message Preprocess_pickup_statu
+{
+    optional Step_statu     statu=1;
+}
+
+//取车指令调度状态
+message Picking_statu
+{
+    optional Step_statu     statu=1;
+}
+//取车指令收尾状态
+message Finish_pickup_statu
+{
+    optional Step_statu         statu=1;         //当前步骤状态
+}
+
+/////停车流程状态
+message Process_store_statu
+{
+    optional Preprocess_store_statu             preprocess_statu=1;
+    optional Measure_store_statu                measure_statu=2;
+    optional Storing_statu                      storing_statu=3;
+    optional Finish_store_statu                 finish_statu=4;
+}
+
+/////取车流程状态
+message Process_pickup_statu
+{
+    optional Preprocess_pickup_statu             preprocess_statu=1;
+    optional Picking_statu                      picking_statu=2;
+    optional Finish_store_statu                 finish_statu=3;
+}
+
+message Entrance_statu_msg
+{
+    required Base_info                      base_info=1;
+    map<int32,Process_store_statu>         store_msg_map=2;
+    map<int32,Process_pickup_statu>        pickup_msg_map=3;
+}

+ 36 - 0
message/terminal_message.proto

@@ -0,0 +1,36 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+message Store_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;              //终端id
+    required Locate_information         locate_information=3;       //终端测量数据,主要需要车高和车宽
+    required Car_info                   car_info=4;                  //车辆标识(车牌号)
+}
+
+
+message Store_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+}
+
+
+message Pickup_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;              //终端id
+    required Car_info                    car_info=4;                  //车辆信息
+}
+
+
+message Pickup_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required int32                      terminal_id=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+}

+ 51 - 73
parkspace/Parkspace_communicator.cpp

@@ -4,59 +4,6 @@
 
 #include "Parkspace_communicator.h"
 
-namespace message {
-    bool operator<(const message::Parkspace_allocation_request_msg &msg1,
-                   const message::Parkspace_allocation_request_msg &msg2) {
-        return (msg1.command_id() < msg2.command_id());
-    }
-
-    bool operator==(const message::Parkspace_allocation_request_msg &msg1,
-                    const message::Parkspace_allocation_request_msg &msg2)
-    {
-        if (msg1.base_info().msg_type() == msg2.base_info().msg_type()
-            && msg1.base_info().sender() == msg2.base_info().sender()
-            && msg1.base_info().receiver() == msg2.base_info().receiver()
-            && msg1.command_id() == msg2.command_id()
-            && msg1.terminal_id() == msg2.terminal_id()){
-            return true;
-        }
-        return false;
-    }
-
-    bool operator<(const message::Parkspace_search_request_msg &msg1,
-            const message::Parkspace_search_request_msg &msg2) {
-        return (msg1. command_id() < msg2.command_id());
-    }
-
-bool operator==(const message::Parkspace_search_request_msg &msg1, const message::Parkspace_search_request_msg &msg2)
-{
-    if (msg1.base_info().msg_type() == msg2.base_info().msg_type()
-        && msg1.base_info().sender() == msg2.base_info().sender()
-        && msg1.base_info().receiver() == msg2.base_info().receiver()
-        && msg1.command_id() == msg2.command_id()) {
-        return true;
-    }
-    return false;
-}
-
-bool operator<(const message::Parkspace_release_request_msg &msg1, const message::Parkspace_release_request_msg &msg2)
-{
-    return (msg1.command_id() < msg2.command_id());
-}
-
-bool operator==(const message::Parkspace_release_request_msg &msg1, const message::Parkspace_release_request_msg &msg2)
-{
-    if (msg1.base_info().msg_type() == msg2.base_info().msg_type()
-        && msg1.base_info().sender() == msg2.base_info().sender()
-        && msg1.base_info().receiver() == msg2.base_info().receiver()
-        && msg1.command_id() == msg2.command_id()) {
-        return true;
-    }
-    return false;
-}
-
-}
-
 
 Parkspace_communicator::~Parkspace_communicator(){}
 /*
@@ -67,7 +14,7 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
     /*
      * 检查request合法性,以及模块状态
      */
-    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eTable)
+    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eParkspace)
         return Error_manager(PARKSPACE_ALLOC_REQUEST_INVALID,MINOR_ERROR,"parkspace alloc request invalid");
 
     if(m_alloc_table.find(request)==true)
@@ -82,7 +29,7 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
     message::Base_info base_msg;
     base_msg.set_msg_type(message::eParkspace_allocation_request_msg);
     base_msg.set_sender(message::eMain);
-    base_msg.set_receiver(message::eTable);
+    base_msg.set_receiver(message::eParkspace);
     base_msg.set_timeout_ms(timeout);
     message.reset(base_msg,request.SerializeAsString());
 
@@ -108,7 +55,7 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
                                          "parkspace alloc response msg type error");
                 }
                 //检查基本信息是否匹配
-                if (response_base.sender() != message::eTable ||
+                if (response_base.sender() != message::eParkspace ||
                     response_base.receiver() != message::eMain ||
                     response.command_id() != request.command_id()) {
                     return Error_manager(PARKSPACE_ALLOC_RESPONSE_INFO_ERROR, MAJOR_ERROR,
@@ -133,6 +80,8 @@ Error_manager Parkspace_communicator::alloc_request(message::Parkspace_allocatio
         std::this_thread::yield();
         usleep(1000);
     }while(time<double(timeout));
+    //超时,删除记录,返回错误
+    m_alloc_table.erase(request);
     return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace alloc request timeout");
 
 }
@@ -146,7 +95,7 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
     /*
      * 检查request合法性,以及模块状态
      */
-    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eTable)
+    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eParkspace)
         return Error_manager(PARKSPACE_SEARCH_REQUEST_INVALID,MINOR_ERROR,"parkspace search request invalid");
 
     if(m_search_table.find(request)==true)
@@ -161,7 +110,7 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
     message::Base_info base_msg;
     base_msg.set_msg_type(message::eParkspace_search_request_msg);
     base_msg.set_sender(message::eMain);
-    base_msg.set_receiver(message::eTable);
+    base_msg.set_receiver(message::eParkspace);
     base_msg.set_timeout_ms(timeout);
     message.reset(base_msg,request.SerializeAsString());
 
@@ -187,7 +136,7 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
                                          "parkspace search response msg type error");
                 }
                 //检查基本信息是否匹配
-                if (response_base.sender() != message::eTable ||
+                if (response_base.sender() != message::eParkspace ||
                     response_base.receiver() != message::eMain ||
                     response.command_id() != request.command_id()) {
                     return Error_manager(PARKSPACE_SEARCH_RESPONSE_INFO_ERROR, MAJOR_ERROR,
@@ -195,8 +144,12 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
                 }
                 result = response;
                 m_search_table.erase(request);
-
-                return SUCCESS;
+                if(response.has_error_manager())
+                {
+                    if(response.error_manager().error_code()==0)
+                        return SUCCESS;
+                }
+                return Error_manager(FAILED,MINOR_ERROR,"车位查询返回错误码");
 
             }
         }
@@ -212,6 +165,8 @@ Error_manager Parkspace_communicator::search_request(message::Parkspace_search_r
         std::this_thread::yield();
         usleep(1000);
     }while(time<double(timeout));
+    //超时,删除记录,返回错误
+    m_search_table.erase(request);
     return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace search request timeout");
 }
 
@@ -224,7 +179,7 @@ Error_manager Parkspace_communicator::release_request(message::Parkspace_release
     /*
     * 检查request合法性,以及模块状态
     */
-    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eTable)
+    if(request.base_info().sender()!=message::eMain||request.base_info().receiver()!=message::eParkspace)
         return Error_manager(PARKSPACE_RELEASE_REQUEST_INVALID,MINOR_ERROR,"parkspace release request invalid");
 
     if(m_release_table.find(request)==true)
@@ -239,7 +194,7 @@ Error_manager Parkspace_communicator::release_request(message::Parkspace_release
     message::Base_info base_msg;
     base_msg.set_msg_type(message::eParkspace_release_request_msg);
     base_msg.set_sender(message::eMain);
-    base_msg.set_receiver(message::eTable);
+    base_msg.set_receiver(message::eParkspace);
     base_msg.set_timeout_ms(timeout);
     message.reset(base_msg,request.SerializeAsString());
 
@@ -265,7 +220,7 @@ Error_manager Parkspace_communicator::release_request(message::Parkspace_release
                                          "parkspace release response msg type error");
                 }
                 //检查基本信息是否匹配
-                if (response_base.sender() != message::eTable ||
+                if (response_base.sender() != message::eParkspace ||
                     response_base.receiver() != message::eMain ||
                     response.command_id() != request.command_id()) {
                     return Error_manager(PARKSPACE_RELEASE_RESPONSE_INFO_ERROR, MAJOR_ERROR,
@@ -290,6 +245,8 @@ Error_manager Parkspace_communicator::release_request(message::Parkspace_release
         std::this_thread::yield();
         usleep(1000);
     }while(time<double(timeout));
+    //超时,删除记录,返回错误
+    m_release_table.erase(request);
     return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace release request timeout");
 }
 
@@ -305,6 +262,7 @@ Parkspace_communicator::Parkspace_communicator(){}
 
 Error_manager Parkspace_communicator::encapsulate_msg(Communication_message* message)
 {
+    Error_manager code;
     switch (message->get_message_type())
     {
         case Communication_message::eParkspace_allocation_request_msg:
@@ -314,7 +272,12 @@ Error_manager Parkspace_communicator::encapsulate_msg(Communication_message* mes
             //记录数据
             m_alloc_table[request]=message::Parkspace_allocation_response_msg();
             //发送请求
-            return Communication_socket_base::encapsulate_msg(message);
+            code= Communication_socket_base::encapsulate_msg(message);
+            if(code!=SUCCESS)
+            {
+                m_alloc_table.erase(request);
+            }
+            break;
         }
         case Communication_message::eParkspace_search_request_msg:
         {
@@ -323,7 +286,12 @@ Error_manager Parkspace_communicator::encapsulate_msg(Communication_message* mes
             //记录数据
             m_search_table[request]=message::Parkspace_search_response_msg();
             //发送请求
-            return Communication_socket_base::encapsulate_msg(message);
+            code= Communication_socket_base::encapsulate_msg(message);
+            if(code!=SUCCESS)
+            {
+                m_search_table.erase(request);
+            }
+            break;
         }
         case Communication_message::eParkspace_release_request_msg:
         {
@@ -332,11 +300,17 @@ Error_manager Parkspace_communicator::encapsulate_msg(Communication_message* mes
             //记录数据
             m_release_table[request]=message::Parkspace_release_response_msg();
             //发送请求
-            return Communication_socket_base::encapsulate_msg(message);
+            code= Communication_socket_base::encapsulate_msg(message);
+            if(code!=SUCCESS)
+            {
+                m_release_table.erase(request);
+            }
+            break;
         }
         default:
-            return Error_manager(PARKSPACE_REQUEST_MSG_TYPE_ERROR,NEGLIGIBLE_ERROR,"parkspace message table is not exist");
+            code= Error_manager(PARKSPACE_REQUEST_MSG_TYPE_ERROR,NEGLIGIBLE_ERROR,"parkspace message table is not exist");
     }
+    return code;
 
 }
 Error_manager Parkspace_communicator::execute_msg(Communication_message* p_msg)
@@ -365,7 +339,10 @@ Error_manager Parkspace_communicator::execute_msg(Communication_message* p_msg)
         case Communication_message::eParkspace_search_response_msg:
         {
             message::Parkspace_search_response_msg response;
-            response.ParseFromString(p_msg->get_message_buf());
+            if(false==response.ParseFromString(p_msg->get_message_buf()))
+            {
+                return Error_manager(ERROR,CRITICAL_ERROR,"parkspace search response 解析失败");
+            }
             message::Parkspace_search_request_msg request=create_request_by_response(response);
             ///查询请求表是否存在,并且更新
             if(m_search_table.find_update(request,response))
@@ -407,7 +384,8 @@ Error_manager Parkspace_communicator::check_msg(Communication_message* p_msg)
         ||p_msg->get_message_type() == Communication_message::Message_type::eParkspace_search_response_msg
         ||p_msg->get_message_type() == Communication_message::Message_type::eParkspace_release_response_msg
         ||p_msg->get_message_type() == Communication_message::Message_type::eParkspace_allocation_status_msg)
-         && p_msg->get_receiver() == Communication_message::Communicator::eMain )
+         && p_msg->get_receiver() == Communication_message::Communicator::eMain
+         && p_msg->get_sender() == Communication_message::Communicator::eTable)
     {
         return Error_code::SUCCESS;
     }
@@ -439,7 +417,7 @@ Parkspace_communicator::create_request_by_response(message::Parkspace_allocation
 {
     message::Parkspace_allocation_request_msg request;
     message::Base_info baseInfo;
-    baseInfo.set_msg_type(message::eLocate_request_msg);
+    baseInfo.set_msg_type(message::eParkspace_allocation_request_msg);
     baseInfo.set_sender(response.base_info().sender());
     baseInfo.set_receiver(response.base_info().receiver());
     request.mutable_base_info()->CopyFrom(baseInfo);
@@ -453,7 +431,7 @@ Parkspace_communicator::create_request_by_response(message::Parkspace_search_res
 {
     message::Parkspace_search_request_msg request;
     message::Base_info baseInfo;
-    baseInfo.set_msg_type(message::eLocate_request_msg);
+    baseInfo.set_msg_type(message::eParkspace_search_request_msg);
     baseInfo.set_sender(response.base_info().sender());
     baseInfo.set_receiver(response.base_info().receiver());
     request.mutable_base_info()->CopyFrom(baseInfo);
@@ -468,7 +446,7 @@ Parkspace_communicator::create_request_by_response(message::Parkspace_release_re
 {
     message::Parkspace_release_request_msg request;
     message::Base_info baseInfo;
-    baseInfo.set_msg_type(message::eLocate_request_msg);
+    baseInfo.set_msg_type(message::eParkspace_release_request_msg);
     baseInfo.set_sender(response.base_info().sender());
     baseInfo.set_receiver(response.base_info().receiver());
     request.mutable_base_info()->CopyFrom(baseInfo);

+ 8 - 11
parkspace/Parkspace_communicator.h

@@ -10,17 +10,14 @@
 #include "singleton.h"
 #include "thread_safe_map.h"
 
-namespace message
-{
-    bool operator<(const message::Parkspace_allocation_request_msg& msg1,const message::Parkspace_allocation_request_msg& msg2);
-    bool operator==(const message::Parkspace_allocation_request_msg& msg1,const message::Parkspace_allocation_request_msg& msg2);
-
-    bool operator<(const message::Parkspace_search_request_msg& msg1,const message::Parkspace_search_request_msg& msg2);
-    bool operator==(const message::Parkspace_search_request_msg& msg1,const message::Parkspace_search_request_msg& msg2);
-
-    bool operator<(const message::Parkspace_release_request_msg& msg1,const message::Parkspace_release_request_msg& msg2);
-    bool operator==(const message::Parkspace_release_request_msg& msg1,const message::Parkspace_release_request_msg& msg2);
-}
+#include "message_compare.h"
+
+/*
+ * 注册消息的比较函数,用于重载==与<符号,使其可以用作map中的key
+ */
+RegistoryCompare(message,message::Parkspace_allocation_request_msg);
+RegistoryCompare(message,message::Parkspace_search_request_msg)
+RegistoryCompare(message,message::Parkspace_release_request_msg)
 
 
 class Parkspace_communicator :public Singleton<Parkspace_communicator>, public Communication_socket_base

+ 3 - 1
proto.sh

@@ -1,4 +1,6 @@
 protoc -I=./message message_base.proto --cpp_out=./message
 protoc -I=./message measure_message.proto --cpp_out=./message
 protoc -I=./message hardware_message.proto --cpp_out=./message
-protoc -I=./message parkspace_allocation_message.proto --cpp_out=./message
+protoc -I=./message parkspace_allocation_message.proto --cpp_out=./message
+protoc -I=./message terminal_message.proto --cpp_out=./message
+protoc -I=./message process_message.proto --cpp_out=./message

+ 75 - 23
system/StoreProcessTask.cpp

@@ -4,6 +4,8 @@
 
 #include <Parkspace_communicator.h>
 #include "StoreProcessTask.h"
+#include "process_message.pb.h"
+#include "command_manager.h"
 
 StoreProcessTask::StoreProcessTask()
 {
@@ -17,11 +19,13 @@ StoreProcessTask::~StoreProcessTask()
 
 }
 
-Error_manager StoreProcessTask::init_task(unsigned int command_id, unsigned int terminor_id,std::string license)
+Error_manager StoreProcessTask::init_task(unsigned int command_id, unsigned int terminor_id,
+        message::Locate_information locate_info,message::Car_info car_info)
 {
     m_command_id=command_id;
     m_terminor_id=terminor_id;
-    m_license=license;
+    m_car_info=car_info;
+    m_locate_info=locate_info;
     return SUCCESS;
 }
 
@@ -41,8 +45,15 @@ Error_manager StoreProcessTask::locate_step() {
     if(code!=SUCCESS)
         return code;
 
-    if(m_measure_response_msg.error_manager().error_code()==0)
+    if(m_measure_response_msg.error_manager().error_code()==0) {
+        LOG(INFO)<<"测量成功,停车终端:"<<m_terminor_id
+                 <<", 指令id:"<<m_command_id
+                 <<", 车辆宽:"<<m_measure_response_msg.locate_information().locate_width()
+                 <<", 车辆高:"<<m_measure_response_msg.locate_information().locate_height()
+                 <<", 车辆角度:"<<m_measure_response_msg.locate_information().locate_angle()
+                 <<", 车牌号:"<<m_parcspace_alloc_response_msg.allocated_space_info().car_info().license();
         return SUCCESS;
+    }
     else
         return Error_manager(FAILED,MINOR_ERROR,"measure response error_code error");
 
@@ -51,12 +62,12 @@ Error_manager StoreProcessTask::locate_step() {
 /*
      * 分配车位
      */
-Error_manager StoreProcessTask::alloc_space_step()
+Error_manager StoreProcessTask::alloc_space()
 {
     /*
      * 检查是否有测量数据
      */
-    if(m_measure_response_msg.has_locate_information()==false)
+    if(m_locate_info.has_locate_height()==false||m_locate_info.has_locate_width()==false)
     {
         return Error_manager(FAILED,MINOR_ERROR," parkspace alloc request without measure info");
     }
@@ -65,26 +76,28 @@ Error_manager StoreProcessTask::alloc_space_step()
     message::Base_info base_info;
     base_info.set_msg_type(message::eParkspace_allocation_request_msg);
     base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eTable);
+    base_info.set_receiver(message::eParkspace);
     base_info.set_timeout_ms(1000); //测量超时1s
     request.mutable_base_info()->CopyFrom(base_info);
 
-    message::Car_info car_info;
-    car_info.set_license(m_license);
-    car_info.set_car_width(m_measure_response_msg.locate_information().locate_width());
-    car_info.set_car_height(m_measure_response_msg.locate_information().locate_height());
-    request.mutable_car_info()->CopyFrom(car_info);
+    request.mutable_car_info()->CopyFrom(m_car_info);
 
     request.set_command_id(m_command_id);
     request.set_terminal_id(m_terminor_id);
-    request.mutable_car_info()->set_license(m_license);
 
     Error_manager code=Parkspace_communicator::get_instance_pointer()->alloc_request(request,m_parcspace_alloc_response_msg);
     if(code!=SUCCESS)
         return code;
 
     if(m_parcspace_alloc_response_msg.error_manager().error_code()==0)
+    {
+        LOG(INFO)<<"分配车位成功,停车终端:"<<m_terminor_id
+            <<", 指令id:"<<m_command_id
+            <<", 车位楼层:"<<m_parcspace_alloc_response_msg.allocated_space_info().floor()
+            <<", 车位序号:"<<m_parcspace_alloc_response_msg.allocated_space_info().index()
+            <<", 车牌号:"<<m_parcspace_alloc_response_msg.allocated_space_info().car_info().license();
         return SUCCESS;
+    }
     else
         return Error_manager(FAILED,MINOR_ERROR,"parkspace alloc response error_code error");
 }
@@ -106,7 +119,7 @@ Error_manager StoreProcessTask::release_space_step()
     message::Base_info base_info;
     base_info.set_msg_type(message::eParkspace_release_request_msg);
     base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eTable);
+    base_info.set_receiver(message::eParkspace);
     base_info.set_timeout_ms(1000); //测量超时1s
     request.mutable_base_info()->CopyFrom(base_info);
 
@@ -121,32 +134,71 @@ Error_manager StoreProcessTask::release_space_step()
     if(code!=SUCCESS)
         return code;
 
-    if(release_response.error_manager().error_code()==0)
+    if(release_response.error_manager().error_code()==0) {
+        LOG(INFO)<<"停车流程异常,释放车位成功,停车终端:"<<m_terminor_id
+                 <<", 指令id:"<<m_command_id
+                 <<", 车位楼层:"<<m_parcspace_alloc_response_msg.allocated_space_info().floor()
+                 <<", 车位序号:"<<m_parcspace_alloc_response_msg.allocated_space_info().index()
+                 <<", 车牌号:"<<m_parcspace_alloc_response_msg.allocated_space_info().car_info().license();
         return SUCCESS;
+    }
     else
         return Error_manager(FAILED,MINOR_ERROR,"parkspace release response error_code error");
 }
 
 void StoreProcessTask::Main()
 {
+    /*
+     * 外部已经分配好车位,进入到此流程说明车位已经分配好, 存放在 m_parcspace_alloc_response_msg
+     */
     Error_manager code;
+    message::Process_store_statu store_statu;
     //开始执行停车指令
     //第一步测量
-    code=locate_step();
-    if(code!=SUCCESS)
+    switch (0)
     {
-        LOG(ERROR) << "terminor id: "<< m_terminor_id<<" , "<<code.to_string();
-        return;
+        //第一步,测量
+        case 0:
+        {
+            code=locate_step();
+            if(code!=SUCCESS)
+            {
+                LOG(INFO)<<"释放车位成功,停车终端:"<<m_terminor_id
+                         <<", 指令id:"<<m_command_id
+                         <<", 车位楼层:"<<m_parcspace_alloc_response_msg.allocated_space_info().floor()
+                         <<", 车位序号:"<<m_parcspace_alloc_response_msg.allocated_space_info().index()
+                         <<", 车牌号:"<<m_parcspace_alloc_response_msg.allocated_space_info().car_info().license();
+                break;
+            }
+        }
+        //第二步,调度
+        case 1:
+        {
+            //暂停 0.5-3.5s 代替
+            int delay=rand()%5000+10000;
+            usleep(1000*delay);
+            //调度失败,break,完成return
+            return ;
+        }
     }
+    /*
+     * switch 语句break,说明停车故障,需清除车位
+     */
+
+    message::Finish_store_statu finish_statu;
+    finish_statu.set_statu(message::eComplete);
+    store_statu.mutable_finish_statu()->CopyFrom(finish_statu);
+    Command_manager::get_instance_pointer()->updata_entrance_statu(m_command_id,store_statu);
 
-    //第二步分配车位
-    code=alloc_space_step();
+    //失败,清理车位
+    code=release_space_step();
     if(code!=SUCCESS)
     {
-        LOG(ERROR) << "terminor id: "<< m_terminor_id<<" , "<<code.to_string();
-        return;
+        LOG(ERROR)<<"致命故障,停车失败,清理车位故障:"<<code.to_string();
+        /*
+         * 此处应暂停系统,待管理员介入
+         */
     }
 
-    //执行动作
 
 }

+ 10 - 8
system/StoreProcessTask.h

@@ -13,8 +13,13 @@ class StoreProcessTask :public tq::BaseTask{
 public:
     StoreProcessTask();
     virtual  ~StoreProcessTask();
-    Error_manager init_task(unsigned int command_id, unsigned int terminor_id,std::string license);
+    Error_manager init_task(unsigned int command_id, unsigned int terminor_id,
+            message::Locate_information locate_info,message::Car_info car_info);
 
+    /*
+     * 分配车位
+     */
+    Error_manager alloc_space();
 protected:
     virtual void Main();
 
@@ -23,11 +28,6 @@ protected:
      */
     Error_manager locate_step();
 
-    /*
-     * 分配车位
-     */
-    Error_manager alloc_space_step();
-
    /*
     * 车位解锁,当停车失败时需要车位解锁
     */
@@ -36,11 +36,13 @@ protected:
 protected:
     unsigned int                m_command_id;
     unsigned int                m_terminor_id;
-    std::string                 m_license;          //当前流程的车辆标识(车牌号)
+    message::Car_info           m_car_info;          //当前流程的车辆标识(车牌号)
 
 
+    //停车请求发送过来的测量数据,终端位置的测量数据
+    message::Locate_information                     m_locate_info;
     //以下的流程中产生的数据
-    message::Measure_response_msg                   m_measure_response_msg;         //测量数据
+    message::Measure_response_msg                   m_measure_response_msg;         //测量模块的测量数据
     message::Parkspace_allocation_response_msg      m_parcspace_alloc_response_msg; //分配的车位数据
 
 public:

+ 0 - 5
system/TakeProcessTask.cpp

@@ -1,5 +0,0 @@
-//
-// Created by zx on 2020/7/7.
-//
-
-#include "TakeProcessTask.h"

+ 0 - 14
system/TakeProcessTask.h

@@ -1,14 +0,0 @@
-//
-// Created by zx on 2020/7/7.
-//
-
-#ifndef NNXX_TESTS_TAKEPROCESS_H
-#define NNXX_TESTS_TAKEPROCESS_H
-
-
-class TakeProcess {
-
-};
-
-
-#endif //NNXX_TESTS_TAKEPROCESS_H

+ 253 - 0
system/command_manager.cpp

@@ -0,0 +1,253 @@
+//
+// Created by zx on 2020/7/14.
+//
+
+#include "command_manager.h"
+#include "StoreProcessTask.h"
+#include "PickupProcessTask.h"
+#include "system_communicator.h"
+
+Command_manager::Command_manager()
+    :m_publish_statu_thread(nullptr)
+    ,m_thread_queue_process(nullptr)
+{
+
+}
+
+Command_manager::~Command_manager()
+{
+    //等待线程池完成
+    if(m_thread_queue_process!=nullptr) {
+        m_thread_queue_process->WaitForFinish();
+        m_thread_queue_process->Stop();
+    }
+
+    //退出线程
+    m_publish_exit_condition.set_pass_ever(true);
+    if(m_publish_statu_thread!= nullptr)
+    {
+        if(m_publish_statu_thread->joinable())
+        {
+            m_publish_statu_thread->join();
+        }
+        delete m_publish_statu_thread;
+        m_publish_statu_thread=nullptr;
+    }
+
+}
+
+Error_manager Command_manager::init()
+{
+    //创建线程池
+    if(m_thread_queue_process== nullptr)
+    {
+        m_thread_queue_process=tq::TQFactory::CreateDefaultQueue();
+        m_thread_queue_process->Start(12);
+    }
+
+    m_publish_exit_condition.reset(false, false, false);
+    ///创建状态发布线程
+    if(m_publish_statu_thread== nullptr)
+    {
+        m_publish_statu_thread=new std::thread(publish_thread_func,this);
+    }
+    return SUCCESS;
+}
+
+/*
+ * 执行停车请求
+ */
+Error_manager Command_manager::execute_store_command(message::Store_command_request_msg& request,message::Store_command_response_msg& response)
+{
+    if(m_publish_statu_thread==nullptr)
+    {
+        return Error_manager(ERROR,CRITICAL_ERROR,"线程池未初始化,bug");
+    }
+    if(request.base_info().msg_type()==message::eStore_command_request_msg
+       &&request.base_info().receiver()==message::eMain
+       &&request.base_info().sender()==message::eTerminor)
+    {
+        if(request.has_locate_information())
+        {
+            message::Locate_information locate_info=request.locate_information();
+            if(locate_info.has_locate_correct())
+            {
+                if(locate_info.locate_correct()==true)
+                {
+                    if(locate_info.has_locate_width()&&locate_info.has_locate_height()
+                       &&locate_info.has_locate_x()&&locate_info.has_locate_y()
+                       &&locate_info.has_locate_angle()&&locate_info.has_locate_wheel_base())
+                    {
+                        message::Base_info base_info;
+                        base_info.set_msg_type(message::eStore_command_response_msg);
+                        base_info.set_sender(message::eMain);
+                        base_info.set_receiver(message::eTerminor);
+                        response.mutable_base_info()->CopyFrom(base_info);
+                        response.set_terminal_id(request.terminal_id());
+
+                        message::Error_manager error_msg;
+                        error_msg.set_error_code(0);
+
+                        StoreProcessTask* task=new StoreProcessTask();
+                        int command_id=rand()%900000+100000;
+                        //初始化流程
+                        task->init_task(command_id,request.terminal_id(),locate_info,request.car_info());
+                        //获取车位
+                        Error_manager code=task->alloc_space();
+                        if(code==SUCCESS)
+                        {
+                            //清理当前状态
+                            /////
+                            std::lock_guard<std::mutex> lk(m_entrance_msg_lock);
+                            auto it=m_entrance_status.mutable_store_msg_map()->find(command_id);
+                            if(it!=m_entrance_status.mutable_store_msg_map()->end()) {
+                                it->second=message::Process_store_statu();
+                            }
+                            m_thread_queue_process->AddTask(task);
+                            response.mutable_code()->CopyFrom(error_msg);
+                            return SUCCESS;
+
+                        }
+                        error_msg.set_error_code(code.get_error_code());
+                        error_msg.set_error_description(code.to_string());
+                        response.mutable_code()->CopyFrom(error_msg);
+                        LOG(ERROR)<<"创建停车流程失败(车位分配失败),终端:"<<request.terminal_id()<<
+                                  "车牌:"<<request.car_info().license()<<"  "<<code.to_string();
+                        return code;
+
+                    }
+                }
+            }
+
+        }
+
+        return Error_manager(FAILED,MINOR_ERROR,"创建停车流程失败......");
+    }
+    else
+    {
+        return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"停车请求基本信息错误");
+    }
+}
+
+/*
+ * 执行取车请求
+ */
+Error_manager Command_manager::execute_pickup_command(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response)
+{
+    if(m_publish_statu_thread==nullptr)
+    {
+        return Error_manager(ERROR,CRITICAL_ERROR,"线程池未初始化,bug");
+    }
+    if(request.base_info().msg_type()==message::ePickup_command_request_msg
+       &&request.base_info().receiver()==message::eMain
+       &&request.base_info().sender()==message::eTerminor
+       &&request.has_car_info()) {
+
+        message::Base_info baseInfo;
+        baseInfo.set_msg_type(message::ePickup_command_response_msg);
+        baseInfo.set_sender(message::eMain);
+        baseInfo.set_receiver(message::eTerminor);
+        response.mutable_base_info()->CopyFrom(baseInfo);
+
+        Error_manager code;
+        PickupProcessTask *task = new PickupProcessTask();
+        int command_id = rand() % 900000 + 100000;
+        //初始化流程
+        task->init_task(command_id, request.terminal_id(), request.car_info());
+        /////查询车位
+        code=task->search_space();
+        message::Error_manager error_msg;
+        error_msg.set_error_code(0);
+        if(code==SUCCESS)
+        {
+            /////
+            std::lock_guard<std::mutex> lk(m_entrance_msg_lock);
+            auto it=m_entrance_status.mutable_pickup_msg_map()->find(command_id);
+            if(it!=m_entrance_status.mutable_pickup_msg_map()->end()) {
+                it->second=message::Process_pickup_statu();
+            }
+            m_thread_queue_process->AddTask(task);
+            response.mutable_code()->CopyFrom(error_msg);
+            return SUCCESS;
+        }
+        error_msg.set_error_code(code.get_error_code());
+        error_msg.set_error_description(code.to_string());
+        response.mutable_code()->CopyFrom(error_msg);
+        LOG(ERROR)<<"创建取车流程失败(车位查询失败),终端:"<<request.terminal_id()<<
+                  "车牌:"<<request.car_info().license()<<"  "<<code.to_string();
+        return code;
+    }
+    else
+    {
+        return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"停车请求信息错误");
+    }
+}
+
+/*
+     * 更新状态
+     */
+void Command_manager::updata_entrance_statu(int command_id,message::Process_store_statu& msg)
+{
+    if(command_id<0 || command_id>100)
+        return;
+    ///
+    std::lock_guard<std::mutex> lk(m_entrance_msg_lock);
+    auto it=m_entrance_status.mutable_store_msg_map()->find(command_id);
+    if(it==m_entrance_status.mutable_store_msg_map()->end())
+    {
+        m_entrance_status.mutable_store_msg_map()->insert(google::protobuf::MapPair<int,message::Process_store_statu>(command_id,msg));
+    }
+    else
+    {
+        it->second=msg;
+    }
+}
+void Command_manager::updata_entrance_statu(int command_id,message::Process_pickup_statu& msg)
+{
+    if(command_id<0 || command_id>100)
+        return;
+    ///
+    std::lock_guard<std::mutex> lk(m_entrance_msg_lock);
+    auto it=m_entrance_status.mutable_pickup_msg_map()->find(command_id);
+    if(it==m_entrance_status.mutable_pickup_msg_map()->end())
+    {
+        m_entrance_status.mutable_pickup_msg_map()->insert(google::protobuf::MapPair<int,message::Process_pickup_statu>(command_id,msg));
+    }
+    else
+    {
+        it->second=msg;
+    }
+}
+
+/*
+ * 发布状态线程
+ */
+void Command_manager::publish_thread_func(Command_manager* p_commander)
+{
+    if(p_commander)
+    {
+        p_commander->publish_status();
+    }
+}
+void Command_manager::publish_status()
+{
+    //未收到退出信号
+    while(false==m_publish_exit_condition.wait_for_ex(std::chrono::milliseconds(100)))
+    {
+        /*
+         * 通过communicator 发布状态
+         */
+        if(System_communicator::get_instance_pointer())
+        {
+            if(m_entrance_status.has_base_info()==false)
+            {
+                message::Base_info baseInfo;
+                baseInfo.set_msg_type(message::eEntrance_statu_msg);
+                baseInfo.set_sender(message::eMain);
+                baseInfo.set_receiver(message::eEmpty); //所有对象都可接收
+            }
+            System_communicator::get_instance_pointer()->send_entrance_statu(m_entrance_status);
+        }
+
+    }
+}

+ 63 - 0
system/command_manager.h

@@ -0,0 +1,63 @@
+//
+// Created by zx on 2020/7/14.
+//
+
+/*
+ * 指令管理, 包括指令的接收,指令的执行控制,指令的状态追踪,出入口状态
+ */
+#ifndef NNXX_TESTS_COMMAND_MANAGER_H
+#define NNXX_TESTS_COMMAND_MANAGER_H
+
+#include <error_code.h>
+#include <terminal_message.pb.h>
+#include <thread>
+#include <communication_message.h>
+#include "thread_condition.h"
+#include "singleton.h"
+#include "TaskQueue/TQFactory.h"
+#include "process_message.pb.h"
+
+class Command_manager :public Singleton<Command_manager>{
+    friend Singleton<Command_manager>;
+public:
+    ~Command_manager();
+
+    /*
+     * 初始化函数,创建线程池,创建状态广播线程,
+     */
+    Error_manager init();
+
+    /*
+     * 执行停车请求
+     */
+    Error_manager execute_store_command(message::Store_command_request_msg& request,message::Store_command_response_msg& response);
+
+    /*
+     * 执行取车请求
+     */
+    Error_manager execute_pickup_command(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response);
+
+    /*
+     * 更新状态
+     */
+    void updata_entrance_statu(int command_id,message::Process_store_statu& msg);
+    void updata_entrance_statu(int command_id,message::Process_pickup_statu& msg);
+private:
+    Command_manager();
+
+    static void publish_thread_func(Command_manager* p_commander);
+    void publish_status();
+
+protected:
+    std::thread*                    m_publish_statu_thread;             //广播状态线程
+    Thread_condition				m_publish_exit_condition;			//发送的条件变量
+
+    std::mutex                                                      m_entrance_msg_lock;
+    message::Entrance_statu_msg                                     m_entrance_status;                 //出入口状态
+
+
+    tq::IQueue*                     m_thread_queue_process;         //指令流程线程池
+};
+
+
+#endif //NNXX_TESTS_COMMAND_MANAGER_H

+ 57 - 6
system/system_communicator.cpp

@@ -3,10 +3,10 @@
 //
 
 #include "system_communicator.h"
+#include "command_manager.h"
 
 System_communicator::System_communicator()
 {
-
 }
 
 System_communicator::~System_communicator()
@@ -21,16 +21,19 @@ Error_manager System_communicator::encapsulate_send_data()
 	return Error_code::SUCCESS;
 }
 
+Error_manager System_communicator::send_entrance_statu(message::Entrance_statu_msg& msg)
+{
+    Communication_message message;
+    message.reset(msg.base_info(),msg.SerializeAsString());
+    return encapsulate_msg(&message);
+}
+
 /*
  * 发送消息函数
  */
 Error_manager System_communicator::encapsulate_msg(Communication_message* message)
 {
-    switch(message->get_message_type())
-    {
-        default:break;
-    }
-
+    return Communication_socket_base::encapsulate_msg(message);
 }
 
 /*
@@ -56,6 +59,54 @@ Error_manager System_communicator::execute_msg(Communication_message* p_msg)
     /*
      * 接收终端指令, 生成流程
      */
+    switch(p_msg->get_message_type())
+    {
+
+        case Communication_message::eStore_command_request_msg:
+        {
+            if(Command_manager::get_instance_pointer()!= nullptr)
+            {
+                message::Store_command_request_msg request;
+                if(request.ParseFromString(p_msg->get_message_buf())==false)
+                {
+                    //严重错误
+                    return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"停车请求消息解析失败");
+                }
+                message::Store_command_response_msg response;
+
+                Command_manager::get_instance_pointer()->execute_store_command(request,response);
+                Communication_message send_response;
+                send_response.reset(response.base_info(),response.SerializeAsString());
+                //发送反馈
+                encapsulate_msg(&send_response);
+
+            }
+            break;
+        }
+        case Communication_message::ePickup_command_request_msg:
+        {
+            if(Command_manager::get_instance_pointer()!= nullptr)
+            {
+                message::Pickup_command_request_msg request;
+                if(request.ParseFromString(p_msg->get_message_buf())==false)
+                {
+                    //严重错误
+                    return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"取车请求消息解析失败");
+                }
+                message::Pickup_command_response_msg response;
+                //调用请求回调,无需判断返回值,错误信息保存在response中
+                Command_manager::get_instance_pointer()->execute_pickup_command(request,response);
+                Communication_message send_response;
+                send_response.reset(response.base_info(),response.SerializeAsString());
+                //发送反馈
+                encapsulate_msg(&send_response);
+
+            }
+            break;
+        }
+        default:break;
+    }
+    return SUCCESS;
 }
 
 

+ 11 - 1
system/system_communicator.h

@@ -5,8 +5,13 @@
 #ifndef NNXX_TESTS_SYSTEM_COMMUNICATION_H
 #define NNXX_TESTS_SYSTEM_COMMUNICATION_H
 
+#include <process_message.pb.h>
 #include "../tool/singleton.h"
 #include "../communication/communication_socket_base.h"
+#include "terminal_message.pb.h"
+
+/*typedef Error_manager (*StoreCommandCallback)(message::Store_command_request_msg& msg,message::Store_command_response_msg& response);
+typedef Error_manager (*PickupCommandCallback)(message::Pickup_command_request_msg& msg,message::Pickup_command_response_msg& response);*/
 
 class System_communicator:public Singleton<System_communicator>, public Communication_socket_base
 {
@@ -19,6 +24,8 @@ public:
     //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
     System_communicator(const System_communicator& other) = delete;
     System_communicator& operator =(const System_communicator& other) = delete;
+
+    Error_manager send_entrance_statu(message::Entrance_statu_msg& msg);
     ~System_communicator();
 
 protected:
@@ -35,7 +42,10 @@ protected:
     virtual Error_manager encapsulate_send_data();
     //检查消息是否可以被解析, 需要重载
     virtual Error_manager check_executer(Communication_message* p_msg);
-    
+
+private:
+    /*StoreCommandCallback                mp_store_command_callback;              //收到停车请求回调函数
+    PickupCommandCallback               mp_pickup_command_callback;             //收到取车指令后的回调函数*/
 };
 
 

+ 1 - 3
test/Locate_client.cpp

@@ -43,7 +43,7 @@ int main()
                 message::Locate_information locate_info;
                 locate_info.set_locate_x(0.9);
                 locate_info.set_locate_y(2.25);
-                locate_info.set_locate_height(1.8);
+                locate_info.set_locate_height(1.5);
                 locate_info.set_locate_width(1.7);
                 locate_info.set_locate_length(4.5);
                 locate_info.set_locate_wheel_base(2.7);
@@ -62,8 +62,6 @@ int main()
             usleep(1000);
             std::this_thread::yield();
         }
-
-
     }
 
 }

+ 223 - 0
test/Terminal_communication.cpp

@@ -0,0 +1,223 @@
+//
+// Created by zx on 2020/7/13.
+//
+
+#include "Terminal_communication.h"
+#include "process_message.pb.h"
+
+Terminal_communication::Terminal_communication(){}
+Terminal_communication::~Terminal_communication(){}
+
+//重载函数
+Error_manager Terminal_communication::encapsulate_msg(Communication_message* message)
+{
+    Error_manager code;
+    switch (message->get_message_type())
+    {
+        case Communication_message::eStore_command_request_msg:
+        {
+            message::Store_command_request_msg request;
+            request.ParseFromString(message->get_message_buf());
+            //清空记录
+            m_store_response_msg=message::Store_command_response_msg();
+            //发送请求
+            code= Communication_socket_base::encapsulate_msg(message);
+            break;
+        }
+
+        case Communication_message::ePickup_command_request_msg:
+        {
+            message::Pickup_command_request_msg request;
+            request.ParseFromString(message->get_message_buf());
+            //清空记录
+            m_pickup_response_msg=message::Pickup_command_response_msg();
+            //发送请求
+            code= Communication_socket_base::encapsulate_msg(message);
+            break;
+        }
+
+        default:
+            code= Error_manager(ERROR,NEGLIGIBLE_ERROR,"terminal message table is not exist");
+    }
+    return code;
+}
+Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
+{
+
+    if(p_msg->get_message_type()==Communication_message::eStore_command_response_msg)
+    {
+        message::Store_command_response_msg response;
+        if(false==response.ParseFromString(p_msg->get_message_buf()))
+        {
+            return Error_manager(ERROR,CRITICAL_ERROR,"停车指令反馈信息解析错误");
+        }
+        message::Base_info base_info=response.base_info();
+        if(base_info.sender()==message::eMain && base_info.receiver()==message::eTerminor)
+        {
+            message::Error_manager error_code=response.code();
+            if(error_code.error_code()==0)
+            {
+                m_store_response_msg=response;
+                return SUCCESS;
+            }
+        }
+    }
+    return SUCCESS;
+
+    return Error_manager(FAILED,MINOR_ERROR,"terminal communication 未知消息");
+}
+/*
+ * 检测消息是否可被处理
+ */
+Error_manager Terminal_communication::check_msg(Communication_message* p_msg)
+{
+    return SUCCESS;
+}
+/*
+ * 心跳发送函数,重载
+ */
+Error_manager Terminal_communication::encapsulate_send_data()
+{
+    return SUCCESS;
+}
+//检查消息是否可以被解析, 需要重载
+Error_manager Terminal_communication::check_executer(Communication_message* p_msg)
+{
+    return SUCCESS;
+}
+
+/*
+    * 设置终端id
+    */
+Error_manager Terminal_communication::set_terminal_id(int id)
+{
+    if(id<0 || id>5)
+        return Error_manager(ERROR,CRITICAL_ERROR,"终端设置id不在范围");
+    m_terminal_id=id;
+    return SUCCESS;
+}
+
+/*
+    * 发送停车指令请求
+    */
+Error_manager Terminal_communication::store_request(message::Store_command_request_msg& request,message::Store_command_response_msg& response)
+{
+    if(m_statu!=eTerminal_ready)
+    {
+        return Error_manager(FAILED,MINOR_ERROR,"停车指令发送失败,终端不空闲");
+    }
+    if(request.has_locate_information()==false ||
+        request.has_car_info()==false)
+    {
+        return Error_manager(ERROR,CRITICAL_ERROR,"停车指令请求消息缺少必要信息");
+    }
+
+    Error_manager code;
+    Communication_message message;
+    message.reset(request.base_info(),request.SerializeAsString());
+    int timeout=1000;
+
+    code=encapsulate_msg(&message);
+    if(code!=SUCCESS)
+        return code;
+    m_statu=eTerminal_storing;
+    //循环查询请求是否被处理
+    auto start_time=std::chrono::system_clock::now();
+    double time=0;
+    do {
+        //查询到记录
+        ///查询是否存在,并且删除该记录,
+        //判断是否接收到回应,若回应信息被赋值则证明有回应
+        if (m_store_response_msg.has_base_info() && m_store_response_msg.has_code()) {
+            message::Base_info response_base = m_store_response_msg.base_info();
+            //检查类型是否匹配
+            if (response_base.msg_type() != message::eStore_command_response_msg) {
+                return Error_manager(ERROR, CRITICAL_ERROR,
+                                     "停车指令反馈消息 response msg type error");
+            }
+            //检查基本信息是否匹配
+            if (response_base.sender() != message::eMain ||
+                response_base.receiver() != message::eTerminor ) {
+                return Error_manager(PARKSPACE_RELEASE_RESPONSE_INFO_ERROR, MAJOR_ERROR,
+                                     "parkspace store response msg info error");
+            }
+            response=m_store_response_msg;
+            return SUCCESS;
+
+        }
+
+        auto end_time = std::chrono::system_clock::now();
+        auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
+        time = 1000.0 * double(duration.count()) * std::chrono::microseconds::period::num /
+               std::chrono::microseconds::period::den;
+        std::this_thread::yield();
+        usleep(1000);
+    }while(time<double(timeout));
+    //超时,删除记录,返回错误
+    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace store request timeout");
+
+}
+
+/*
+ * 发送取车指令请求
+ */
+Error_manager Terminal_communication::pickup_request(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response)
+{
+    if(m_statu!=eTerminal_ready)
+    {
+        return Error_manager(FAILED,MINOR_ERROR,"取车指令发送失败,终端不空闲");
+    }
+
+
+    if(request.has_car_info()==false)
+    {
+        return Error_manager(ERROR,CRITICAL_ERROR,"取车指令请求消息缺少车辆信息");
+    }
+
+
+    Error_manager code;
+    Communication_message message;
+    message.reset(request.base_info(),request.SerializeAsString());
+    int timeout=1000;
+
+    code=encapsulate_msg(&message);
+    if(code!=SUCCESS)
+        return code;
+
+   // m_statu=eTerminal_picking;
+    //循环查询请求是否被处理
+    auto start_time=std::chrono::system_clock::now();
+    double time=0;
+    do {
+        //查询到记录
+        ///查询是否存在,并且删除该记录,
+        //判断是否接收到回应,若回应信息被赋值则证明有回应
+        if (m_pickup_response_msg.has_base_info() && m_pickup_response_msg.has_code()) {
+            message::Base_info response_base = m_pickup_response_msg.base_info();
+            //检查类型是否匹配
+            if (response_base.msg_type() != message::ePickup_command_response_msg) {
+                return Error_manager(ERROR, CRITICAL_ERROR,
+                                     "停车指令反馈消息 response msg type error");
+            }
+            //检查基本信息是否匹配
+            if (response_base.sender() != message::eMain ||
+                response_base.receiver() != message::eTerminor ) {
+                return Error_manager(PARKSPACE_RELEASE_RESPONSE_INFO_ERROR, MAJOR_ERROR,
+                                     "parkspace release response msg info error");
+            }
+            response=m_pickup_response_msg;
+            return SUCCESS;
+
+        }
+
+        auto end_time = std::chrono::system_clock::now();
+        auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
+        time = 1000.0 * double(duration.count()) * std::chrono::microseconds::period::num /
+               std::chrono::microseconds::period::den;
+        std::this_thread::yield();
+        usleep(1000);
+    }while(time<double(timeout));
+    //超时,删除记录,返回错误
+    return Error_manager(RESPONSE_TIMEOUT,MINOR_ERROR,"parkspace release request timeout");
+
+}

+ 69 - 0
test/Terminal_communication.h

@@ -0,0 +1,69 @@
+//
+// Created by zx on 2020/7/13.
+//
+
+#ifndef NNXX_TESTS_TERMINAL_COMMUNICATION_H
+#define NNXX_TESTS_TERMINAL_COMMUNICATION_H
+#include "../tool/singleton.h"
+#include "../communication/communication_socket_base.h"
+#include "terminal_message.pb.h"
+#include "message_compare.h"
+
+class Terminal_communication :public Singleton<Terminal_communication>, public Communication_socket_base{
+    enum Terminal_statu
+    {
+        eTerminal_ready=0,
+        eTerminal_storing,
+        eTerminal_picking,
+    };
+
+    friend class Singleton<Terminal_communication>;
+private:
+    // 父类的构造函数必须保护,子类的构造函数必须私有。
+    Terminal_communication();
+public:
+    //必须关闭拷贝构造和赋值构造,只能通过 get_instance 函数来进行操作唯一的实例。
+    Terminal_communication(const Terminal_communication& other) = delete;
+    Terminal_communication& operator =(const Terminal_communication& other) = delete;
+
+    ~Terminal_communication();
+    /*
+     * 设置终端id
+     */
+    Error_manager set_terminal_id(int id);
+    /*
+     * 发送停车指令请求
+     */
+    Error_manager store_request(message::Store_command_request_msg& request,message::Store_command_response_msg& response);
+
+    /*
+     * 发送取车指令请求
+     */
+    Error_manager pickup_request(message::Pickup_command_request_msg& request,message::Pickup_command_response_msg& response);
+
+protected:
+    //重载函数
+    virtual Error_manager encapsulate_msg(Communication_message* message);
+    virtual Error_manager execute_msg(Communication_message* p_msg);
+    /*
+     * 检测消息是否可被处理
+     */
+    virtual Error_manager check_msg(Communication_message* p_msg);
+    /*
+     * 心跳发送函数,重载
+     */
+    virtual Error_manager encapsulate_send_data();
+    //检查消息是否可以被解析, 需要重载
+    virtual Error_manager check_executer(Communication_message* p_msg);
+
+private:
+    Terminal_statu                                  m_statu;
+    message::Store_command_response_msg             m_store_response_msg;
+    message::Pickup_command_response_msg            m_pickup_response_msg;
+    int                                             m_terminal_id;
+
+
+};
+
+
+#endif //NNXX_TESTS_TERMINAL_COMMUNICATION_H

+ 113 - 0
test/terminal_client.cpp

@@ -0,0 +1,113 @@
+//
+// Created by zx on 2020/7/10.
+//
+
+//
+// Created by zx on 2020/7/3.
+//
+#include <unistd.h>
+#include <iostream>
+#include <nnxx/message>
+#include <nnxx/socket.h>
+#include <nnxx/bus.h>
+
+#include "terminal_message.pb.h"
+#include <thread>
+#include "threadSafeQueue.h"
+
+std::mutex lock;
+
+threadsafe_queue<std::string> license_queue;
+#include "Terminal_communication.h"
+
+void pickup()
+{
+    message::Base_info base_msg;
+    message::Pickup_command_request_msg request;
+
+    base_msg.set_msg_type(message::ePickup_command_request_msg);
+    base_msg.set_sender(message::eTerminor);
+    base_msg.set_receiver(message::eMain);
+    request.mutable_base_info()->CopyFrom(base_msg);
+
+    int command_id = rand() % 900000 + 100000;
+    char license[255] = {0};
+    sprintf(license, "鄂A%d", command_id);
+
+    request.set_terminal_id(command_id % 6);
+    message::Car_info car_info;
+    car_info.set_license(license);
+    car_info.set_car_height(1.5);
+    car_info.set_car_width(1.7);
+    request.mutable_car_info()->CopyFrom(car_info);
+
+    message::Pickup_command_response_msg response;
+    Error_manager code=Terminal_communication::get_instance_pointer()->pickup_request(request,response);
+    if(code!=SUCCESS)
+    {
+        std::cout<<code.to_string()<<std::endl;
+    }
+    else
+    {
+        if(response.code().error_code()!=0)
+        {
+            std::cout<<response.code().error_description()<<std::endl;
+        }
+    }
+
+}
+
+int main() {
+    Terminal_communication::get_instance_pointer()->communication_connect("tcp://127.0.0.1:9001");
+    Terminal_communication::get_instance_pointer()->communication_run();
+
+    int n = 0;
+    bool run = true;
+    Error_manager code;
+    //std::thread* pth=new std::thread(cancel_thread);
+    while (run) {
+        pickup();
+        /*message::Base_info base_msg;
+        message::Store_command_request_msg request;
+
+        base_msg.set_msg_type(message::eStore_command_request_msg);
+        base_msg.set_sender(message::eTerminor);
+        base_msg.set_receiver(message::eMain);
+        request.mutable_base_info()->CopyFrom(base_msg);
+
+        int command_id = rand() % 900000 + 100000;
+        char license[255] = {0};
+        sprintf(license, "鄂A%d", command_id);
+
+        request.set_terminal_id(command_id % 6);
+        message::Car_info car_info;
+        car_info.set_license(license);
+        car_info.set_car_height(1.5);
+        car_info.set_car_width(1.7);
+        request.mutable_car_info()->CopyFrom(car_info);
+        message::Locate_information locate_info;
+        locate_info.set_locate_x(0.9);
+        locate_info.set_locate_y(2.25);
+        locate_info.set_locate_angle(90.0);
+        locate_info.set_locate_wheel_base(2.7);
+        locate_info.set_locate_width(1.7);
+        locate_info.set_locate_height(1.5);
+        locate_info.set_locate_correct(true);
+        request.mutable_locate_information()->CopyFrom(locate_info);
+
+        message::Store_command_response_msg response;
+        code=Terminal_communication::get_instance_pointer()->store_request(request,response);
+        if(code!=SUCCESS)
+        {
+            std::cout<<code.to_string()<<std::endl;
+        }
+        else
+        {
+            printf("N:%08d\n",n++);
+        }*/
+        //每两秒发送一次
+        usleep(1000*1000);
+        std::this_thread::yield();
+    }
+}
+

+ 1 - 1
test/test_locate_sample.cpp

@@ -2,7 +2,7 @@
 // Created by zx on 2020/7/3.
 //
 #include <iostream>
-#include "../lidar_locate/Locate_communicator.h";
+#include "../lidar_locate/Locate_communicator.h"
 #include <unistd.h>
 #include "../tool/thread_safe_list.h"
 int main(int argc,char* argv[])