浏览代码

修改初始化车位管理模块等待的问题

zx 4 年之前
父节点
当前提交
1f0c58dbf4

+ 44 - 7
dispatch/dispatch_communicator.cpp

@@ -96,21 +96,25 @@ Error_manager Dispatch_communicator::cancel_request(message::Dispatch_request_ms
     }
     return SUCCESS;
 }
-Error_manager Dispatch_communicator::check_statu(int terminal_id)
+
+
+Error_manager Dispatch_communicator::check_entrance_statu(int terminal_id)
 {
+    if(m_storing_dispatch_statu_msg_map.find(terminal_id)==false || m_storing_dispatch_statu_time_map.find(terminal_id)==false)
+        return Error_manager(FAILED,MINOR_ERROR,"停车口调度模块状态未找到");
 
     std::chrono::system_clock::time_point time_now=std::chrono::system_clock::now();
-    auto durantion=time_now-m_dispatch_statu_time;
-    if(m_dispatch_statu_msg.has_base_info()== false
+    auto durantion=time_now-m_storing_dispatch_statu_time_map[terminal_id];
+    if(m_storing_dispatch_statu_msg_map[terminal_id].has_base_info()== false
        || durantion>std::chrono::seconds(5))
     {
         return Error_manager(ERROR,MINOR_ERROR,"调度节点通讯断开");
     }
-    if(m_dispatch_statu_msg.dispatch_manager_status()==message::E_DISPATCH_MANAGER_FAULT)
+    if(m_storing_dispatch_statu_msg_map[terminal_id].dispatch_manager_status()==message::E_DISPATCH_MANAGER_FAULT)
     {
         return Error_manager(ERROR,MINOR_ERROR,"调度节点故障");
     }
-    if(m_dispatch_statu_msg.dispatch_manager_status()==message::E_DISPATCH_MANAGER_UNKNOW)
+    if(m_storing_dispatch_statu_msg_map[terminal_id].dispatch_manager_status()==message::E_DISPATCH_MANAGER_UNKNOW)
     {
         return Error_manager(ERROR,MINOR_ERROR,"调度节点状态未知");
     }
@@ -119,6 +123,29 @@ Error_manager Dispatch_communicator::check_statu(int terminal_id)
 
 }
 
+Error_manager Dispatch_communicator::check_export_statu(int terminal_id)
+{
+    if(m_picking_dispatch_statu_msg_map.find(terminal_id)==false || m_picking_dispatch_statu_time_map.find(terminal_id)==false)
+        return Error_manager(FAILED,MINOR_ERROR,"停车口调度模块状态未找到");
+
+    std::chrono::system_clock::time_point time_now=std::chrono::system_clock::now();
+    auto durantion=time_now-m_picking_dispatch_statu_time_map[terminal_id];
+    if(m_picking_dispatch_statu_msg_map[terminal_id].has_base_info()== false
+       || durantion>std::chrono::seconds(5))
+    {
+        return Error_manager(ERROR,MINOR_ERROR,"调度节点通讯断开");
+    }
+    if(m_picking_dispatch_statu_msg_map[terminal_id].dispatch_manager_status()==message::E_DISPATCH_MANAGER_FAULT)
+    {
+        return Error_manager(ERROR,MINOR_ERROR,"调度节点故障");
+    }
+    if(m_picking_dispatch_statu_msg_map[terminal_id].dispatch_manager_status()==message::E_DISPATCH_MANAGER_UNKNOW)
+    {
+        return Error_manager(ERROR,MINOR_ERROR,"调度节点状态未知");
+    }
+
+    return SUCCESS;
+}
 
 Dispatch_communicator::Dispatch_communicator()
 {
@@ -177,11 +204,21 @@ Error_manager Dispatch_communicator::execute_msg(Communication_message* p_msg)
             ///测量系统状态
         case Communication_message::eDispatch_status_msg:
         {
-            if(m_dispatch_statu_msg.ParseFromString(p_msg->get_message_buf())==false)
+            message::Dispatch_status_msg statu_msg;
+            if(statu_msg.ParseFromString(p_msg->get_message_buf())==false)
             {
                 return Error_manager(ERROR,CRITICAL_ERROR,"调度模块状态消息解析失败");
             }
-            m_dispatch_statu_time=std::chrono::system_clock::now();
+            if(statu_msg.dispatch_motion_direction()==message::E_STORE_CAR)
+            {
+                m_storing_dispatch_statu_msg_map[statu_msg.terminal_id()]=statu_msg;
+                m_storing_dispatch_statu_time_map[statu_msg.terminal_id()]=std::chrono::system_clock::now();
+            }
+            if(statu_msg.dispatch_motion_direction()==message::E_PICKUP_CAR)
+            {
+                m_picking_dispatch_statu_msg_map[statu_msg.terminal_id()]=statu_msg;
+                m_picking_dispatch_statu_time_map[statu_msg.terminal_id()]=std::chrono::system_clock::now();
+            }
             break;
         }
     }

+ 12 - 4
dispatch/dispatch_communicator.h

@@ -26,7 +26,11 @@ public:
      * 提前取消请求
      */
     Error_manager cancel_request(message::Dispatch_request_msg& request);
-    Error_manager check_statu(int terminal_id);
+
+    //检查停车入口 调度节点状态
+    Error_manager check_entrance_statu(int terminal_id);
+    //检查取车出口 调度节点状态
+    Error_manager check_export_statu(int terminal_id);
 
 
 protected:
@@ -52,9 +56,13 @@ protected:
 private:
     thread_safe_map<message::Dispatch_request_msg,message::Dispatch_response_msg>          m_response_table;
 
-    //调度模块状态
-    message::Dispatch_status_msg                                                            m_dispatch_statu_msg;
-    std::chrono::system_clock::time_point                                                   m_dispatch_statu_time;
+    //停车调度模块状态
+    thread_safe_map<int,message::Dispatch_status_msg>                     m_storing_dispatch_statu_msg_map;
+    thread_safe_map<int,std::chrono::system_clock::time_point>            m_storing_dispatch_statu_time_map;
+
+    //取车调度模块状态
+    thread_safe_map<int,message::Dispatch_status_msg>                     m_picking_dispatch_statu_msg_map;
+    thread_safe_map<int,std::chrono::system_clock::time_point>            m_picking_dispatch_statu_time_map;
 };
 
 

