// // Created by zx on 2021/5/20. // #ifndef LIDARMEASURE__GROUD_REGION_HPP_ #define LIDARMEASURE__GROUD_REGION_HPP_ #include "error_code/error_code.h" #include #include "match3d/detect_wheel_ceres3d.h" #include "configure.pb.h" #include "vlp16.hpp" #include #include #include #include #include "tool/thread_condition.h" using google::protobuf::Message; using google::protobuf::io::CodedInputStream; using google::protobuf::io::CodedOutputStream; using google::protobuf::io::FileInputStream; using google::protobuf::io::FileOutputStream; using google::protobuf::io::ZeroCopyInputStream; using google::protobuf::io::ZeroCopyOutputStream; #include #include #include "message/ground_measure_msg.pb.h" class Ground_region { public: Ground_region(); ~Ground_region(); Error_manager init(std::string configure_file); Error_manager init(ground_region::Configure configure); Error_manager detect(pcl::PointCloud::Ptr cloud,const ground_region::Box& box, detect_wheel_ceres3d::Detect_result& result); private: bool read_proto_param(std::string file, ::google::protobuf::Message& parameter); Error_manager sync_capture(std::vector::Ptr>& cloud,double timeout_second=1.0); pcl::PointCloud::Ptr scans2cloud(const velodyne::Frame& frame,const ground_region::Calib_parameter& calib); //预处理点云, 并并判断雷达状态 Error_manager prehandle_cloud(std::vector::Ptr>& clouds, message::Ground_measure_statu_msg& msg); bool classify_ceres_detect(pcl::PointCloud::Ptr cloud,double thresh_z, detect_wheel_ceres3d::Detect_result& result); static void thread_measure_func(Ground_region* p); std::vector::Ptr> segmentation(pcl::PointCloud::Ptr sor_cloud); double distance(cv::Point2f p1, cv::Point2f p2); bool isRect(std::vector& points); private: std::vector m_lidars; public: ground_region::Configure m_configure; detect_wheel_ceres3d* m_detector; private: std::thread* m_running_thread; Thread_condition m_exit_condition; }; #endif //LIDARMEASURE__GROUD_REGION_HPP_