velodyne_lidar_scan_task.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // Created by huli on 2020/9/8.
  3. //
  4. #ifndef VELODYNE_LIDAR_TASK_H
  5. #define VELODYNE_LIDAR_TASK_H
  6. #include <pcl/point_types.h>
  7. #include <pcl/common/common.h>
  8. #include "../error_code/error_code.h"
  9. #include <vector>
  10. #include <mutex>
  11. #include "../task/task_command_manager.h"
  12. //万集雷达模块的任务指令,从Task_Base继承,
  13. class Velodyne_lidar_scan_task:public Task_Base
  14. {
  15. public:
  16. Velodyne_lidar_scan_task();
  17. Velodyne_lidar_scan_task(const Velodyne_lidar_scan_task& other)= default;
  18. Velodyne_lidar_scan_task& operator =(const Velodyne_lidar_scan_task& other)= default;
  19. ~Velodyne_lidar_scan_task();
  20. public://API functions
  21. //初始化任务单,必须初始化之后才可以使用,(必选参数)
  22. // input:p_task_cloud_lock 三维点云的数据保护锁
  23. // output:p_task_point_cloud 三维点云容器的智能指针
  24. //注:task_frame_maxnum默认为0,如果为0,则使用laser默认的点云的采集帧数最大值 TASK_FRAME_MAXNUM_DEFAULT
  25. Error_manager task_init(std::chrono::steady_clock::time_point command_time,
  26. std::mutex* p_task_cloud_lock,
  27. pcl::PointCloud<pcl::PointXYZ>::Ptr p_task_point_cloud);
  28. //初始化任务单,必须初始化之后才可以使用,(可选参数)
  29. // input:task_statu 任务状态
  30. // input:task_statu_information 状态说明
  31. // input:tast_receiver 接受对象
  32. // input:task_over_time 超时时间
  33. // input:p_task_cloud_lock 三维点云的数据保护锁
  34. // output:p_task_pmutexoint_cloud 三维点云容器的智能指针
  35. //注:task_frame_maxnum默认为0,如果为0,则使用laser默认的点云的采集帧数最大值 TASK_FRAME_MAXNUM_DEFAULT
  36. Error_manager task_init(Task_statu task_statu,
  37. std::string task_statu_information,
  38. void* p_tast_receiver,
  39. std::chrono::milliseconds task_over_time,
  40. std::chrono::steady_clock::time_point command_time,
  41. std::mutex* p_task_cloud_lock,
  42. pcl::PointCloud<pcl::PointXYZ>::Ptr p_task_point_cloud
  43. );
  44. public://get or set member variable
  45. std::chrono::steady_clock::time_point get_command_time();
  46. //获取 三维点云容器的智能指针;
  47. std::mutex* get_task_cloud_lock();
  48. //获取 三维点云容器的智能指针
  49. pcl::PointCloud<pcl::PointXYZ>::Ptr get_task_point_cloud();
  50. protected://member variable
  51. //下发指令的时间点. 从command_time提前一个扫描周期, 然后取最新的点
  52. std::chrono::steady_clock::time_point m_command_time;
  53. //三维点云的数据保护锁,任务输入, (实际上多个雷达会同时往一个pcl点云容器里面填充数据,防止数据冲突,需要对容器加锁.)
  54. std::mutex* mp_task_cloud_lock;
  55. //采集结果,三维点云容器的智能指针,任务输出
  56. //这里只是智能指针,实际内存由任务发送方管理管理,初始化时必须保证内存有效。
  57. pcl::PointCloud<pcl::PointXYZ>::Ptr mp_task_point_cloud;
  58. private:
  59. };
  60. #endif //VELODYNE_LIDAR_TASK_H