Skip to content
Snippets Groups Projects
Commit 6270c258 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Fix bug with provided map...

The first processed capture had no features. Now `processKnown()` is called always.

A fix was required in processor_traker_feature for the case of `last_ptr_==nullptr` typical of the `FIRST_TIME_XXX` in the state machine.
parent b7e5bb78
No related branches found
No related tags found
No related merge requests found
Pipeline #2383 passed
...@@ -61,6 +61,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr) ...@@ -61,6 +61,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
pack->key_frame->addCapture(incoming_ptr_); pack->key_frame->addCapture(incoming_ptr_);
// Process info // Process info
processKnown();
// We only process new features in Last, here last = nullptr, so we do not have anything to do. // We only process new features in Last, here last = nullptr, so we do not have anything to do.
// Update pointers // Update pointers
...@@ -77,6 +78,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr) ...@@ -77,6 +78,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
kfrm->addCapture(incoming_ptr_); kfrm->addCapture(incoming_ptr_);
// Process info // Process info
processKnown();
// We only process new features in Last, here last = nullptr, so we do not have anything to do. // We only process new features in Last, here last = nullptr, so we do not have anything to do.
// Issue KF callback with new KF // Issue KF callback with new KF
...@@ -95,7 +97,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr) ...@@ -95,7 +97,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
// No-break case only for debug. Next case will be executed too. // No-break case only for debug. Next case will be executed too.
PackKeyFramePtr pack = kf_pack_buffer_.selectPack( incoming_ptr_, params_tracker_->time_tolerance); PackKeyFramePtr pack = kf_pack_buffer_.selectPack( incoming_ptr_, params_tracker_->time_tolerance);
WOLF_DEBUG( "PT ", getName(), ": KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp().get() ); WOLF_DEBUG( "PT ", getName(), ": KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp().get() );
} } // @suppress("No break at end of case")
case SECOND_TIME_WITHOUT_PACK : case SECOND_TIME_WITHOUT_PACK :
{ {
FrameBasePtr frm = getProblem()->emplaceFrame(NON_KEY_FRAME, incoming_ptr_->getTimeStamp()); FrameBasePtr frm = getProblem()->emplaceFrame(NON_KEY_FRAME, incoming_ptr_->getTimeStamp());
...@@ -104,6 +106,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr) ...@@ -104,6 +106,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
// We have a last_ Capture with no features, so we do not process known features, and we do not vote for KF. // We have a last_ Capture with no features, so we do not process known features, and we do not vote for KF.
// Process info // Process info
processKnown();
processNew(params_tracker_->max_new_features); processNew(params_tracker_->max_new_features);
// Establish constraints // Establish constraints
......
...@@ -61,6 +61,11 @@ unsigned int ProcessorTrackerFeature::processKnown() ...@@ -61,6 +61,11 @@ unsigned int ProcessorTrackerFeature::processKnown()
assert(matches_last_from_incoming_.size() == 0 assert(matches_last_from_incoming_.size() == 0
&& "In ProcessorTrackerFeature::processKnown(): match list from last to incoming must be empty before processKnown()"); && "In ProcessorTrackerFeature::processKnown(): match list from last to incoming must be empty before processKnown()");
if (!last_ptr_ || last_ptr_->getFeatureList().empty())
{
return 0;
}
// Track features from last_ptr_ to incoming_ptr_ // Track features from last_ptr_ to incoming_ptr_
trackFeatures(last_ptr_->getFeatureList(), known_features_incoming_, matches_last_from_incoming_); trackFeatures(last_ptr_->getFeatureList(), known_features_incoming_, matches_last_from_incoming_);
for (auto match : matches_last_from_incoming_) for (auto match : matches_last_from_incoming_)
......
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