Bladeren bron

change by zzw

zx 4 jaren geleden
bovenliggende
commit
bcb46762f1

+ 2 - 79
CMakeLists.txt

@@ -3,7 +3,7 @@ project(nnxx_tests)
 cmake_minimum_required(VERSION 3.5)
 
 set (CMAKE_CXX_STANDARD 11)
-set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
+#set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(nanomsg REQUIRED nanomsg)
 FIND_PACKAGE(Protobuf REQUIRED)
@@ -44,83 +44,6 @@ aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/communication COMMUNICATION_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/system SYSTEM_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/parkspace_allocation PARKSPACE_ALLOC_SRC )
 
-add_executable(terminal
-        main.cpp
-        ${error_src}
-        ${locate_src}
-        ${robot_src}
-        ${message_src}
-
-        ${LASER_SRC}
-        ${PLC_SRC}
-        ${TERMINOR_SRC}
-        ${LOCATE_SRC}
-        ${TASK_MANAGER_SRC}
-        ${TOOL_SRC}
-        ${COMMUNICATION_SRC}
-        ${SYSTEM_SRC}
-        )
-
-target_link_libraries(terminal
-        /usr/local/lib/libglog.a
-        /usr/local/lib/libgflags.a
-        /usr/local/lib/liblivox_sdk_static.a
-        /usr/local/apr/lib/libapr-1.a
-        nnxx
-        nanomsg
-
-        ${PROTOBUF_LIBRARIES}
-        ${OpenCV_LIBS}
-        ${GLOG_LIBRARIES}
-        ${PCL_LIBRARIES}
-        ${PROTOBUF_LIBRARIES}
-
-        libtensorflow_cc.so
-        #tf_3dcnn_api.so
-        pointSIFT_API.so
-
-        -lpthread
-        )
-
-
-add_executable(locate_client
-        ./test/Locate_client.cpp
-        ./lidar_locate/Locate_communicator.cpp
-        ./error_code/error_code.cpp
-        ${message_src}
-        ${TOOL_SRC}
-        ${COMMUNICATION_SRC}
-        )
-target_link_libraries(locate_client
-        nnxx
-        nanomsg
-        ${PROTOBUF_LIBRARIES}
-        /usr/local/lib/libglog.a
-        /usr/local/lib/libgflags.a
-                libtensorflow_cc.so
-        #tf_3dcnn_api.so
-        pointSIFT_API.so
-
-        -lpthread
-        )
-
-
-add_executable(locate_test
-        ./test/test_locate_sample.cpp
-        ./lidar_locate/Locate_communicator.cpp
-        ./error_code/error_code.cpp
-        ${message_src}
-        ${TOOL_SRC}
-        ${COMMUNICATION_SRC}
-        )
-target_link_libraries(locate_test
-        nnxx
-        nanomsg
-        ${PROTOBUF_LIBRARIES}
-        /usr/local/lib/libglog.a
-        /usr/local/lib/libgflags.a
-        )
-
 # 车位分配测试
 add_executable(parkspace_test
         ./test/test_parkspace_sample.cpp
@@ -150,4 +73,4 @@ target_link_libraries(parkspace_client
         ${PROTOBUF_LIBRARIES}
         /usr/local/lib/libglog.a
         /usr/local/lib/libgflags.a
-        )
+        )

+ 7 - 7
message/message_base.pb.cc