+ 12 - 7
lidar_locate/Locate_communicator.cpp

@@ -122,20 +122,23 @@ Error_manager Locate_communicator::check_executer(Communication_message* p_msg)
 
 Error_manager Locate_communicator::check_statu(int terminal_id)
 {
+    if(m_measure_statu_msg_map.find(terminal_id)==false || m_statu_recv_time_map.find(terminal_id)==false)
+        return Error_manager(FAILED,MINOR_ERROR,"测量节点状态不存在");
+
     std::chrono::system_clock::time_point time_now=std::chrono::system_clock::now();
-    auto durantion=time_now-m_statu_recv_time;
-    if(m_measure_statu_msg.has_base_info()== false
+    auto durantion=time_now-m_statu_recv_time_map[terminal_id];
+    if(m_measure_statu_msg_map[terminal_id].has_base_info()== false
         || durantion>std::chrono::seconds(5))
     {
         return Error_manager(ERROR,MINOR_ERROR,"测量节点通讯断开");
     }
-    if(m_measure_statu_msg.laser_manager_status()==message::LASER_MANAGER_FAULT)
+    if(m_measure_statu_msg_map[terminal_id].laser_manager_status()==message::LASER_MANAGER_FAULT)
     {
         return Error_manager(ERROR,MINOR_ERROR,"测量模块扫描控制故障");
     }
-    for(int i=0;i<m_measure_statu_msg.laser_statu_vector_size();++i)
+    for(int i=0;i<m_measure_statu_msg_map[terminal_id].laser_statu_vector_size();++i)
     {
-        message::Laser_statu laser_statu=m_measure_statu_msg.laser_statu_vector(i);
+        message::Laser_statu laser_statu=m_measure_statu_msg_map[terminal_id].laser_statu_vector(i);
         if(laser_statu==message::LASER_FAULT || laser_statu==message::LASER_DISCONNECT)
         {
             return Error_manager(ERROR,MINOR_ERROR,"测量模块雷达故障或者断线");
@@ -192,9 +195,11 @@ Error_manager Locate_communicator::execute_msg(Communication_message* p_msg)
         ///测量系统状态
         case Communication_message::eLocate_status_msg:
         {
-            if(m_measure_statu_msg.ParseFromString(p_msg->get_message_buf())==false)
+            message::Measure_status_msg statu_msg;
+            if(statu_msg.ParseFromString(p_msg->get_message_buf())==false)
                 return Error_manager(ERROR,CRITICAL_ERROR,"measure statu msg parse failed, CRITICAL_ERROR");
-            m_statu_recv_time=std::chrono::system_clock::now();
+            m_measure_statu_msg_map[statu_msg.terminal_id()]=statu_msg;
+            m_statu_recv_time_map[statu_msg.terminal_id()]=std::chrono::system_clock::now();
             break;
         }
     }

+ 2 - 2
lidar_locate/Locate_communicator.h

@@ -61,8 +61,8 @@ protected:
     thread_safe_map<message::Measure_request_msg,message::Measure_response_msg>          m_response_table;
 
 
-    message::Measure_status_msg                                       m_measure_statu_msg;
-    std::chrono::system_clock::time_point		                    m_statu_recv_time;
+    thread_safe_map<int ,message::Measure_status_msg >                                        m_measure_statu_msg_map;
+    thread_safe_map<int ,std::chrono::system_clock::time_point>		                            m_statu_recv_time_map;
 };
 
 

+ 0 - 2
main.cpp

@@ -50,8 +50,6 @@ Error_manager init_communicators()
         return Error_manager(COMMUNICATION_READ_PROTOBUF_ERROR,MINOR_ERROR,
                              "Communication_socket_base read_proto_param  failed");
     }
-
-    std::cout<<system_setting.DebugString()<<std::endl;
     ///初始化与终端通讯的对象
     if(System_communicator::get_instance_pointer()== nullptr)
         return FAILED;

+ 87 - 36
message/dispatch_message.pb.cc

@@ -156,9 +156,11 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_status_msg, base_info_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_status_msg, terminal_id_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_status_msg, dispatch_manager_status_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_status_msg, dispatch_motion_direction_),
   0,
   1,
   2,
