12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #ifndef WJ_LIDAR_TASK_HH
- #define WJ_LIDAR_TASK_HH
- #include <string.h>
- #include <mutex>
- #include <atomic>
- #include <chrono>
- #include "pcl/point_cloud.h"
- #include "pcl/point_types.h"
- #include "../task/task_command_manager.h"
- #include "../error_code/error_code.h"
- // 万集测量结果结构体
- typedef struct WJ_LIDAR_MEASURE_RESULT
- {
- int terminal_id;
- float x;
- float y;
- float angle;
- float length;
- float width;
- float height;
- float wheel_base;
- bool correctness;
- } wj_measure_result;
- typedef struct WJ_LIDAR_COMMAND_INFO
- {
- int terminal_id;
- std::chrono::steady_clock::time_point command_time;
- int timeout_in_milliseconds;
- } wj_command;
- /**
- * 万集测量任务单
- * */
- class Wj_lidar_Task : public Task_Base
- {
- public:
- // 父类继承,初始化函数
- virtual Error_manager init();
- // 构造函数
- Wj_lidar_Task();
- // 析构
- ~Wj_lidar_Task();
- // 获取命令
- Error_manager get_command(wj_command &command);
- // 设置测量命令
- Error_manager set_command(wj_command command);
- // 将测量结果存入该任务单
- Error_manager set_result(wj_measure_result result);
- // 将测量结果传出
- Error_manager get_result(wj_measure_result &result);
- // 获取测量结果是否已存入该任务单的指标
- bool get_result_flag();
- // 填入点云
- void set_cloud(pcl::PointCloud<pcl::PointXYZ> cloud)
- {
- m_cloud = cloud;
- }
- // 获取万集点云
- pcl::PointCloud<pcl::PointXYZ> get_cloud()
- {
- return m_cloud;
- }
- private:
- // 测量指令信息
- wj_command m_command;
- // 测量结果
- wj_measure_result m_wj_measure_result;
- // 访问测量结果互斥锁
- std::mutex m_mutex;
- // 标记结果是否已被设置
- std::atomic<bool> mb_result_flag;
- // 任务中保存点云
- pcl::PointCloud<pcl::PointXYZ> m_cloud;
- };
- #endif // !WJ_LIDAR_TASK_HH
|