@@ -249,16 +249,16 @@ void AddDescriptorsImpl() {
       "\022\"\n\036eParkspace_release_request_msg\0206\022#\n\037"
       "eParkspace_release_response_msg\0207\022\'\n#ePa"
       "rkspace_force_update_request_msg\0208\022(\n$eP"
-      "arkspace_force_update_response_msg\0209*o\n\014"
+      "arkspace_force_update_response_msg\0209*e\n\014"
       "Communicator\022\n\n\006eEmpty\020\000\022\t\n\005eMain\020\001\022\016\n\te"
-      "Terminor\020\200\002\022\031\n\024eParkspace_allocator\020\200\004\022\016"
-      "\n\teMeasurer\020\200\006\022\r\n\010eProcess\020\200\010*e\n\013Error_l"
-      "evel\022\n\n\006NORMAL\020\000\022\024\n\020NEGLIGIBLE_ERROR\020\001\022\017"
-      "\n\013MINOR_ERROR\020\002\022\017\n\013MAJOR_ERROR\020\003\022\022\n\016CRIT"
-      "ICAL_ERROR\020\004"
+      "Terminor\020\200\002\022\017\n\neParkspace\020\200\004\022\016\n\teMeasure"
+      "r\020\200\006\022\r\n\010eProcess\020\200\010*e\n\013Error_level\022\n\n\006NO"
+      "RMAL\020\000\022\024\n\020NEGLIGIBLE_ERROR\020\001\022\017\n\013MINOR_ER"
+      "ROR\020\002\022\017\n\013MAJOR_ERROR\020\003\022\022\n\016CRITICAL_ERROR"
+      "\020\004"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 1332);
+      descriptor, 1322);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "message_base.proto", &protobuf_RegisterTypes);
 }

+ 1 - 1
message/message_base.pb.h

@@ -112,7 +112,7 @@ enum Communicator {
   eEmpty = 0,
   eMain = 1,
   eTerminor = 256,
-  eParkspace_allocator = 512,
+  eParkspace = 512,
   eMeasurer = 768,
   eProcess = 1024
 };

+ 1 - 1
message/message_base.proto

@@ -36,7 +36,7 @@ enum Communicator
 
     eTerminor=0x0100;
     //车位数据表
-    eParkspace_allocator=0x0200;
+    eParkspace=0x0200;
     //测量单元
     eMeasurer=0x0300;
     //调度机构

+ 1 - 1
parkspace_allocation/parkspace_allocation_communicator.cpp

@@ -145,7 +145,7 @@ Error_manager Parkspace_allocation_communicator::encapsulate_send_data()
     message::Error_manager t_error;
 	t_base_info.set_msg_type(message::Message_type::eParkspace_allocation_status_msg);
 	t_base_info.set_timeout_ms(5000);
-	t_base_info.set_sender(message::Communicator::eParkspace_allocator);
+	t_base_info.set_sender(message::Communicator::eParkspace);
 	t_base_info.set_receiver(message::Communicator::eMain);
     t_error.set_error_code(0);
     t_parkspace_status_msg.mutable_base_info()->CopyFrom(t_base_info);

+ 8 - 5
parkspace_allocation/parkspace_allocator.cpp