+  3,
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_request_msg, _has_bits_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Dispatch_request_msg, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -190,9 +192,9 @@ const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUT
 };
 static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   { 0, 8, sizeof(::message::Carrier_position)},
-  { 11, 19, sizeof(::message::Dispatch_status_msg)},
-  { 22, 33, sizeof(::message::Dispatch_request_msg)},
-  { 39, 47, sizeof(::message::Dispatch_response_msg)},
+  { 11, 20, sizeof(::message::Dispatch_status_msg)},
+  { 24, 35, sizeof(::message::Dispatch_request_msg)},
+  { 41, 49, sizeof(::message::Dispatch_response_msg)},
 };
 
 static ::google::protobuf::Message const * const file_default_instances[] = {
@@ -226,34 +228,36 @@ void AddDescriptorsImpl() {
   static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
       "\n\026dispatch_message.proto\022\007message\032\022messa"
       "ge_base.proto\"3\n\020Carrier_position\022\t\n\001x\030\001"
-      " \002(\002\022\t\n\001y\030\002 \002(\002\022\t\n\001z\030\003 \002(\002\"\224\001\n\023Dispatch_"
+      " \002(\002\022\t\n\001y\030\002 \002(\002\022\t\n\001z\030\003 \002(\002\"\333\001\n\023Dispatch_"
       "status_msg\022%\n\tbase_info\030\001 \002(\0132\022.message."
       "Base_info\022\023\n\013terminal_id\030\002 \002(\005\022A\n\027dispat"
       "ch_manager_status\030\003 \002(\0162 .message.Dispat"
-      "ch_manager_status\"\225\002\n\024Dispatch_request_m"
-      "sg\022%\n\tbase_info\030\001 \002(\0132\022.message.Base_inf"
-      "o\022+\n\014command_info\030\002 \002(\0132\025.message.Comman"
-      "d_info\022E\n\031dispatch_motion_direction\030\003 \002("
-      "\0162\".message.Dispatch_motion_direction\022\023\n"
-      "\013terminal_id\030\004 \002(\005\022\024\n\014parkspace_id\030\005 \002(\005"
-      "\0227\n\022locate_information\030\006 \001(\0132\033.message.L"
-      "ocate_information\"\232\001\n\025Dispatch_response_"
-      "msg\022%\n\tbase_info\030\001 \002(\0132\022.message.Base_in"
-      "fo\022+\n\014command_info\030\002 \002(\0132\025.message.Comma"
-      "nd_info\022-\n\rerror_manager\030\003 \002(\0132\026.message"
-      ".Error_manager*\261\001\n\027Dispatch_manager_stat"
-      "us\022\035\n\031E_DISPATCH_MANAGER_UNKNOW\020\000\022\034\n\030E_D"
-      "ISPATCH_MANAGER_READY\020\001\022\034\n\030E_DISPATCH_MA"
-      "NAGER_STORE\020\002\022\035\n\031E_DISPATCH_MANAGER_PICK"
-      "UP\020\003\022\034\n\030E_DISPATCH_MANAGER_FAULT\020\n*{\n\016Ca"
-      "rrier_status\022\024\n\020E_CARRIER_UNKNOW\020\000\022\023\n\017E_"
-      "CARRIER_READY\020\001\022\023\n\017E_CARRIER_STORE\020\002\022\024\n\020"
-      "E_CARRIER_PICKUP\020\003\022\023\n\017E_CARRIER_FAULT\020\n*"
-      ">\n\031Dispatch_motion_direction\022\017\n\013E_STORE_"
-      "CAR\020\000\022\020\n\014E_PICKUP_CAR\020\001"
+      "ch_manager_status\022E\n\031dispatch_motion_dir"
+      "ection\030\004 \002(\0162\".message.Dispatch_motion_d"
+      "irection\"\225\002\n\024Dispatch_request_msg\022%\n\tbas"
+      "e_info\030\001 \002(\0132\022.message.Base_info\022+\n\014comm"
+      "and_info\030\002 \002(\0132\025.message.Command_info\022E\n"
+      "\031dispatch_motion_direction\030\003 \002(\0162\".messa"
+      "ge.Dispatch_motion_direction\022\023\n\013terminal"
+      "_id\030\004 \002(\005\022\024\n\014parkspace_id\030\005 \002(\005\0227\n\022locat"
+      "e_information\030\006 \001(\0132\033.message.Locate_inf"
+      "ormation\"\232\001\n\025Dispatch_response_msg\022%\n\tba"
+      "se_info\030\001 \002(\0132\022.message.Base_info\022+\n\014com"
+      "mand_info\030\002 \002(\0132\025.message.Command_info\022-"
+      "\n\rerror_manager\030\003 \002(\0132\026.message.Error_ma"
+      "nager*\261\001\n\027Dispatch_manager_status\022\035\n\031E_D"
+      "ISPATCH_MANAGER_UNKNOW\020\000\022\034\n\030E_DISPATCH_M"
+      "ANAGER_READY\020\001\022\034\n\030E_DISPATCH_MANAGER_STO"
+      "RE\020\002\022\035\n\031E_DISPATCH_MANAGER_PICKUP\020\003\022\034\n\030E"
+      "_DISPATCH_MANAGER_FAULT\020\n*{\n\016Carrier_sta"
+      "tus\022\024\n\020E_CARRIER_UNKNOW\020\000\022\023\n\017E_CARRIER_R"
+      "EADY\020\001\022\023\n\017E_CARRIER_STORE\020\002\022\024\n\020E_CARRIER"
+      "_PICKUP\020\003\022\023\n\017E_CARRIER_FAULT\020\n*>\n\031Dispat"
+      "ch_motion_direction\022\017\n\013E_STORE_CAR\020\000\022\020\n\014"
+      "E_PICKUP_CAR\020\001"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 1063);
+      descriptor, 1134);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "dispatch_message.proto", &protobuf_RegisterTypes);
   ::protobuf_message_5fbase_2eproto::AddDescriptors();
