|
@@ -604,21 +604,32 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
t_width_extract_cloud->operator+=(m_detector->m_right_rear_cloud);
|
|
|
|
|
|
pcl::PointXYZ t_rough_min_p, t_rough_max_p;
|
|
|
+ //add by zzw
|
|
|
+ pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_for_width_upwheel(new pcl::PointCloud<pcl::PointXYZ>);
|
|
|
+ for (int i = 0; i < t_width_rough_cloud->size(); ++i)
|
|
|
+ {
|
|
|
+ pcl::PointXYZ pt = t_width_rough_cloud->points[i];
|
|
|
+ if (pt.z > chassis_z)
|
|
|
+ {
|
|
|
+ cloud_for_width_upwheel->push_back(pt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// rough width for human detect
|
|
|
{
|
|
|
//离群点过滤
|
|
|
- sor.setInputCloud(t_width_rough_cloud);
|
|
|
+ sor.setInputCloud(cloud_for_width_upwheel);
|
|
|
sor.setMeanK(5); //K近邻搜索点个数
|
|
|
sor.setStddevMulThresh(1.0); //标准差倍数
|
|
|
sor.setNegative(false); //保留未滤波点(内点)
|
|
|
- sor.filter(*t_width_rough_cloud); //保存滤波结果到cloud_filter
|
|
|
+ sor.filter(*cloud_for_width_upwheel); //保存滤波结果到cloud_filter
|
|
|
|
|
|
Eigen::Affine3d t_affine = Eigen::Affine3d::Identity();
|
|
|
t_affine.prerotate(Eigen::AngleAxisd((90 - last_result.theta) * M_PI / 180.0, Eigen::Vector3d::UnitZ()));
|
|
|
- pcl::transformPointCloud(*t_width_rough_cloud, *t_width_rough_cloud, t_affine.matrix());
|
|
|
+ pcl::transformPointCloud(*cloud_for_width_upwheel, *cloud_for_width_upwheel, t_affine.matrix());
|
|
|
|
|
|
// 车宽重计算,并赋值到当前车宽
|
|
|
- pcl::getMinMax3D(*t_width_rough_cloud, t_rough_min_p, t_rough_max_p);
|
|
|
+ pcl::getMinMax3D(*cloud_for_width_upwheel, t_rough_min_p, t_rough_max_p);
|
|
|
}
|
|
|
double rough_width = t_rough_max_p.x - t_rough_min_p.x;
|
|
|
|
|
@@ -640,7 +651,7 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
double accurate_width = t_max_p.x - t_min_p.x;
|
|
|
last_result.width = accurate_width;
|
|
|
|
|
|
- if(fabs(rough_width - accurate_width) > 0.08)
|
|
|
+ if(fabs(rough_width - accurate_width) > 0.15)
|
|
|
{
|
|
|
std::string disp_str = std::string("width difference too large, assume noise situation, ")+std::to_string(rough_width)+", "+std::to_string(accurate_width);
|
|
|
LOG(WARNING) << disp_str;
|