@@ -152,7 +152,7 @@ void Parkspace_allocator::execute_for_allocate(message::Car_info car_info, int t
     message::Base_info t_response_header;
     t_response_header.set_msg_type(message::Message_type::eParkspace_allocation_response_msg);
     t_response_header.set_timeout_ms(1000);
-    t_response_header.set_sender(message::Communicator::eParkspace_allocator);
+    t_response_header.set_sender(message::Communicator::eParkspace);
     t_response_header.set_receiver(message::Communicator::eMain);
     message::Error_manager t_error;
     message::Parkspace_info t_allocated_space;
@@ -219,7 +219,7 @@ void Parkspace_allocator::execute_for_search(message::Car_info car_info, int com
     message::Parkspace_info t_car_position;
     t_response_header.set_msg_type(message::Message_type::eParkspace_search_response_msg);
     t_response_header.set_timeout_ms(1000);
-    t_response_header.set_sender(message::Communicator::eParkspace_allocator);
+    t_response_header.set_sender(message::Communicator::eParkspace);
     t_response_header.set_receiver(message::Communicator::eMain);
     //获取当前所有车位状态,查询车辆位置
     message::Parkspace_allocation_status_msg t_current_parkspace_status = Parkspace_allocation_communicator::get_instance_references().get_status();
@@ -273,6 +273,9 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
     //!!!!!此处跳过外部处理与调用的过程,直接在内部调用,发送分配结果用于测试,目前一直发布第一个车位
     message::Parkspace_release_response_msg response_msg;
     message::Base_info t_response_header;
+    t_response_header.set_msg_type(message::eParkspace_release_response_msg);
+    t_response_header.set_sender(message::eParkspace);
+    t_response_header.set_receiver(message::eMain);
     message::Error_manager t_error;
     message::Parkspace_info t_release_space;
     //获取当前所有车位状态,找到待释放的车位
@@ -323,9 +326,9 @@ void Parkspace_allocator::execute_for_release(message::Parkspace_info space_info
     response_msg.set_command_id(command_id);
     response_msg.mutable_error_manager()->CopyFrom(t_error);
     response_msg.mutable_release_space_info()->CopyFrom(t_release_space);
-    Communication_message* response=new Communication_message();
-    response->reset(t_response_header, response_msg.SerializeAsString());
-    Parkspace_allocation_communicator::get_instance_references().send_response(response);
+    Communication_message response=Communication_message();
+    response.reset(t_response_header, response_msg.SerializeAsString());
+    Parkspace_allocation_communicator::get_instance_references().send_response(&response);
 }
 
 //强制更新车位信息线程函数

+ 3 - 3
test/parkspace_client.cpp

@@ -25,7 +25,7 @@ std::string send_allocation_request(int n)
 
     base_info.set_msg_type(message::Message_type::eParkspace_allocation_request_msg);
     base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eParkspace_allocator);
+    base_info.set_receiver(message::eParkspace);
     base_info.set_timeout_ms(2000);
     car_info.set_car_height(1.0);
     car_info.set_car_width(1.0);
@@ -50,7 +50,7 @@ std::string send_search_requests(int n, std::string license="鄂A12345")
 
     base_info.set_msg_type(message::Message_type::eParkspace_search_request_msg);
     base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eParkspace_allocator);
+    base_info.set_receiver(message::eParkspace);
     base_info.set_timeout_ms(2000);
     car_info.set_car_height(2.0);
     car_info.set_car_width(2.0);
@@ -75,7 +75,7 @@ std::string send_release_request(int n)
 
     base_info.set_msg_type(message::Message_type::eParkspace_release_request_msg);
     base_info.set_sender(message::eMain);
-    base_info.set_receiver(message::eParkspace_allocator);
+    base_info.set_receiver(message::eParkspace);
     base_info.set_timeout_ms(2000);
     car_info.set_car_height(1.5);
     car_info.set_car_width(1.85);

+ 3 - 3
test/test_parkspace_sample.cpp

@@ -19,7 +19,7 @@ int main()
     Parkspace_allocator *p_parkspace_allocator = Parkspace_allocator::get_instance_pointer();
 
     p_parkspace_allocator->parkspace_allocator_init(4);
-    p_parkspace_allocation_communicater->communication_bind("tcp://192.168.2.139:7001");
+    p_parkspace_allocation_communicater->communication_bind("tcp://192.168.2.125:7001");
     // p_parkspace_allocation_communicater->communication_connect("tcp://127.0.0.1:7000");
     p_parkspace_allocation_communicater->communication_run();
 
@@ -41,7 +41,7 @@ int main()
     message::Error_manager error;
     base_msg.set_msg_type(message::Message_type::eParkspace_allocation_response_msg);
     base_msg.set_timeout_ms(1000);
-    base_msg.set_sender(message::Communicator::eParkspace_allocator);
+    base_msg.set_sender(message::Communicator::eParkspace);
     base_msg.set_receiver(message::Communicator::eMain);
     error.set_error_code(0);
     parkspace_status.mutable_base_info()->CopyFrom(base_msg);
@@ -65,4 +65,4 @@ int main()
     }
     p_parkspace_allocator->parkspace_allocator_uninit();
     return 0;
-}
+}