Skip to content

Commit 939fdcc

Browse files
committed
HybridGaussianFactorGraph::errorTree is better encompassing
1 parent d145872 commit 939fdcc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gtsam/hybrid/HybridGaussianFactorGraph.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,15 @@ AlgebraicDecisionTree<Key> HybridGaussianFactorGraph::errorTree(
542542
// Iterate over each factor.
543543
for (auto &factor : factors_) {
544544
if (auto f = std::dynamic_pointer_cast<HybridFactor>(factor)) {
545+
// Check for HybridFactor, and call errorTree
545546
error_tree = error_tree + f->errorTree(continuousValues);
546-
} else if (auto f = std::dynamic_pointer_cast<GaussianFactor>(factor)) {
547-
error_tree =
548-
error_tree + AlgebraicDecisionTree<Key>(f->error(continuousValues));
547+
} else if (auto f = std::dynamic_pointer_cast<DiscreteFactor>(factor)) {
548+
// Skip discrete factors
549+
continue;
550+
} else {
551+
// Everything else is a continuous only factor
552+
HybridValues hv(continuousValues, DiscreteValues());
553+
error_tree = error_tree + AlgebraicDecisionTree<Key>(factor->error(hv));
549554
}
550555
}
551556
return error_tree;

0 commit comments

Comments
 (0)