ソースを参照

Merge remote-tracking branch 'origin/yct' into yct

# Conflicts:
#	CMakeLists.txt
#	plc/plc_communicator.cpp
youchen 5 年 前
コミット
3bc1c534d2
3 ファイル変更11 行追加3 行削除
  1. 7 2
      CMakeLists.txt
  2. 1 0
      plc/plc_communicator.h
  3. 3 1
      test/plc_test.cpp

+ 7 - 2
CMakeLists.txt

@@ -7,9 +7,7 @@ add_compile_options(-std=c++11)
 #add_definitions(-std=c++11 -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2)
 
 FIND_PACKAGE(OpenCV REQUIRED)
-set(PCL_DIR "/home/youchen/pcl-1.8/share/pcl-1.8")
 FIND_PACKAGE(PCL REQUIRED)
-
 FIND_PACKAGE(Protobuf REQUIRED)
 FIND_PACKAGE(Glog REQUIRED)
 set(CMAKE_MODULE_PATH "/usr/local/share/")
@@ -44,7 +42,14 @@ aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/verify VERIFY_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/system_manager SYS_SRC )
 aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/wj_lidar WJLIDAR_SRC )
 
+add_executable(LidarMeasure ./main.cpp ${PLC_SRC} ${TASK_MANAGER_SRC} ${TOOL_SRC} ${ERROR_CODE_SRC})
+target_link_libraries(LidarMeasure ${OpenCV_LIBS}
+        ${GLOG_LIBRARIES} ${PCL_LIBRARIES} ${PROTOBUF_LIBRARIES} ipopt modbus libnanomsg.so libnnxx.a libglog.a libgflags.a)
 
+# plc test module
+add_executable(plc_test  ./test/plc_test.cpp ${PLC_SRC} ${TASK_MANAGER_SRC} ${TOOL_SRC} ${ERROR_CODE_SRC})
+target_link_libraries(plc_test ${OpenCV_LIBS}
+        ${GLOG_LIBRARIES} ${PCL_LIBRARIES} ${PROTOBUF_LIBRARIES} ipopt modbus libnanomsg.so libnnxx.a libglog.a libgflags.a)
 add_executable(fence_debug  test/plc_s7.cpp wj_lidar/wj_lidar_msg.pb.cc)
 target_link_libraries(fence_debug ${GLOG_LIBRARIES} ${PROTOBUF_LIBRARIES} /usr/local/lib/libglog.a
         /usr/local/lib/libgflags.a nnxx nanomsg)

+ 1 - 0
plc/plc_communicator.h

@@ -36,6 +36,7 @@ using google::protobuf::io::CodedInputStream;
 using google::protobuf::io::ZeroCopyOutputStream;
 using google::protobuf::io::CodedOutputStream;
 using google::protobuf::Message;
+#include "glog/logging.h"
 
 #include <nnxx/message.h>
 #include <nnxx/message_control.h>

+ 3 - 1
test/plc_test.cpp

@@ -37,7 +37,7 @@ public:
             Error_manager ec = t->mp_pc->execute_task(&t->m_task);
             std::cout << "thread execute task " << ec.to_string() << std::endl;
 
-            int count = 2;
+            int count = 1;
             while (count-- > 0)
             {
                 std::cout << "---------- "<<count<<" --------" << std::endl;
@@ -74,6 +74,7 @@ private:
 
 int main(int argc,char* argv[])
 {
+    google::InitGoogleLogging("plc");
     plc_module::plc_connection_params params;
     params.set_ip("192.168.2.131");
     params.set_port(502);
@@ -92,5 +93,6 @@ int main(int argc,char* argv[])
     // std::cout<<"test "<<ec.to_string()<<std::endl;
 
     getchar();
+    google::ShutdownGoogleLogging();
     return 0;
 }