@@ -38,6 +38,7 @@ class IBAGlobalParams{
3838 double corr_3d_3d_threshold = 5 .;
3939 double he_threshold = 0.05 ;
4040 int norm_max_pts = 30 ;
41+ int norm_min_pts = 5 ;
4142 double norm_radius = 0.6 ;
4243 double norm_reg_threshold = 0.04 ;
4344 double min_diff_dist = 0.01 ;
@@ -109,7 +110,8 @@ void FindProjectCorrespondences(const VecVector3d &points, const ORB_SLAM2::KeyF
109110 * @return std::tuple<bool, double>
110111 */
111112std::tuple<bool , double > ComputeAlignmentDist (const KDTree3D* kdtree, const VecVector3d &PointCloud, const Eigen::Vector3d &query_pt,
112- const int &norm_max_pts, const double &norm_radius, const double &norm_reg_threshold, const double &min_diff_dist, const bool use_plane=true )
113+ const int &norm_max_pts, const int &norm_min_pts, const double &norm_radius,
114+ const double &norm_reg_threshold, const double &min_diff_dist, const bool use_plane=true )
113115{
114116 // find nearest point of Laser Scan to query_pt
115117 VecIndex nn_idx (1 );
@@ -132,24 +134,22 @@ std::tuple<bool, double> ComputeAlignmentDist(const KDTree3D* kdtree, const VecV
132134 norm_radius * norm_radius)); // iterator difference between start and last valid index
133135 indices.resize (k);
134136 sq_dist.resize (k);
135- if (k < 3 )
137+ if (sq_dist[k-1 ] < min_diff_dist * min_diff_dist)
138+ return {false , pt2pt_dist};
139+ if (k < norm_min_pts)
136140 return {false , pt2pt_dist};
137141 Eigen::Matrix3d covariance = ComputeCovariance (PointCloud, indices);
138- Eigen::Vector3d normal, eval ;
142+ Eigen::Vector3d normal;
139143 std::tie (normal, std::ignore) = FastEigen3x3_EV (covariance);
140144 normal.normalize ();
141145 double reg_err = 0 ;
142146 for (auto const &idx:indices)
143147 reg_err += std::abs ((PointCloud[idx] - nn_pt).dot (normal));
144- if (reg_err / (indices. size () - 1 ) > norm_reg_threshold) // not include indices[0]
148+ if (reg_err / (k - 1 ) > norm_reg_threshold) // not include indices[0]
145149 return {false , pt2pt_dist};
146150 else
147151 {
148152 double max_dist = 0 ;
149- for (auto const &idx:indices)
150- max_dist = std::max ((PointCloud[idx] - nn_pt).norm (), max_dist);
151- if (max_dist < min_diff_dist) // not s.t. difference condition
152- return {false , pt2pt_dist};
153153 double pt2pl_dist = std::abs ((nn_pt - query_pt).dot (normal));
154154 return {true , pt2pl_dist};
155155 }
@@ -235,8 +235,8 @@ std::tuple<double, double, double, int, int> BAError(
235235 MapRefPose = Tcl.inverse () * MapRefPose; // Pli
236236 bool is_planefit;
237237 double dist;
238- std::tie (is_planefit, dist) = ComputeAlignmentDist (KdTrees[Fi].get (), PL, MapRefPose,
239- iba_params.norm_max_pts , iba_params.norm_radius , iba_params.norm_reg_threshold , iba_params.min_diff_dist , iba_params.use_plane );
238+ std::tie (is_planefit, dist) = ComputeAlignmentDist (KdTrees[Fi].get (), PL, MapRefPose, iba_params. norm_max_pts ,
239+ iba_params.norm_min_pts , iba_params.norm_radius , iba_params.norm_reg_threshold , iba_params.min_diff_dist , iba_params.use_plane );
240240 #pragma omp critical
241241 {
242242 if (dist < iba_params.corr_3d_3d_threshold )
@@ -445,6 +445,7 @@ int main(int argc, char** argv){
445445 iba_params.corr_3d_2d_threshold = runtime_config[" corr_3d_2d_threshold" ].as <double >();
446446 iba_params.corr_3d_3d_threshold = runtime_config[" corr_3d_3d_threshold" ].as <double >();
447447 iba_params.norm_max_pts = runtime_config[" norm_max_pts" ].as <int >();
448+ iba_params.norm_min_pts = runtime_config[" norm_min_pts" ].as <int >();
448449 iba_params.norm_radius = runtime_config[" norm_radius" ].as <double >();
449450 iba_params.norm_reg_threshold = runtime_config[" norm_reg_threshold" ].as <double >();
450451 iba_params.min_diff_dist = runtime_config[" min_diff_dist" ].as <double >();
@@ -461,12 +462,11 @@ int main(int argc, char** argv){
461462 int seed = runtime_config[" seed" ].as <int >();
462463 const std::string NomadCacheFile = runtime_config[" cacheFile" ].as <std::string>();
463464 const double min_mesh = runtime_config[" min_mesh" ].as <double >();
464- const std::vector<double > init_mesh_size = runtime_config[" init_mesh " ].as <std::vector<double >>();
465+ const std::vector<double > init_frame_size = runtime_config[" init_frame " ].as <std::vector<double >>();
465466 std::vector<double > min_mesh_size (7 , min_mesh);
466467 YAML::Node FrameIdCfg = YAML::LoadFile (KyeFrameIdFile);
467468 std::vector<int > vKFFrameId = FrameIdCfg[" mnFrameId" ].as <std::vector<int >>();
468469
469- std::vector<VecVector3d> PointClouds;
470470 std::vector<Eigen::Isometry3d> RawPointCloudPoses, PointCloudPoses;
471471 ReadPoseList (TwlFile, RawPointCloudPoses);
472472 PointCloudPoses.reserve (vKFFrameId.size ());
@@ -479,6 +479,7 @@ int main(int argc, char** argv){
479479 for (auto &KFId: vKFFrameId)
480480 PointCloudPoses.push_back (refPose * RawPointCloudPoses[KFId]);
481481 }
482+ std::vector<VecVector3d> PointClouds;
482483 PointClouds.resize (vKFFrameId.size ());
483484
484485 int numFiles = 0 ;
@@ -550,7 +551,7 @@ int main(int argc, char** argv){
550551 nomad_params->set_DIMENSION (7 );
551552 NOMAD::BBOutputTypeList bbOutputTypes;
552553 bbOutputTypes.push_back (NOMAD::BBOutputType::OBJ);
553- bbOutputTypes.push_back (NOMAD::BBOutputType::PB); // Relaxible Constraint
554+ bbOutputTypes.push_back (NOMAD::BBOutputType::PB); // Relaxible Constraint |he_err| < delta
554555 bbOutputTypes.push_back (NOMAD::BBOutputType::PB); // Relaxible Constraint
555556 nomad_params->set_BB_OUTPUT_TYPE (bbOutputTypes);
556557 NOMAD::ArrayOfDouble nomad_lb (lb), nomad_ub (ub);
@@ -562,9 +563,11 @@ int main(int argc, char** argv){
562563 nomad_params->set_SEED (seed);
563564 if (use_cache)
564565 nomad_params->setAttributeValue (" CACHE_FILE" , NomadCacheFile);
565- NOMAD::ArrayOfDouble nomad_mesh_minsize (min_mesh_size), nomad_mesh_init (init_mesh_size );
566- nomad_params->set_INITIAL_MESH_SIZE (nomad_mesh_init );
566+ NOMAD::ArrayOfDouble nomad_mesh_minsize (min_mesh_size), nomad_frame_init (init_frame_size );
567+ nomad_params->set_INITIAL_POLL_SIZE (nomad_frame_init );
567568 nomad_params->set_MIN_MESH_SIZE (nomad_mesh_minsize);
569+ nomad_params->setAttributeValue (" VNS_MADS_SEARCH" ,true );
570+ nomad_params->setAttributeValue (" DIRECTION_TYPE" ,NOMAD::DirectionType::ORTHO_2N);
568571 nomad_params->checkAndComply ();
569572 auto ev = std::make_unique<BALoss>(nomad_params->getEvalParams (), nomad_type,
570573 &PointCloudPoses, &PointClouds, &KFIdMap, &KeyFrames, &iba_params, special_points);
0 commit comments