2020-10-12 21:09:32 +08:00
|
|
|
#include "oh_my_loam.h"
|
|
|
|
|
|
|
|
namespace oh_my_loam {
|
|
|
|
|
2020-10-14 01:10:50 +08:00
|
|
|
bool OhMyLoam::Init(const YAML::Node& config) {
|
2020-10-13 01:07:59 +08:00
|
|
|
is_vis_ = true;
|
2020-10-14 01:10:50 +08:00
|
|
|
config_ = config;
|
2020-10-12 21:09:32 +08:00
|
|
|
feature_extractor_.reset(new FeatureExtractorVLP16);
|
|
|
|
if (is_vis_) {
|
|
|
|
visualizer_.reset(new FeaturePointsVisualizer);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OhMyLoam::Run(const PointCloud& cloud, double timestamp) {
|
|
|
|
std::shared_ptr<FeaturePoints> feature_pts(new FeaturePoints);
|
|
|
|
feature_extractor_->Extract(cloud, feature_pts.get());
|
|
|
|
if (is_vis_) Visualize(cloud, feature_pts, timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OhMyLoam::Visualize(
|
|
|
|
const PointCloud& cloud,
|
|
|
|
const std::shared_ptr<const FeaturePoints>& feature_pts, double timestamp) {
|
2020-10-13 01:07:59 +08:00
|
|
|
std::shared_ptr<FeaturePointsVisFrame> frame(new FeaturePointsVisFrame);
|
2020-10-12 21:09:32 +08:00
|
|
|
frame->timestamp = timestamp;
|
|
|
|
frame->cloud = cloud.makeShared();
|
|
|
|
frame->feature_pts = feature_pts;
|
|
|
|
visualizer_->Render(frame);
|
|
|
|
}
|
|
|
|
|
2020-10-13 01:07:59 +08:00
|
|
|
} // namespace oh_my_loam
|