|
@@ -402,7 +402,8 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
sor.setNegative(false); //保留未滤波点(内点)
|
|
|
sor.filter(*cloud_filtered); //保存滤波结果到cloud_filter
|
|
|
|
|
|
- if (cloud_filtered->size() == 0){
|
|
|
+ // 20221211 changed by yct, 10 point threshold
|
|
|
+ if (cloud_filtered->size() <= 10){
|
|
|
// 更新过滤点
|
|
|
m_filtered_cloud_mutex.lock();
|
|
|
mp_cloud_filtered->clear();
|
|
@@ -586,12 +587,33 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
|
|
|
// 车宽精度优化
|
|
|
{
|
|
|
+ pcl::PointCloud<pcl::PointXYZ>::Ptr t_width_rough_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
|
|
|
pcl::PointCloud<pcl::PointXYZ>::Ptr t_width_extract_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
|
|
|
+ t_width_rough_cloud->operator+=(*mp_cloud_filtered);
|
|
|
t_width_extract_cloud->operator+=(m_detector->m_left_front_cloud);
|
|
|
t_width_extract_cloud->operator+=(m_detector->m_right_front_cloud);
|
|
|
t_width_extract_cloud->operator+=(m_detector->m_left_rear_cloud);
|
|
|
t_width_extract_cloud->operator+=(m_detector->m_right_rear_cloud);
|
|
|
|
|
|
+ pcl::PointXYZ t_rough_min_p, t_rough_max_p;
|
|
|
+ // rough width for human detect
|
|
|
+ {
|
|
|
+ //离群点过滤
|
|
|
+ sor.setInputCloud(t_width_rough_cloud);
|
|
|
+ sor.setMeanK(5); //K近邻搜索点个数
|
|
|
+ sor.setStddevMulThresh(1.0); //标准差倍数
|
|
|
+ sor.setNegative(false); //保留未滤波点(内点)
|
|
|
+ sor.filter(*t_width_rough_cloud); //保存滤波结果到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::getMinMax3D(*t_width_rough_cloud, t_rough_min_p, t_rough_max_p);
|
|
|
+ }
|
|
|
+ double rough_width = t_rough_max_p.x - t_rough_min_p.x;
|
|
|
+
|
|
|
//离群点过滤
|
|
|
sor.setInputCloud(t_width_extract_cloud);
|
|
|
sor.setMeanK(5); //K近邻搜索点个数
|
|
@@ -610,6 +632,13 @@ 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)
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+ return Error_manager(VELODYNE_REGION_CERES_SOLVE_ERROR, MINOR_ERROR, disp_str.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
// !!!暂时不限制宽度数据
|
|
|
// char valid_info[255];
|
|
|
// sprintf(valid_info, "validation for car width, origin/accurate: (%.3f, %.3f)", last_result.width, accurate_width);
|
|
@@ -723,9 +752,9 @@ int Ground_region::outOfRangeDetection(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud
|
|
|
|
|
|
int Ground_region::outOfRangeDetection(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, Common_data::Car_wheel_information measure_result, double plate_cx, double plate_cy, double theta)
|
|
|
{
|
|
|
- int res = Range_status::Range_correct;
|
|
|
+ // int res = Range_status::Range_correct;
|
|
|
if(cloud->size() <= 0)
|
|
|
- return res;
|
|
|
+ return Range_status::Range_correct;
|
|
|
|
|
|
// 计算转盘旋转后车辆中心点坐标
|
|
|
Eigen::Vector2d car_center(measure_result.car_center_x, measure_result.car_center_y);
|
|
@@ -836,7 +865,7 @@ int Ground_region::outOfRangeDetection(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud
|
|
|
if (measure_result.car_wheel_base < m_region.car_min_wheelbase()-0.000 ||
|
|
|
measure_result.car_wheel_base > m_region.car_max_wheelbase()+0.000)
|
|
|
{
|
|
|
- res |= Range_status::Range_car_wheelbase;
|
|
|
+ m_range_status_last |= Range_status::Range_car_wheelbase;
|
|
|
}
|
|
|
else if (measure_result.car_wheel_base > m_region.car_min_wheelbase()+0.010 ||
|
|
|
measure_result.car_wheel_base < m_region.car_max_wheelbase()-0.010)
|
|
@@ -845,7 +874,7 @@ int Ground_region::outOfRangeDetection(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud
|
|
|
m_range_status_last &= (~t);
|
|
|
}
|
|
|
//else m_range_status_last no change
|
|
|
- // LOG(WARNING) << m_range_status_last;
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 4) << m_range_status_last;
|
|
|
|
|
|
// 判断车辆旋转角超界情况
|
|
|
//huli new program 20221103, 使用 plc dispatch_1_statu_port 里面的 来做边界判断
|
|
@@ -862,19 +891,19 @@ int Ground_region::outOfRangeDetection(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud
|
|
|
int t = Range_status::Range_angle_anti_clock;
|
|
|
m_range_status_last &= (~t);
|
|
|
}
|
|
|
- // LOG(WARNING) << m_range_status_last;
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 4) << m_range_status_last;
|
|
|
|
|
|
//else m_range_status_last no change
|
|
|
if (t_dtheta < System_communication_mq::get_instance_references().dispatch_region_info_map[t_terminal_id].turnplate_angle_min()-0.00)
|
|
|
{
|
|
|
- res |= Range_status::Range_angle_clock;
|
|
|
+ m_range_status_last |= Range_status::Range_angle_clock;
|
|
|
}
|
|
|
else if (t_dtheta > System_communication_mq::get_instance_references().dispatch_region_info_map[t_terminal_id].turnplate_angle_min()+0.10)
|
|
|
{
|
|
|
int t = Range_status::Range_angle_clock;
|
|
|
m_range_status_last &= (~t);
|
|
|
}
|
|
|
- // LOG(WARNING) << m_range_status_last;
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 4) << m_range_status_last <<", t_dtheta "<<t_dtheta<<", minmax: "<<System_communication_mq::get_instance_references().dispatch_region_info_map[t_terminal_id].turnplate_angle_min()<<", "<<System_communication_mq::get_instance_references().dispatch_region_info_map[t_terminal_id].turnplate_angle_max();
|
|
|
// LOG(INFO) << t_dtheta<<", "<<System_communication_mq::get_instance_references().dispatch_region_info_map[t_terminal_id].turnplate_angle_min()<<std::endl;
|
|
|
//else m_range_status_last no change
|
|
|
|
|
@@ -1001,6 +1030,7 @@ void Ground_region::thread_measure_func()
|
|
|
std::lock_guard<std::mutex> lck(m_filtered_cloud_mutex);
|
|
|
int res = outOfRangeDetection(mp_cloud_filtered, m_car_wheel_information, m_region.turnplate_cx(), m_region.turnplate_cy(), 90.0 - t_result.theta);
|
|
|
m_car_wheel_information.range_status = res;
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 4) << res;
|
|
|
}
|
|
|
// 添加plc偏移
|
|
|
m_car_wheel_information.car_center_x += m_region.plc_offsetx();
|
|
@@ -1062,7 +1092,7 @@ void Ground_region::thread_measure_func()
|
|
|
// else{
|
|
|
// std::cout<<ec.to_string()<<std::endl;
|
|
|
// }
|
|
|
- // LOG_IF(INFO, m_region.region_id() == 1) << m_car_wheel_information.to_string();
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 4) << m_car_wheel_information.to_string();
|
|
|
}
|
|
|
else
|
|
|
{
|