update
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "lidar_core/lakibeam_driver.hpp"
|
||||
#include "lidar_core/scan_filter.hpp"
|
||||
|
||||
#include "vslam/clock.h"
|
||||
#include "vslam/driver_config.h"
|
||||
@@ -86,6 +87,45 @@ class LakiBeamWrapper : public LidarInterface {
|
||||
// biet cho nao cat no.
|
||||
lc.crop_fov = false;
|
||||
|
||||
// Bon bo loc chay TREN scan tho, truoc khi doi sang kieu cua vslam.
|
||||
//
|
||||
// Chung xu ly loai rac ma ScanSanitizer khong bat duoc: ScanSanitizer chi
|
||||
// cat QUAT CO DINH, con tia keo dai sau cot chong / tan xa yeu / cum diem
|
||||
// don le thi khong nam gon trong quat nao.
|
||||
//
|
||||
// Box filter cung la thu thay the dung dan cho `sector_masks`: LiDAR nam
|
||||
// o TAM robot nen vung bi khung gan che khong con la mot quat goc ma la
|
||||
// mot vung hinh hop quanh goc toa do.
|
||||
{
|
||||
lidar_core::ScanFilterConfig fc;
|
||||
const LidarFilterConfig& f = cfg_.filter;
|
||||
fc.shadow_filter_enabled = f.shadow_enabled;
|
||||
fc.shadow_min_angle_deg = f.shadow_min_angle_deg;
|
||||
fc.shadow_window = f.shadow_window;
|
||||
fc.shadow_min_range_diff = f.shadow_min_range_diff;
|
||||
fc.shadow_max_range = f.shadow_max_range;
|
||||
fc.shadow_clear_start = f.shadow_clear_start;
|
||||
fc.shadow_clear_neighbors = f.shadow_clear_neighbors;
|
||||
fc.intensity_filter_enabled = f.intensity_enabled;
|
||||
fc.intensity_min = static_cast<float>(f.intensity_min);
|
||||
fc.intensity_max = static_cast<float>(f.intensity_max);
|
||||
fc.intensity_filter_max_range = static_cast<float>(f.intensity_max_range);
|
||||
fc.isolated_filter_enabled = f.isolated_enabled;
|
||||
fc.isolated_min_cluster_points = f.isolated_min_cluster_points;
|
||||
fc.isolated_max_range_jump = f.isolated_max_range_jump;
|
||||
fc.isolated_max_range = f.isolated_max_range;
|
||||
fc.box_filter_enabled = f.box_enabled;
|
||||
fc.box_min_x = f.box_min_x;
|
||||
fc.box_max_x = f.box_max_x;
|
||||
fc.box_min_y = f.box_min_y;
|
||||
fc.box_max_y = f.box_max_y;
|
||||
filter_ = std::make_unique<lidar_core::ScanFilter>(fc);
|
||||
VSLAM_INFO("lidar: bo loc shadow=" << f.shadow_enabled
|
||||
<< " intensity=" << f.intensity_enabled
|
||||
<< " isolated=" << f.isolated_enabled
|
||||
<< " box=" << f.box_enabled);
|
||||
}
|
||||
|
||||
impl_ = std::make_unique<lidar_core::LakiBeamDriver>(lc);
|
||||
impl_->setCallback([this](const lidar_core::LaserScan& s) { OnScan(s); });
|
||||
|
||||
@@ -110,6 +150,7 @@ class LakiBeamWrapper : public LidarInterface {
|
||||
if (!impl_) return;
|
||||
impl_->stop();
|
||||
impl_.reset();
|
||||
filter_.reset();
|
||||
}
|
||||
|
||||
DriverStats Stats() const override {
|
||||
@@ -118,7 +159,12 @@ class LakiBeamWrapper : public LidarInterface {
|
||||
}
|
||||
|
||||
private:
|
||||
void OnScan(const lidar_core::LaserScan& in) {
|
||||
void OnScan(const lidar_core::LaserScan& raw) {
|
||||
// Loc TRUOC khi doi kieu. ScanFilter thay diem rac bang +Inf, khong xoa
|
||||
// phan tu, nen chi so tia va goc giu nguyen.
|
||||
lidar_core::LaserScan in = raw;
|
||||
if (filter_) filter_->filter(in);
|
||||
|
||||
auto out = std::make_shared<LaserScan>();
|
||||
out->header.seq = seq_++;
|
||||
out->header.frame_id = cfg_.frame_id;
|
||||
@@ -218,6 +264,7 @@ class LakiBeamWrapper : public LidarInterface {
|
||||
ClockPtr clock_;
|
||||
ScanCallback cb_;
|
||||
std::unique_ptr<lidar_core::LakiBeamDriver> impl_;
|
||||
std::unique_ptr<lidar_core::ScanFilter> filter_;
|
||||
uint32_t seq_ = 0;
|
||||
|
||||
mutable std::mutex mu_;
|
||||
|
||||
Reference in New Issue
Block a user