Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::FeatureXYPlane类 参考

#include <extract_ground_plane.h>

apollo::localization::msf::FeatureXYPlane 的协作图:

Public 类型

typedef pcl::PointXYZI PointT
 
typedef pcl::PointCloud< PointTPointCloudT
 
typedef PointCloudT::Ptr PointCloudPtrT
 

Public 成员函数

 FeatureXYPlane ()
 
void SetMinGridSize (double d)
 
void SetMaxGridSize (double d)
 
void SetPlaneInlierDistance (double d)
 
void SetMinPlanepointsNumber (double d)
 
void SetPlaneTypeDegree (double d)
 
void SetBelowLidarHeight (double d)
 
float CalculateDegree (const Eigen::Vector3f &tmp0, const Eigen::Vector3f &tmp1)
 
PointCloudPtrTGetXYPlaneCloud ()
 
PointCloudPtrTGetNonXYPlaneCloud ()
 
void ExtractXYPlane (const PointCloudPtrT &cloud)
 

详细描述

在文件 extract_ground_plane.h33 行定义.

成员类型定义说明

◆ PointCloudPtrT

在文件 extract_ground_plane.h37 行定义.

◆ PointCloudT

◆ PointT

在文件 extract_ground_plane.h35 行定义.

构造及析构函数说明

◆ FeatureXYPlane()

apollo::localization::msf::FeatureXYPlane::FeatureXYPlane ( )
inline

在文件 extract_ground_plane.h40 行定义.

40 {
41 min_grid_size_ = 0.5;
42 max_grid_size_ = 4.00;
43 plane_inlier_distance_ = 0.05;
44 min_planepoints_number_ = 60;
45 plane_type_degree_ = 80.0;
46 below_lidar_height_ = 1.0;
47 xy_plane_cloud_ = PointCloudPtrT(new PointCloudT);
48 non_xy_plane_cloud_ = PointCloudPtrT(new PointCloudT);
49 }

成员函数说明

◆ CalculateDegree()

float apollo::localization::msf::FeatureXYPlane::CalculateDegree ( const Eigen::Vector3f &  tmp0,
const Eigen::Vector3f &  tmp1 
)
inline

在文件 extract_ground_plane.h65 行定义.

66 {
67 float cos_theta = tmp0.dot(tmp1) / (tmp0.norm() * tmp1.norm());
68 return static_cast<float>(std::acos(cos_theta) * 180.0 / M_PI);
69 }

◆ ExtractXYPlane()

void apollo::localization::msf::FeatureXYPlane::ExtractXYPlane ( const PointCloudPtrT cloud)
inline

在文件 extract_ground_plane.h75 行定义.

75 {
76 xy_plane_cloud_.reset(new PointCloudT);
77 PointCloudPtrT pointcloud_ptr(new PointCloudT);
78 pcl::copyPointCloud<PointT>(*cloud, *pointcloud_ptr);
79 int iter_num = static_cast<int>(log2(max_grid_size_ / min_grid_size_));
80 if (iter_num == 0) {
81 iter_num = 1;
82 }
83 std::clock_t plane_time;
84 plane_time = std::clock();
85 int total_plane_num = 0;
86 double power2 = 0.5; // 2^-1
87 for (int iter = 0; iter <= iter_num; ++iter) {
88 power2 *= 2;
89 float grid_size = static_cast<float>(max_grid_size_ / power2);
90 VoxelGridCovariance<PointT> vgc;
91 vgc.setInputCloud(pointcloud_ptr);
92 vgc.SetMinPointPerVoxel(min_planepoints_number_);
93 vgc.setLeafSize(grid_size, grid_size, grid_size);
94 vgc.Filter(false);
95
96 PointCloudT cloud_tmp;
97 int plane_num = 0;
98 typename std::map<size_t, VoxelGridCovariance<PointT>::Leaf>::iterator it;
99 for (it = vgc.GetLeaves().begin(); it != vgc.GetLeaves().end(); it++) {
100 if (it->second.GetPointCount() < min_planepoints_number_) {
101 cloud_tmp += it->second.cloud_;
102 continue;
103 }
104 PointCloudT cloud_outlier;
105 if (GetPlaneFeaturePoint(it->second.cloud_, &cloud_outlier)) {
106 cloud_tmp += cloud_outlier;
107 plane_num++;
108 } else {
109 cloud_tmp += it->second.cloud_;
110 }
111 }
112 AINFO << "the " << iter << " interation: plane_num = " << plane_num;
113 total_plane_num += plane_num;
114 pointcloud_ptr.reset(new PointCloudT);
115 *pointcloud_ptr = cloud_tmp;
116 }
117
118 *non_xy_plane_cloud_ = *pointcloud_ptr;
119 plane_time = std::clock() - plane_time;
120 AINFO << "plane_patch takes:"
121 << static_cast<double>(plane_time) / CLOCKS_PER_SEC << "sec.";
122 AINFO << "total_plane_num = " << total_plane_num;
123 AINFO << "total_points_num = " << xy_plane_cloud_->points.size();
124 return;
125 }
#define AINFO
Definition log.h:42

◆ GetNonXYPlaneCloud()

PointCloudPtrT & apollo::localization::msf::FeatureXYPlane::GetNonXYPlaneCloud ( )
inline

在文件 extract_ground_plane.h73 行定义.

73{ return non_xy_plane_cloud_; }

◆ GetXYPlaneCloud()

PointCloudPtrT & apollo::localization::msf::FeatureXYPlane::GetXYPlaneCloud ( )
inline

在文件 extract_ground_plane.h71 行定义.

71{ return xy_plane_cloud_; }

◆ SetBelowLidarHeight()

void apollo::localization::msf::FeatureXYPlane::SetBelowLidarHeight ( double  d)
inline

在文件 extract_ground_plane.h63 行定义.

63{ below_lidar_height_ = d; }

◆ SetMaxGridSize()

void apollo::localization::msf::FeatureXYPlane::SetMaxGridSize ( double  d)
inline

在文件 extract_ground_plane.h53 行定义.

53{ max_grid_size_ = d; }

◆ SetMinGridSize()

void apollo::localization::msf::FeatureXYPlane::SetMinGridSize ( double  d)
inline

在文件 extract_ground_plane.h51 行定义.

51{ min_grid_size_ = d; }

◆ SetMinPlanepointsNumber()

void apollo::localization::msf::FeatureXYPlane::SetMinPlanepointsNumber ( double  d)
inline

在文件 extract_ground_plane.h57 行定义.

57 {
58 min_planepoints_number_ = static_cast<int>(d);
59 }

◆ SetPlaneInlierDistance()

void apollo::localization::msf::FeatureXYPlane::SetPlaneInlierDistance ( double  d)
inline

在文件 extract_ground_plane.h55 行定义.

55{ plane_inlier_distance_ = d; }

◆ SetPlaneTypeDegree()

void apollo::localization::msf::FeatureXYPlane::SetPlaneTypeDegree ( double  d)
inline

在文件 extract_ground_plane.h61 行定义.

61{ plane_type_degree_ = d; }

该类的文档由以下文件生成: