@@ -368,7 +368,13 @@ void SubMapping::insert_keyframe(const int current, const EstimationFrame::Const
368368 for (int i = 0 ; i < frame->size (); i++) {
369369 frame->points [i] = odom_frame->T_lidar_imu .inverse () * frame->points [i];
370370 }
371- frame->add_covs (covariance_estimation->estimate (frame->points_storage , odom_frame->raw_frame ->neighbors ));
371+
372+ std::vector<Eigen::Vector4d> normals;
373+ std::vector<Eigen::Matrix4d> covs;
374+ covariance_estimation->estimate (frame->points_storage , odom_frame->raw_frame ->neighbors , normals, covs);
375+ frame->add_normals (normals);
376+ frame->add_covs (covs);
377+
372378 if (!odom_frame->raw_frame ->intensities .empty ()) {
373379 frame->add_intensities (odom_frame->raw_frame ->intensities );
374380 }
@@ -487,16 +493,10 @@ SubMap::Ptr SubMapping::create_submap(bool force_create) const {
487493#endif
488494
489495 if (submap->frame == nullptr ) {
490- submap->frame = gtsam_points::merge_frames_auto (poses_to_merge, keyframes_to_merge, params.submap_downsample_resolution );
496+ submap->frame = gtsam_points::merge_frames (poses_to_merge, keyframes_to_merge, params.submap_downsample_resolution , params. submap_target_num_points );
491497 }
492498 logger->debug (" |merged_submap|={}" , submap->frame ->size ());
493499
494- if (params.submap_target_num_points > 0 && submap->frame ->size () > params.submap_target_num_points ) {
495- std::mt19937 mt (submap_count * 643145 + submap->frame ->size () * 4312 ); // Just a random-like seed
496- submap->frame = gtsam_points::random_sampling (submap->frame , static_cast <double >(params.submap_target_num_points ) / submap->frame ->size (), mt);
497- logger->debug (" |subsampled_submap|={}" , submap->frame ->size ());
498- }
499-
500500 return submap;
501501}
502502
0 commit comments