fixed bug when reorder/relinearize is called with no factors

release/4.3a0
Julian Straub 2011-02-16 22:59:09 +00:00
parent ff0cb3eafb
commit 02fe443b44
1 changed files with 14 additions and 12 deletions

View File

@ -64,23 +64,25 @@ void NonlinearISAM<Values>::reorder_relinearize() {
// cout << "Reordering, relinearizing..." << endl;
// Obtain the new linearization point
const Values newLinPoint = estimate();
if(factors_.size() > 0) {
// Obtain the new linearization point
const Values newLinPoint = estimate();
isam_.clear();
isam_.clear();
// Compute an ordering
ordering_ = *factors_.orderingCOLAMD(newLinPoint);
// Compute an ordering
ordering_ = *factors_.orderingCOLAMD(newLinPoint);
// Create a linear factor graph at the new linearization point
boost::shared_ptr<GaussianFactorGraph> gfg(
factors_.linearize(newLinPoint, ordering_)->template dynamicCastFactors<GaussianFactorGraph>());
// Create a linear factor graph at the new linearization point
boost::shared_ptr<GaussianFactorGraph> gfg(
factors_.linearize(newLinPoint, ordering_)->template dynamicCastFactors<GaussianFactorGraph>());
// Just recreate the whole BayesTree
isam_.update(*gfg);
// Just recreate the whole BayesTree
isam_.update(*gfg);
// Update linearization point
linPoint_ = newLinPoint;
// Update linearization point
linPoint_ = newLinPoint;
}
}
/* ************************************************************************* */