diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 1c5dc6e32b73a300495a3687948f47da1482c0be..de40f101d1a6bf8a2285294a7aec5828139ce061 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -967,30 +967,30 @@ void Problem::setPriorOptions(const std::string& _mode, const VectorComposite& _state , const MatrixComposite& _cov ) { -// assert(prior_options_ != nullptr && "prior options have already been applied"); -// assert(prior_options_->mode == "" && "prior options have already been set"); -// assert((_mode == "nothing" || _mode == "initial_guess" || _mode == "fix" || _mode == "factor") && "wrong _mode value, it should be: 'nothing', 'initial_guess', 'fix' or 'factor'"); -// -// // Store options (optionals depending on the mode) -// WOLF_TRACE("prior mode: ", _mode); -// prior_options_->mode = _mode; -// -// if (prior_options_->mode != "nothing") -// { -// assert(_time_tolerance > 0 && "time tolerance should be bigger than 0"); -// -// WOLF_TRACE("prior state: ", _state.transpose()); -// WOLF_TRACE("prior time tolerance: ", _time_tolerance); -// prior_options_->state = _state; -// prior_options_->time_tolerance = _time_tolerance; -// -// if (prior_options_->mode == "factor") -// { -// assert(isCovariance(_cov) && "cov is not a covariance matrix (symmetric and Pos Def)"); -// WOLF_TRACE("prior covariance:\n" , _cov); -// prior_options_->cov = _cov; -// } -// } + assert(prior_options_ != nullptr && "prior options have already been applied"); + assert(prior_options_->mode == "" && "prior options have already been set"); + assert((_mode == "nothing" || _mode == "initial_guess" || _mode == "fix" || _mode == "factor") && "wrong _mode value, it should be: 'nothing', 'initial_guess', 'fix' or 'factor'"); + + // Store options (optionals depending on the mode) + WOLF_TRACE("prior mode: ", _mode); + prior_options_->mode = _mode; + + if (prior_options_->mode != "nothing") + { + assert(_time_tolerance > 0 && "time tolerance should be bigger than 0"); + + WOLF_TRACE("prior state: ", _state); + WOLF_TRACE("prior time tolerance: ", _time_tolerance); + prior_options_->state = _state; + prior_options_->time_tolerance = _time_tolerance; + + if (prior_options_->mode == "factor") + { + assert(isCovariance(_cov) && "cov is not a covariance matrix (symmetric and Pos Def)"); + WOLF_TRACE("prior covariance:\n" , _cov); + prior_options_->cov = _cov; + } + } } FrameBasePtr Problem::applyPriorOptions(const TimeStamp& _ts)