@@ -676,6 +680,7 @@ void Dispatch_status_msg::clear_base_info() {
 const int Dispatch_status_msg::kBaseInfoFieldNumber;
 const int Dispatch_status_msg::kTerminalIdFieldNumber;
 const int Dispatch_status_msg::kDispatchManagerStatusFieldNumber;
+const int Dispatch_status_msg::kDispatchMotionDirectionFieldNumber;
 #endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
 
 Dispatch_status_msg::Dispatch_status_msg()
@@ -698,16 +703,16 @@ Dispatch_status_msg::Dispatch_status_msg(const Dispatch_status_msg& from)
     base_info_ = NULL;
   }
   ::memcpy(&terminal_id_, &from.terminal_id_,
-    static_cast<size_t>(reinterpret_cast<char*>(&dispatch_manager_status_) -
-    reinterpret_cast<char*>(&terminal_id_)) + sizeof(dispatch_manager_status_));
+    static_cast<size_t>(reinterpret_cast<char*>(&dispatch_motion_direction_) -
+    reinterpret_cast<char*>(&terminal_id_)) + sizeof(dispatch_motion_direction_));
   // @@protoc_insertion_point(copy_constructor:message.Dispatch_status_msg)
 }
 
 void Dispatch_status_msg::SharedCtor() {
   _cached_size_ = 0;
   ::memset(&base_info_, 0, static_cast<size_t>(
-      reinterpret_cast<char*>(&dispatch_manager_status_) -
-      reinterpret_cast<char*>(&base_info_)) + sizeof(dispatch_manager_status_));
+      reinterpret_cast<char*>(&dispatch_motion_direction_) -
+      reinterpret_cast<char*>(&base_info_)) + sizeof(dispatch_motion_direction_));
 }
 
 Dispatch_status_msg::~Dispatch_status_msg() {
@@ -753,10 +758,10 @@ void Dispatch_status_msg::Clear() {
     GOOGLE_DCHECK(base_info_ != NULL);
     base_info_->Clear();
   }
-  if (cached_has_bits & 6u) {
+  if (cached_has_bits & 14u) {
     ::memset(&terminal_id_, 0, static_cast<size_t>(
-        reinterpret_cast<char*>(&dispatch_manager_status_) -
-        reinterpret_cast<char*>(&terminal_id_)) + sizeof(dispatch_manager_status_));
+        reinterpret_cast<char*>(&dispatch_motion_direction_) -
+        reinterpret_cast<char*>(&terminal_id_)) + sizeof(dispatch_motion_direction_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -818,6 +823,26 @@ bool Dispatch_status_msg::MergePartialFromCodedStream(
         break;
       }
 
+      // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::message::Dispatch_motion_direction_IsValid(value)) {
+            set_dispatch_motion_direction(static_cast< ::message::Dispatch_motion_direction >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(
+                4, static_cast< ::google::protobuf::uint64>(value));
+          }
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
       default: {
       handle_unusual:
         if (tag == 0) {
@@ -862,6 +887,12 @@ void Dispatch_status_msg::SerializeWithCachedSizes(
       3, this->dispatch_manager_status(), output);
   }
 
+  // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+  if (cached_has_bits & 0x00000008u) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      4, this->dispatch_motion_direction(), output);
+  }
+
   if (_internal_metadata_.have_unknown_fields()) {
     ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
         _internal_metadata_.unknown_fields(), output);
@@ -895,6 +926,12 @@ void Dispatch_status_msg::SerializeWithCachedSizes(
       3, this->dispatch_manager_status(), target);
   }
 
+  // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+  if (cached_has_bits & 0x00000008u) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      4, this->dispatch_motion_direction(), target);
+  }
+
   if (_internal_metadata_.have_unknown_fields()) {
     target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
         _internal_metadata_.unknown_fields(), target);
@@ -927,6 +964,12 @@ size_t Dispatch_status_msg::RequiredFieldsByteSizeFallback() const {
       ::google::protobuf::internal::WireFormatLite::EnumSize(this->dispatch_manager_status());
   }
 
+  if (has_dispatch_motion_direction()) {
+    // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->dispatch_motion_direction());
+  }
+
   return total_size;
 }
 size_t Dispatch_status_msg::ByteSizeLong() const {
@@ -938,7 +981,7 @@ size_t Dispatch_status_msg::ByteSizeLong() const {
       ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
         _internal_metadata_.unknown_fields());
   }
