Skip to content

Commit

Permalink
Add separate optimization solver params for pre-pgo tracking and post…
Browse files Browse the repository at this point in the history
…-pgo VF adjustment
  • Loading branch information
mandi1267 committed Dec 13, 2023
1 parent 6477b98 commit 9d77230
Show file tree
Hide file tree
Showing 8 changed files with 564 additions and 5 deletions.
494 changes: 494 additions & 0 deletions config/update_revision_base.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions include/file_io/cv_file_storage/config_file_storage_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,17 @@ class SerializablePoseGraphPlusObjectsOptimizationParams
fs << kFinalPgoOptimizationSolverParamsLabel
<< SerializableOptimizationSolverParams(
data_.final_pgo_optimization_solver_params_);

fs << kPostPgoVfAdjustmentSolverParamsLabel
<< SerializableOptimizationSolverParams(
data_.post_pgo_vf_adjustment_solver_params_);
fs << kFinalPostPgoVfAdjustmentSolverParamsLabel
<< SerializableOptimizationSolverParams(
data_.final_post_pgo_vf_adjustment_solver_params_);
fs << kPrePgoTrackingSolverParamsLabel
<< SerializableOptimizationSolverParams(
data_.pre_pgo_tracking_solver_params_);

fs << "}";
}

Expand Down Expand Up @@ -711,6 +722,24 @@ class SerializablePoseGraphPlusObjectsOptimizationParams
ser_final_pgo_optimization_solver_params_;
data_.final_pgo_optimization_solver_params_ =
ser_final_pgo_optimization_solver_params_.getEntry();

SerializableOptimizationSolverParams
ser_post_pgo_vf_adjustment_solver_params;
node[kPostPgoVfAdjustmentSolverParamsLabel] >>
ser_post_pgo_vf_adjustment_solver_params;
data_.post_pgo_vf_adjustment_solver_params_ =
ser_post_pgo_vf_adjustment_solver_params.getEntry();
SerializableOptimizationSolverParams
ser_final_post_pgo_vf_adjustment_solver_params;
node[kFinalPostPgoVfAdjustmentSolverParamsLabel] >>
ser_final_post_pgo_vf_adjustment_solver_params;
data_.final_post_pgo_vf_adjustment_solver_params_ =
ser_final_post_pgo_vf_adjustment_solver_params.getEntry();
SerializableOptimizationSolverParams ser_pre_pgo_tracking_solver_params;
node[kPrePgoTrackingSolverParamsLabel] >>
ser_pre_pgo_tracking_solver_params;
data_.pre_pgo_tracking_solver_params_ =
ser_pre_pgo_tracking_solver_params.getEntry();
}

protected:
Expand All @@ -731,6 +760,12 @@ class SerializablePoseGraphPlusObjectsOptimizationParams
"pgo_optimization_solver_params";
inline static const std::string kFinalPgoOptimizationSolverParamsLabel =
"final_pgo_optimization_solver_params";
inline static const std::string kPostPgoVfAdjustmentSolverParamsLabel =
"post_pgo_vf_adjustment_solver_params";
inline static const std::string kFinalPostPgoVfAdjustmentSolverParamsLabel =
"final_post_pgo_vf_adjustment_solver_params";
inline static const std::string kPrePgoTrackingSolverParamsLabel =
"pre_pgo_tracking_solver_params";
};

