Skip to content
Snippets Groups Projects
Commit 1ce45abd authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

Allowing overwritting priors (only one prior per state block)

parent 9173e7c0
No related branches found
No related tags found
1 merge request!243Constraint prior sensor params
This commit is part of merge request !234. Comments created here will be created in the context of that merge request.
...@@ -153,7 +153,6 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector ...@@ -153,7 +153,6 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector
assert((_size == -1 && _start_idx == 0) || (_size+_start_idx <= _sb->getSize())); assert((_size == -1 && _start_idx == 0) || (_size+_start_idx <= _sb->getSize()));
assert(_size == -1 || _size == _x.size()); assert(_size == -1 || _size == _x.size());
assert(!(_size != -1 && _sb->hasLocalParametrization()) && "prior for a segment of the state only available withour local parameterization"); assert(!(_size != -1 && _sb->hasLocalParametrization()) && "prior for a segment of the state only available withour local parameterization");
assert(params_prior_map_.find(_sb) == params_prior_map_.end() && "this parameter has already a prior");
// set StateBlock state // set StateBlock state
if (_size == -1) if (_size == -1)
...@@ -165,6 +164,10 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector ...@@ -165,6 +164,10 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector
_sb->setState(new_x); _sb->setState(new_x);
} }
// remove previous prior (if any)
if (params_prior_map_.find(_sb) == params_prior_map_.end())
params_prior_map_[_sb]->remove();
// create feature // create feature
FeatureBasePtr ftr_prior = std::make_shared<FeatureBase>("ABSOLUTE",_x,_cov); FeatureBasePtr ftr_prior = std::make_shared<FeatureBase>("ABSOLUTE",_x,_cov);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment