之前说到雷达会经过时间同步,和畸变校准,并且最后来到了匹配
1 2 3 4 5 6 7 8 9 10 11 12
| const transform::Rigid3d gravity_alignment = transform::Rigid3d::Rotation( extrapolator_->EstimateGravityOrientation(time)); accumulated_range_data_.origin = range_data_poses.back().translation(); return AddAccumulatedRangeData( time, TransformToGravityAlignedFrameAndFilter( gravity_alignment.cast<float>() * range_data_poses.back().inverse(), accumulated_range_data_), gravity_alignment, sensor_duration);
|
在进行匹配之前,还是需要介绍一下TransformToGravityAlignedFrameAndFilter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
sensor::RangeData LocalTrajectoryBuilder2D::TransformToGravityAlignedFrameAndFilter( const transform::Rigid3f& transform_to_gravity_aligned_frame, const sensor::RangeData& range_data) const { const sensor::RangeData cropped = sensor::CropRangeData(sensor::TransformRangeData( range_data, transform_to_gravity_aligned_frame), options_.min_z(), options_.max_z()); return sensor::RangeData{ cropped.origin, sensor::VoxelFilter(cropped.returns, options_.voxel_filter_size()), sensor::VoxelFilter(cropped.misses, options_.voxel_filter_size())}; }
|
此函数接受数据和变换,RangeData 包含一个Vector3f的数据 origin,直接乘以transform即可,下面的函数同样的道理,都是调用里面的 数据,用transform * data 进行变换
1 2 3 4 5 6 7 8 9
| RangeData TransformRangeData(const RangeData& range_data, const transform::Rigid3f& transform) { return RangeData{ transform * range_data.origin, TransformPointCloud(range_data.returns, transform), TransformPointCloud(range_data.misses, transform), }; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
PointCloud TransformPointCloud(const PointCloud& point_cloud, const transform::Rigid3f& transform) { std::vector<RangefinderPoint> points; points.reserve(point_cloud.size()); for (const RangefinderPoint& point : point_cloud.points()) { points.emplace_back(transform * point); } return PointCloud(points, point_cloud.intensities()); }
|
CropRangeData
此函数接受一个变换完之后的点云,并且还有一个z轴的最小和最大值,在此范围之外的数据全部裁剪掉
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
RangeData CropRangeData(const RangeData& range_data, const float min_z, const float max_z) { return RangeData{range_data.origin, CropPointCloud(range_data.returns, min_z, max_z), CropPointCloud(range_data.misses, min_z, max_z)}; }
|
体素滤波
1 2 3 4 5 6
| std::vector<RangefinderPoint> VoxelFilter( const std::vector<RangefinderPoint>& points, const float resolution) { return RandomizedVoxelFilter( points, resolution, [](const RangefinderPoint& point) { return point.position; }); }
|
再说