lidarsJsonConfig.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * @project shutter_verify
  3. * @brief $BRIEF$
  4. * @author lz
  5. * @data 2023/4/13
  6. **/
  7. #pragma once
  8. #include "json/json.h"
  9. #include "defines.hpp"
  10. class lidarsJsonConfig {
  11. public:
  12. struct NetConfig {
  13. std::string ip_address;
  14. int port;
  15. void info() {
  16. printf("---Debug %s %d : ip_address %s .\n", __func__, __LINE__, ip_address.c_str());
  17. printf("---Debug %s %d : port %d .\n", __func__, __LINE__, port);
  18. }
  19. };
  20. struct ScanBoxLimit {
  21. int dist_limit;
  22. double minx;
  23. double maxx;
  24. double miny;
  25. double maxy;
  26. void info() {
  27. printf("---Debug %s %d : minx %f .\n", __func__, __LINE__, minx);
  28. printf("---Debug %s %d : maxx %f .\n", __func__, __LINE__, maxx);
  29. printf("---Debug %s %d : miny %f .\n", __func__, __LINE__, miny);
  30. printf("---Debug %s %d : maxy %f .\n", __func__, __LINE__, maxy);
  31. }
  32. };
  33. struct LidarConfig {
  34. double angle_min;
  35. double angle_max;
  36. double angle_increment;
  37. double time_increment;
  38. int range_min;
  39. int range_max;
  40. NetConfig net_config;
  41. ScanBoxLimit scan_box_limit;
  42. void info() {
  43. printf("---Debug %s %d : angle_min %f .\n", __func__, __LINE__, angle_min);
  44. printf("---Debug %s %d : angle_max %f .\n", __func__, __LINE__, angle_max);
  45. printf("---Debug %s %d : angle_increment %f .\n", __func__, __LINE__, angle_increment);
  46. printf("---Debug %s %d : time_increment %f .\n", __func__, __LINE__, time_increment);
  47. printf("---Debug %s %d : range_min %d .\n", __func__, __LINE__, range_min);
  48. printf("---Debug %s %d : range_max %d .\n", __func__, __LINE__, range_max);
  49. net_config.info();
  50. scan_box_limit.info();
  51. }
  52. };
  53. public:
  54. explicit lidarsJsonConfig(std::string path);
  55. ~lidarsJsonConfig() = default;
  56. bool getLidarConfig(int ordinal, LidarConfig &lidarconfig);
  57. bool getNetConfig(int ordinal, NetConfig &net_config);
  58. bool getScanBoxLimit(int ordinal, ScanBoxLimit &scan_box_limit);
  59. double angle_min(int ordinal);
  60. double angle_max(int ordinal);
  61. double angle_increment(int ordinal);
  62. double time_increment(int ordinal);
  63. int range_min(int ordinal);
  64. int range_max(int ordinal);
  65. std::string ip_address(int ordinal);
  66. int port(int ordinal);
  67. int dist_limit(int ordinal);
  68. double minx(int ordinal);
  69. double maxx(int ordinal);
  70. double miny(int ordinal);
  71. double maxy(int ordinal);
  72. bool update();
  73. private:
  74. std::string m_path;
  75. Json::Value m_config;
  76. };