tof3DMain.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // Created by zx on 2023/10/7.
  3. //
  4. #include <iostream>
  5. #include "log/log.h"
  6. #include "vzense/device_tof3d.h"
  7. #include "detect/detect_manager.h"
  8. #include "proto/measure_manager.pb.h"
  9. #include "protobuf/load_protobuf.hpp"
  10. #include "communication/communication_manager.h"
  11. int main(int argc, char * argv[]) {
  12. // 初始化日志系统
  13. ZX::InitGlog(PROJECT_NAME, ETC_PATH PROJECT_NAME "/LogInfo/");
  14. // 初始化相机处理程序
  15. tof3dManagerParams tof3d_etc;
  16. if (loadProtobufFile(ETC_PATH PROJECT_NAME "/tof3d_manager.json", tof3d_etc) == SUCCESS) {
  17. auto ret = DeviceTof3D::iter()->Init(tof3d_etc.vzense_tof3d_devices());
  18. if (ret != SUCCESS) {
  19. LOG(ERROR) << ret.to_string();
  20. return EXIT_FAILURE;
  21. }
  22. } else {
  23. LOG(WARNING) << "tof3dManager read param form " << ETC_PATH PROJECT_NAME "/tof3d_manager.json" << " error.";
  24. return EXIT_FAILURE;
  25. }
  26. // 初始化测量程序
  27. DetectManager::iter()->Init();
  28. // 通信
  29. CommunicationManager::iter()->Init(tof3d_etc.communication());
  30. // 加载看门狗 TODO:添加看门狗,监视线程
  31. LOG(INFO) << "---------- all init complate ----------";
  32. while (true) {
  33. // auto mat = DeviceTof3D::iter()->getDevicePointsMat(DeviceAzimuth::DEVICE_AZIMUTH_LF);
  34. // if (mat.empty()) {
  35. // LOG(INFO) << "get a empty mat";
  36. // } else {
  37. // cv::imshow("merge_mat", mat);
  38. // }
  39. usleep(100 * 1000);
  40. }
  41. return EXIT_SUCCESS;
  42. }