static void write(
Expand Down
2 changes: 1 addition & 1 deletion include/refactoring/configuration/full_ov_slam_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace vslam_types_refactor {

// NOTE: This should be incremented every time the format of the configuration
// data changes
const static int kCurrentConfigSchemaVersion = 13;
const static int kCurrentConfigSchemaVersion = 14;

struct VisualFeatureParams {
double reprojection_error_std_dev_;
Expand Down
2 changes: 1 addition & 1 deletion include/refactoring/offline/offline_problem_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class OfflineProblemRunner {
std::make_shared<ceres::Solver::Summary>();
if (!optimizer_.solveOptimization(
&problem,
iteration_params.phase_one_opt_params_,
pgo_solver_params_.pre_pgo_tracking_solver_params_,
ceres_callbacks,
null_logger,
nullptr,
Expand Down
11 changes: 10 additions & 1 deletion include/refactoring/optimization/optimization_solver_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ struct PoseGraphPlusObjectsOptimizationParams {
RelativePoseCovarianceOdomModelParams relative_pose_cov_params_;
OptimizationSolverParams pgo_optimization_solver_params_;
OptimizationSolverParams final_pgo_optimization_solver_params_;
OptimizationSolverParams post_pgo_vf_adjustment_solver_params_;
OptimizationSolverParams final_post_pgo_vf_adjustment_solver_params_;
OptimizationSolverParams pre_pgo_tracking_solver_params_;

bool operator==(const PoseGraphPlusObjectsOptimizationParams &rhs) const {
return (relative_pose_factor_huber_loss_ ==
Expand All @@ -189,7 +192,13 @@ struct PoseGraphPlusObjectsOptimizationParams {
(pgo_optimization_solver_params_ ==
rhs.pgo_optimization_solver_params_) &&
(final_pgo_optimization_solver_params_ ==
rhs.final_pgo_optimization_solver_params_);
rhs.final_pgo_optimization_solver_params_) &&
(post_pgo_vf_adjustment_solver_params_ ==
rhs.post_pgo_vf_adjustment_solver_params_) &&
(final_post_pgo_vf_adjustment_solver_params_ ==
rhs.final_post_pgo_vf_adjustment_solver_params_) &&
(pre_pgo_tracking_solver_params_ ==
rhs.pre_pgo_tracking_solver_params_);
}

bool operator!=(const PoseGraphPlusObjectsOptimizationParams &rhs) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ bool runPgoPlusEllipsoids(
if (!optimizer.solveOptimization(
&problem,
final_run
? pgo_solver_params.final_pgo_optimization_solver_params_
: pgo_solver_params.pgo_optimization_solver_params_,
? pgo_solver_params.final_post_pgo_vf_adjustment_solver_params_
: pgo_solver_params.post_pgo_vf_adjustment_solver_params_,
ceres_callbacks,
null_logger,
nullptr,
Expand Down
7 changes: 7 additions & 0 deletions src/refactoring/configuration/write_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ int main(int argc, char **argv) {
global_ba_solver_params;
configuration.pgo_solver_params_.final_pgo_optimization_solver_params_ =
final_opt_solver_params;
configuration.pgo_solver_params_.final_post_pgo_vf_adjustment_solver_params_ =
final_ba_iteration_params.phase_two_opt_params_;
configuration.pgo_solver_params_.post_pgo_vf_adjustment_solver_params_ =
local_ba_iteration_params.phase_two_opt_params_;
configuration.pgo_solver_params_.pre_pgo_tracking_solver_params_ =
local_ba_iteration_params.phase_two_opt_params_;

pose_graph_optimization::RelativePoseCovarianceOdomModelParams
relative_pose_cov_params;
relative_pose_cov_params.transl_error_mult_for_transl_error_ = 0.1;
Expand Down
14 changes: 14 additions & 0 deletions test/file_io/cv_file_storage/config_file_storage_io_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,20 @@ TEST(FullOVSLAMConfigIO, ReadWriteFullOBSLAMConfig) {
orig_config.pgo_solver_params_.enable_visual_feats_only_opt_post_pgo_ = true;
orig_config.pgo_solver_params_
.enable_visual_non_opt_feature_adjustment_post_pgo_ = false;
orig_config.pgo_solver_params_.final_post_pgo_vf_adjustment_solver_params_ =
orig_config.final_ba_iteration_params_.phase_two_opt_params_;
orig_config.pgo_solver_params_.final_post_pgo_vf_adjustment_solver_params_
.max_num_iterations_ = 567;

orig_config.pgo_solver_params_.post_pgo_vf_adjustment_solver_params_ =
orig_config.local_ba_iteration_params_.phase_two_opt_params_;
orig_config.pgo_solver_params_.post_pgo_vf_adjustment_solver_params_
.max_num_iterations_ = 523;

orig_config.pgo_solver_params_.pre_pgo_tracking_solver_params_ =
orig_config.local_ba_iteration_params_.phase_two_opt_params_;
orig_config.pgo_solver_params_.pre_pgo_tracking_solver_params_
.function_tolerance_ = 1.2857;

LongTermMapExtractionTunableParams ltm_tunable_params;
ltm_tunable_params.far_feature_threshold_ = 2.4;
Expand Down

0 comments on commit 9d77230

Please sign in to comment.