Added check to prevent trying to add disconnected factors in iSAM1

release/4.3a0
Alex Cunningham 2013-05-22 17:27:43 +00:00
parent 41b0b90376
commit 15fb7234e6
1 changed files with 7 additions and 1 deletions

View File

@ -36,8 +36,14 @@ namespace gtsam {
const FG& newFactors, Cliques& orphans, typename FG::Eliminate function) {
// Remove the contaminated part of the Bayes tree
// Throw exception if disconnected
BayesNet<CONDITIONAL> bn;
this->removeTop(newFactors.keys(), bn, orphans);
if (!this->empty()) {
this->removeTop(newFactors.keys(), bn, orphans);
if (bn.empty())
throw std::runtime_error(
"ISAM::update_internal(): no variables in common between existing Bayes tree and incoming factors!");
}
FG factors(bn);
// add the factors themselves