52 BaseGroundDetectorRegisterer::GetInstanceByName(
53 FLAGS_ground_detector_name);
54 CHECK_NOTNULL(ground_detector);
58 ground_detector_init_options.
config_path = FLAGS_config_path;
59 ground_detector_init_options.
config_file = FLAGS_config_file;
61 <<
"Failed to init ground detection.";
67 const Eigen::Affine3d& pose,
69 if (local_cloud ==
nullptr) {
73 world_cloud->reserve(local_cloud->size());
74 for (
size_t i = 0; i < local_cloud->size(); ++i) {
75 auto& pt = local_cloud->at(i);
76 Eigen::Vector3d trans_point(pt.x, pt.y, pt.z);
77 trans_point = pose * trans_point;
79 world_point.
x = trans_point(0);
80 world_point.
y = trans_point(1);
81 world_point.
z = trans_point(2);
83 world_cloud->push_back(world_point, local_cloud->points_timestamp(i),
84 std::numeric_limits<float>::max(),
85 local_cloud->points_beam_id()[i], 0);
91 std::string pcd_folder = FLAGS_pcd_path;
92 std::vector<std::string> pcd_file_names;
94 AERROR <<
"pcd_folder: " << pcd_folder <<
" get file list error.";
98 std::sort(pcd_file_names.begin(), pcd_file_names.end(),
99 [](
const std::string& lhs,
const std::string& rhs) {
100 if (lhs.length() != rhs.length()) {
101 return lhs.length() < rhs.length();
106 for (
size_t i = 0; i < pcd_file_names.size(); ++i) {
107 AINFO <<
"***************** Frame " << i <<
" ******************";
108 AINFO << pcd_file_names[i];
111 if (frame->cloud ==
nullptr) {
112 frame->cloud = base::PointFCloudPool::Instance().Get();
114 if (frame->world_cloud ==
nullptr) {
115 frame->world_cloud = base::PointDCloudPool::Instance().Get();
117 LoadPCLPCD(pcd_file_names[i], frame->cloud.get());
119 TransformCloud(frame->cloud, frame->lidar2world_pose, frame->world_cloud);
120 AINFO <<
"Read point cloud from " << pcd_file_names[i]
121 <<
" with cloud size: " << frame->cloud->size();
123 GroundDetectorOptions ground_detector_options;
125 AERROR <<
"Ground detect error.";
129 std::string output_path = FLAGS_output_path;
130 SavePCD(i, frame.get(), output_path);