|
|
@@ -247,17 +247,20 @@ bool Ground_region::classify_ceres_detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cl
|
|
|
return false;
|
|
|
}
|
|
|
std::vector<cv::Point2f> centers;
|
|
|
+ cv::Point2f temp_centers(0,0);
|
|
|
for (int i = 0; i < seg_clouds.size(); ++i)
|
|
|
{
|
|
|
Eigen::Vector4f centroid;
|
|
|
pcl::compute3DCentroid(*seg_clouds[i], centroid);
|
|
|
centers.push_back(cv::Point2f(centroid[0], centroid[1]));
|
|
|
+ temp_centers += cv::Point2f(centroid[0], centroid[1]);
|
|
|
}
|
|
|
+ temp_centers /= 4.0f;
|
|
|
bool ret = isRect(centers);
|
|
|
if (ret)
|
|
|
{
|
|
|
-
|
|
|
std::string error_str;
|
|
|
+ // LOG(WARNING) << "region id: "<< m_region.region_id();
|
|
|
if (m_detector->detect(seg_clouds, result, error_str))
|
|
|
{
|
|
|
return true;
|
|
|
@@ -412,7 +415,7 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
{
|
|
|
return Error_manager(VELODYNE_REGION_CERES_SOLVE_ERROR, NEGLIGIBLE_ERROR, "find general car pose value failed.");
|
|
|
}
|
|
|
- // LOG(INFO) << "car pose :::: cx: " << x+m_region.plc_offsetx() << ", cy: " << y+m_region.plc_offsety() << ", theta: " << theta*180.0/M_PI << std::endl;
|
|
|
+ // LOG_IF(INFO, m_region.region_id() == 0) << "car pose :::: cx: " << car_pose_x+m_region.plc_offsetx() << ", cy: " << car_pose_y+m_region.plc_offsety() << ", theta: " << car_pose_theta*180.0/M_PI << std::endl;
|
|
|
|
|
|
std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now();
|
|
|
std::chrono::duration<double> time_used_bowl = std::chrono::duration_cast<std::chrono::duration<double>>(t2 - t1);
|
|
|
@@ -492,7 +495,9 @@ Error_manager Ground_region::detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, d
|
|
|
|
|
|
while (chassis_z > (mid_z - height / 2.0))
|
|
|
{
|
|
|
- // LOG_IF(WARNING, m_region.region_id() == 4) << "chassis z: " << chassis_z << ", midz: " << mid_z - height / 2.0;
|
|
|
+ // LOG_IF(WARNING, m_region.region_id() == 0) << "chassis z: " << chassis_z << ", midz: " << mid_z - height / 2.0;
|
|
|
+ // 初值中x使用第一步优化的值
|
|
|
+ result.cx = car_pose_x;
|
|
|
ret = classify_ceres_detect(cloud_filtered, chassis_z, result);
|
|
|
// changed by yct, 根据底盘z识别,失败则向下移动直至成功或超过底盘内空中点
|
|
|
if(ret)
|
|
|
@@ -733,6 +738,8 @@ void Ground_region::thread_measure_func()
|
|
|
Error_manager ec = detect(mp_cloud_collection, t_result);
|
|
|
|
|
|
std::lock_guard<std::mutex> lck(m_car_result_mutex);
|
|
|
+ // 增加滤波轴距
|
|
|
+ Common_data::Car_wheel_information_stamped t_wheel_info_stamped;
|
|
|
if (ec == SUCCESS)
|
|
|
{
|
|
|
m_car_wheel_information.correctness = true;
|
|
|
@@ -755,17 +762,24 @@ void Ground_region::thread_measure_func()
|
|
|
m_car_wheel_information.uniform_car_x += m_region.plc_offsetx();
|
|
|
m_car_wheel_information.uniform_car_y += m_region.plc_offsety();
|
|
|
|
|
|
- Common_data::Car_wheel_information_stamped t_wheel_info_stamped;
|
|
|
t_wheel_info_stamped.wheel_data = m_car_wheel_information;
|
|
|
- t_wheel_info_stamped.measure_time = m_detect_update_time;
|
|
|
- Measure_filter::get_instance_references().update_data(m_region.region_id(), t_wheel_info_stamped);
|
|
|
+ t_wheel_info_stamped.measure_time = m_detect_update_time;
|
|
|
+ Measure_filter::get_instance_references().update_data(m_region.region_id(), t_wheel_info_stamped);
|
|
|
|
|
|
+ ec = Measure_filter::get_instance_references().get_filtered_wheel_information(m_region.region_id(), t_wheel_info_stamped.wheel_data);
|
|
|
+ if (ec == SUCCESS)
|
|
|
+ {
|
|
|
+ m_car_wheel_information.car_wheel_base = t_wheel_info_stamped.wheel_data.car_wheel_base;
|
|
|
+ }
|
|
|
+ // else{
|
|
|
+ // std::cout<<ec.to_string()<<std::endl;
|
|
|
+ // }
|
|
|
//LOG_IF(INFO, m_region.region_id() == 4) << m_car_wheel_information.to_string();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_car_wheel_information.correctness = false;
|
|
|
- //LOG_IF(ERROR, m_region.region_id() == 4) << ec.to_string();
|
|
|
+ // LOG_IF(ERROR, m_region.region_id() == 0) << ec.to_string();
|
|
|
}
|
|
|
m_detect_update_time = std::chrono::system_clock::now();
|
|
|
}
|