main.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // Created by zx on 2023/10/26.
  3. //
  4. #include <iostream>
  5. #include "error_code/error_code.hpp"
  6. #include "log/log.h"
  7. #if OPTION_COMMUNICATION_WITH_PLC
  8. #include "plc/snap7_clamp.h"
  9. #endif
  10. #include "protobuf/load_protobuf.hpp"
  11. #include "lidar/lidar_manager.h"
  12. #define OPTION_WATCH_DIDAR_BY_VTK 0
  13. int main(int argc, char **argv) {
  14. const char* clamp_config_file = ETC_PATH PROJECT_NAME "/clamp_lidar_config.json";
  15. if(ZX::InitGlog(PROJECT_NAME, ETC_PATH PROJECT_NAME "/LogInfo/")) {
  16. LOG(INFO) << "Init google log success, log file save to " ETC_PATH PROJECT_NAME "/LogInfo";
  17. } else {
  18. LOG(ERROR) << "Init google log failed, log file save to " ETC_PATH PROJECT_NAME "/LogInfo";
  19. exit(EXIT_FAILURE);
  20. }
  21. ClampLidarManager lidarManager;
  22. if (lidarManager.Init(clamp_config_file) != SUCCESS) {
  23. return EXIT_FAILURE;
  24. }
  25. #if OPTION_COMMUNICATION_WITH_PLC
  26. auto snap7_client = &Snap7Clamp::get_instance_references();
  27. snap7_client->communication_init();
  28. Snap7Clamp::Snap7_communication_statu status = snap7_client->get_status();
  29. while (status == Snap7Clamp::SNAP7_COMMUNICATION_READY || status == Snap7Clamp::SNAP7_COMMUNICATION_RECEIVE) {
  30. sleep(1);
  31. status = snap7_client->get_status();
  32. }
  33. #endif
  34. #if OPTION_WATCH_DIDAR_BY_VTK
  35. #endif
  36. return EXIT_SUCCESS;
  37. }