tof3DMain.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // Created by zx on 2023/10/7.
  3. //
  4. #include <iostream>
  5. #include "tool/log.hpp"
  6. #include "vzense/device_tof3d.h"
  7. #include "detect/detect_manager.h"
  8. #include "proto/measure_manager.pb.h"
  9. #include "tool/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. // Error_manager ret;
  19. if (ret != SUCCESS) {
  20. LOG(ERROR) << ret.to_string();
  21. return EXIT_FAILURE;
  22. }
  23. } else {
  24. LOG(WARNING) << "tof3dManager read param form " << ETC_PATH PROJECT_NAME "/tof3d_manager.json" << " error.";
  25. return EXIT_FAILURE;
  26. }
  27. // 初始化测量程序
  28. DetectManager::iter()->Init(tof3d_etc.vzense_tof3d_devices());
  29. // 通信
  30. CommunicationManager::iter()->Init(tof3d_etc.communication());
  31. // 加载看门狗 TODO:添加看门狗,监视线程
  32. LOG(INFO) << "---------- all init complate ----------";
  33. while (true) {
  34. // auto mat = DeviceTof3D::iter()->getDevicePointsMat(DeviceAzimuth::DEVICE_AZIMUTH_LF);
  35. // if (mat.empty()) {
  36. // LOG(INFO) << "get a empty mat";
  37. // } else {
  38. // cv::imshow("merge_mat", mat);
  39. // }
  40. // usleep(5 * 1000 * 1000);
  41. // DetectManager::iter()->Stop();
  42. // DeviceTof3D::iter()->Stop();
  43. //
  44. // usleep(5 * 1000 * 1000);
  45. // DeviceTof3D::iter()->Continue();
  46. // DetectManager::iter()->Continue();
  47. usleep(5 * 1000 * 1000);
  48. }
  49. return EXIT_SUCCESS;
  50. }