tue-robotics / wire

BSD 2-Clause "Simplified" License
21 stars 15 forks source link

Problem when many objects are to be tracked: Assertion `probability_ > 0' failed. #11

Closed autonomobil closed 2 years ago

autonomobil commented 5 years ago

When there are more than ~40 objects the wire_core dies with an error:

wire_core/src/logic/AssignmentSet.cpp:29: mhf::AssignmentSet::AssignmentSet(mhf::Hypothesis*, mhf::AssignmentMatrix*): 
Assertion `probability_ > 0' failed.

This piece is causing the problem:

AssignmentSet::AssignmentSet(Hypothesis* hyp, AssignmentMatrix* assignment_matrix) :
    hyp_(hyp), assignment_matrix_(assignment_matrix), probability_(hyp_->getProbability()),
    evidence_assignments_(assignment_matrix_->getNumMeasurements()), n_blocked_(0) {

    for(unsigned int i = 0; i < evidence_assignments_.size(); ++i) {
        evidence_assignments_[i] = 0;
        probability_ *= assignment_matrix_->getAssignment(i, 0).getProbability();
    }

    assert(probability_ > 0);
}

If I print the value of assignment_matrix_->getAssignment(i, 0).getProbability(), it is something like 1e-5, so every loop iteration probability_ gets smaller until ~1e-360 and then the error appears.

What to do about that?

jelfring commented 5 years ago

The simplest approach would be to remove the assert or change it to assert(probability_ >= 0);, since a zero probability in general does not have to be a problem.

What happens if you change the assert (I can imagine this suggestion leads to new problems)?

turtleMaster20 commented 3 years ago

This leads to:

wire_server: {path_to_file}/HypothesesTree.cpp:253: void mhf::HypothesisTree::expandTree(const mhf::EvidenceSet&): Assertion 'leafs_.size() > 0' failed.

jelfring commented 3 years ago

wire_server: {path_to_file}/HypothesesTree.cpp:253: void mhf::HypothesisTree::expandTree(const mhf::EvidenceSet&): Assertion 'leafs_.size() > 0' failed.

The problem you are facing is that all hypotheses get pruned (due to having a probability of zero). In general, the most likely solution would be to tune the models differently (e.g. increase covariances involved). In case you provide more details on the problem you are trying to solve and the situation in which it happens I could perhaps be more specific.