-  if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) {  // All required fields are present.
+  if (((_has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) {  // All required fields are present.
     // required .message.Base_info base_info = 1;
     total_size += 1 +
       ::google::protobuf::internal::WireFormatLite::MessageSize(
@@ -953,6 +996,10 @@ size_t Dispatch_status_msg::ByteSizeLong() const {
     total_size += 1 +
       ::google::protobuf::internal::WireFormatLite::EnumSize(this->dispatch_manager_status());
 
+    // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->dispatch_motion_direction());
+
   } else {
     total_size += RequiredFieldsByteSizeFallback();
   }
@@ -986,7 +1033,7 @@ void Dispatch_status_msg::MergeFrom(const Dispatch_status_msg& from) {
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
-  if (cached_has_bits & 7u) {
+  if (cached_has_bits & 15u) {
     if (cached_has_bits & 0x00000001u) {
       mutable_base_info()->::message::Base_info::MergeFrom(from.base_info());
     }
@@ -996,6 +1043,9 @@ void Dispatch_status_msg::MergeFrom(const Dispatch_status_msg& from) {
     if (cached_has_bits & 0x00000004u) {
       dispatch_manager_status_ = from.dispatch_manager_status_;
     }
+    if (cached_has_bits & 0x00000008u) {
+      dispatch_motion_direction_ = from.dispatch_motion_direction_;
+    }
     _has_bits_[0] |= cached_has_bits;
   }
 }
@@ -1015,7 +1065,7 @@ void Dispatch_status_msg::CopyFrom(const Dispatch_status_msg& from) {
 }
 
 bool Dispatch_status_msg::IsInitialized() const {
-  if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;
+  if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false;
   if (has_base_info()) {
     if (!this->base_info_->IsInitialized()) return false;
   }
@@ -1031,6 +1081,7 @@ void Dispatch_status_msg::InternalSwap(Dispatch_status_msg* other) {
   swap(base_info_, other->base_info_);
   swap(terminal_id_, other->terminal_id_);
   swap(dispatch_manager_status_, other->dispatch_manager_status_);
+  swap(dispatch_motion_direction_, other->dispatch_motion_direction_);
   swap(_has_bits_[0], other->_has_bits_[0]);
   _internal_metadata_.Swap(&other->_internal_metadata_);
   swap(_cached_size_, other->_cached_size_);

+ 35 - 0
message/dispatch_message.pb.h

@@ -385,6 +385,13 @@ class Dispatch_status_msg : public ::google::protobuf::Message /* @@protoc_inser
   ::message::Dispatch_manager_status dispatch_manager_status() const;
   void set_dispatch_manager_status(::message::Dispatch_manager_status value);
 
+  // required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+  bool has_dispatch_motion_direction() const;
+  void clear_dispatch_motion_direction();
+  static const int kDispatchMotionDirectionFieldNumber = 4;
+  ::message::Dispatch_motion_direction dispatch_motion_direction() const;
+  void set_dispatch_motion_direction(::message::Dispatch_motion_direction value);
+
   // @@protoc_insertion_point(class_scope:message.Dispatch_status_msg)
  private:
   void set_has_base_info();
@@ -393,6 +400,8 @@ class Dispatch_status_msg : public ::google::protobuf::Message /* @@protoc_inser
   void clear_has_terminal_id();
   void set_has_dispatch_manager_status();
   void clear_has_dispatch_manager_status();
+  void set_has_dispatch_motion_direction();
+  void clear_has_dispatch_motion_direction();
 
   // helper for ByteSizeLong()
   size_t RequiredFieldsByteSizeFallback() const;
@@ -403,6 +412,7 @@ class Dispatch_status_msg : public ::google::protobuf::Message /* @@protoc_inser
   ::message::Base_info* base_info_;
   ::google::protobuf::int32 terminal_id_;
   int dispatch_manager_status_;
+  int dispatch_motion_direction_;
   friend struct ::protobuf_dispatch_5fmessage_2eproto::TableStruct;
   friend void ::protobuf_dispatch_5fmessage_2eproto::InitDefaultsDispatch_status_msgImpl();
 };
@@ -900,6 +910,31 @@ inline void Dispatch_status_msg::set_dispatch_manager_status(::message::Dispatch
   // @@protoc_insertion_point(field_set:message.Dispatch_status_msg.dispatch_manager_status)
 }
 
+// required .message.Dispatch_motion_direction dispatch_motion_direction = 4;
+inline bool Dispatch_status_msg::has_dispatch_motion_direction() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void Dispatch_status_msg::set_has_dispatch_motion_direction() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void Dispatch_status_msg::clear_has_dispatch_motion_direction() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void Dispatch_status_msg::clear_dispatch_motion_direction() {
+  dispatch_motion_direction_ = 0;
+  clear_has_dispatch_motion_direction();
+}
+inline ::message::Dispatch_motion_direction Dispatch_status_msg::dispatch_motion_direction() const {
+  // @@protoc_insertion_point(field_get:message.Dispatch_status_msg.dispatch_motion_direction)
+  return static_cast< ::message::Dispatch_motion_direction >(dispatch_motion_direction_);
+}
+inline void Dispatch_status_msg::set_dispatch_motion_direction(::message::Dispatch_motion_direction value) {
+  assert(::message::Dispatch_motion_direction_IsValid(value));
+  set_has_dispatch_motion_direction();
+  dispatch_motion_direction_ = value;
+  // @@protoc_insertion_point(field_set:message.Dispatch_status_msg.dispatch_motion_direction)
+}
+
 // -------------------------------------------------------------------
 
 // Dispatch_request_msg

+ 9 - 9
message/dispatch_message.proto

@@ -33,23 +33,23 @@ message Carrier_position
     required float z=3;             //Z轴坐标, 楚天AGV和电梯一一对应,所以Z轴就用电梯高度表示
 }
 
+//调度方向, 停车取车
+enum Dispatch_motion_direction
+{
+    E_STORE_CAR             =0;         //停车, 出入口 -> 停车位
+    E_PICKUP_CAR            =1;         //取车, 停车位 -> 出入口
+}
+
 //搬运机构各个零部件状态
 message Dispatch_status_msg
 {
     required Base_info                  base_info=1;                    //消息类型
     required int32                      terminal_id=2;
-    required Dispatch_manager_status    dispatch_manager_status = 3;    //调度管理 的状态
- //   repeated Carrier_status             carrier_status = 4;             //搬运器状态, 楚天有3套AGV系统
+    required Dispatch_manager_status    dispatch_manager_status = 3;        //调度管理 的状态
+    required Dispatch_motion_direction  dispatch_motion_direction=4;        //停车口或取车口
 
 }
 
-//调度方向, 停车取车
-enum Dispatch_motion_direction
-{
-    E_STORE_CAR             =0;         //停车, 出入口 -> 停车位
-    E_PICKUP_CAR            =1;         //取车, 停车位 -> 出入口
-}
-
 //执行搬运请求
 message Dispatch_request_msg
 {

+ 1 - 1
system/PickupProcessTask.cpp

@@ -266,7 +266,7 @@ Error_manager PickupProcessTask::pickup_step()
     }
 
     //2,判断调度节点状态
-    Error_manager code=Dispatch_communicator::get_instance_pointer()->check_statu(m_terminor_id);
+    Error_manager code=Dispatch_communicator::get_instance_pointer()->check_export_statu(m_terminor_id);
     if(code!=SUCCESS)
         return code;
 

+ 1 - 1
system/StoreProcessTask.cpp

@@ -114,7 +114,7 @@ Error_manager StoreProcessTask::dispatch_step()
     }
 
     //2,判断调度节点状态
-    code=Dispatch_communicator::get_instance_pointer()->check_statu(m_terminor_id);
+    code=Dispatch_communicator::get_instance_pointer()->check_entrance_statu(m_terminor_id);
     if(code!=SUCCESS)
         return code;
 

+ 6 - 5
system/command_manager.cpp

@@ -63,6 +63,8 @@ Error_manager Command_manager::init(setting::System_setting system_setting)
             parkspace_code = Parkspace_communicator::get_instance_pointer()->check_statu();
             LOG_IF(INFO, parkspace_code == SUCCESS) << "车位管理模块初始化完成!!!";
         }
+        if(parkspace_code==SUCCESS)
+            break;
         t_end=std::chrono::system_clock::now();
         usleep(1000*100);
     }while(t_end-t_start<std::chrono::seconds(300));
@@ -73,7 +75,6 @@ Error_manager Command_manager::init(setting::System_setting system_setting)
         return Error_manager(ERROR,MAJOR_ERROR,"车位管理模块初始化超时");
     }
 
-
     //检查节点并创建停取车流程
     for(int i=0;i<system_setting.entrance_num();++i)
     {
@@ -88,7 +89,7 @@ Error_manager Command_manager::init(setting::System_setting system_setting)
                 LOG_IF(INFO, locate_code == SUCCESS) << "停车入口:"<<i<<" 测量模块初始化完成!!!";
             }
             if (dispatch_code != SUCCESS) {
-                dispatch_code = Dispatch_communicator::get_instance_pointer()->check_statu(i);
+                dispatch_code = Dispatch_communicator::get_instance_pointer()->check_entrance_statu(i);
                 LOG_IF(INFO, dispatch_code == SUCCESS) << "停车入口:"<<i<<" 调度模块初始化完成!!!";
             }
 
@@ -113,7 +114,7 @@ Error_manager Command_manager::init(setting::System_setting system_setting)
         Error_manager dispatch_code=ERROR;
         do {
             if (dispatch_code != SUCCESS) {
-                dispatch_code = Dispatch_communicator::get_instance_pointer()->check_statu(i);
+                dispatch_code = Dispatch_communicator::get_instance_pointer()->check_export_statu(i);
                 LOG_IF(INFO, dispatch_code == SUCCESS) << "取车出口:" << i << " 调度模块初始化完成!!!";
             }
 
@@ -193,7 +194,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
                             response.mutable_code()->CopyFrom(error_msg);
                             return locate_code;
                         }
-                        Error_manager dispatch_code= Dispatch_communicator::get_instance_pointer()->check_statu(request.terminal_id());
+                        Error_manager dispatch_code= Dispatch_communicator::get_instance_pointer()->check_entrance_statu(request.terminal_id());
                         if(dispatch_code!=SUCCESS)
                         {
                             error_msg.set_error_code(dispatch_code.get_error_code());
@@ -296,7 +297,7 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
             return parkspace_code;
         }
 
-        Error_manager dispatch_code= Dispatch_communicator::get_instance_pointer()->check_statu(request.terminal_id());
+        Error_manager dispatch_code= Dispatch_communicator::get_instance_pointer()->check_export_statu(request.terminal_id());
         if(dispatch_code!=SUCCESS)
         {
             error_msg.set_error_code(dispatch_code.get_error_code());

+ 1 - 1
system/command_manager.h

@@ -3,7 +3,7 @@
 //
 
 /*
- * 指令管理, 包括指令的接收,指令的执行控制,指令的状态追踪,出入口状态
+ * 指令管理, 包括指令的接收,指令的执行控制,指令的状态追踪,出入口状态检查
  */
 #ifndef NNXX_TESTS_COMMAND_MANAGER_H
 #define NNXX_TESTS_COMMAND_MANAGER_H