2021-01-04 21:26:09 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common.h"
|
2021-01-05 14:33:42 +08:00
|
|
|
#include "oh_my_loam/base/feature.h"
|
|
|
|
#include "oh_my_loam/base/helper.h"
|
|
|
|
#include "oh_my_loam/base/types.h"
|
|
|
|
#include "oh_my_loam/visualizer/extractor_visualizer.h"
|
2021-01-04 21:26:09 +08:00
|
|
|
|
|
|
|
namespace oh_my_loam {
|
|
|
|
|
|
|
|
class Extractor {
|
|
|
|
public:
|
|
|
|
Extractor() = default;
|
|
|
|
virtual ~Extractor() = default;
|
|
|
|
|
|
|
|
bool Init();
|
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
void Process(double timestamp, const common::PointCloudConstPtr &cloud,
|
|
|
|
std::vector<Feature> *const features);
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
int num_scans() const {
|
|
|
|
return num_scans_;
|
|
|
|
}
|
2021-01-04 21:26:09 +08:00
|
|
|
|
|
|
|
protected:
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual int GetScanID(const common::Point &pt) const = 0;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual void SplitScan(const common::PointCloud &cloud,
|
|
|
|
std::vector<TCTPointCloud> *const scans) const;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual void ComputeCurvature(TCTPointCloud *const scan) const;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual void AssignType(TCTPointCloud *const scan) const;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual void GenerateFeature(const TCTPointCloud &scan,
|
|
|
|
Feature *const feature) const;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
2021-01-22 16:33:55 +08:00
|
|
|
virtual void Visualize(const common::PointCloudConstPtr &cloud,
|
|
|
|
const std::vector<Feature> &features,
|
2021-01-23 22:11:08 +08:00
|
|
|
double timestamp = 0.0) const;
|
2021-01-14 00:34:13 +08:00
|
|
|
|
2021-01-04 21:26:09 +08:00
|
|
|
int num_scans_ = 0;
|
|
|
|
|
2021-01-14 00:34:13 +08:00
|
|
|
YAML::Node config_;
|
|
|
|
|
2021-01-04 21:26:09 +08:00
|
|
|
std::unique_ptr<ExtractorVisualizer> visualizer_{nullptr};
|
|
|
|
|
|
|
|
bool verbose_ = false;
|
|
|
|
|
|
|
|
private:
|
2021-01-22 16:33:55 +08:00
|
|
|
void UpdateNeighborsPicked(const TCTPointCloud &scan, size_t ix,
|
|
|
|
std::vector<bool> *const picked) const;
|
2021-01-04 21:26:09 +08:00
|
|
|
|
|
|
|
bool is_vis_ = false;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Extractor);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace oh_my_loam
|