Skip to content
Snippets Groups Projects
Commit 89fa4afb authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

reset and advance clear list of new features and landmarks

parent fa34b15a
No related branches found
No related tags found
1 merge request!274Resolve "Emplace API inconsistent with ProcessorTrackerFeature/Landmark functions"
...@@ -28,28 +28,27 @@ ProcessorTrackerLandmark::~ProcessorTrackerLandmark() ...@@ -28,28 +28,27 @@ ProcessorTrackerLandmark::~ProcessorTrackerLandmark()
void ProcessorTrackerLandmark::advanceDerived() void ProcessorTrackerLandmark::advanceDerived()
{ {
for (auto match : matches_landmark_from_last_)
{
match.second.reset(); // TODO: Should we just remove the entries? What about match.first?
}
matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_); matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_);
new_features_last_ = std::move(new_features_incoming_); new_features_last_ = std::move(new_features_incoming_);
matches_landmark_from_incoming_.clear();
new_features_incoming_.clear();
new_landmarks_.clear();
} }
void ProcessorTrackerLandmark::resetDerived() void ProcessorTrackerLandmark::resetDerived()
{ {
for (auto match : matches_landmark_from_last_)
{
match.second.reset(); // TODO: Should we just remove the entries? What about match.first?
}
matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_); matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_);
new_features_last_ = std::move(new_features_incoming_); new_features_last_ = std::move(new_features_incoming_);
matches_landmark_from_incoming_.clear();
new_features_incoming_.clear();
new_landmarks_.clear();
} }
unsigned int ProcessorTrackerLandmark::processKnown() unsigned int ProcessorTrackerLandmark::processKnown()
{ {
// clear matches list assert(matches_landmark_from_incoming_.empty());
matches_landmark_from_incoming_.clear();
// Find landmarks in incoming_ptr_ // Find landmarks in incoming_ptr_
FeatureBasePtrList known_features_list_incoming; FeatureBasePtrList known_features_list_incoming;
...@@ -66,18 +65,14 @@ unsigned int ProcessorTrackerLandmark::processNew(const int& _max_features) ...@@ -66,18 +65,14 @@ unsigned int ProcessorTrackerLandmark::processNew(const int& _max_features)
/* Rationale: A keyFrame will be created using the last Capture. /* Rationale: A keyFrame will be created using the last Capture.
* *
* First, we work on this Capture to detect new Features, * First, we work on this Capture to detect new Features,
* eventually create Landmarks with them, * eventually create Landmarks with them.
* and in such case create the new Factors feature-landmark. * When done, we need to find these new Landmarks in the incoming Capture.
* When done, we need to track these new Features to the incoming Capture.
*
* At the end, all new Features are appended to the lists of known Features in
* the last and incoming Captures.
*/ */
// clear new lists // assuming cleared new lists
new_features_last_.clear(); assert(new_features_last_.empty());
new_features_incoming_.clear(); assert(new_features_incoming_.empty());
new_landmarks_.clear(); assert(new_landmarks_.empty());
// We first need to populate the \b last Capture with new Features // We first need to populate the \b last Capture with new Features
unsigned int n = detectNewFeatures(_max_features, unsigned int n = detectNewFeatures(_max_features,
...@@ -102,8 +97,8 @@ unsigned int ProcessorTrackerLandmark::processNew(const int& _max_features) ...@@ -102,8 +97,8 @@ unsigned int ProcessorTrackerLandmark::processNew(const int& _max_features)
void ProcessorTrackerLandmark::emplaceNewLandmarks() void ProcessorTrackerLandmark::emplaceNewLandmarks()
{ {
// First, make sure the list is empty and will only contain new lmks // assuming empty list
new_landmarks_.clear(); assert(new_landmarks_.empty());
// Create a landmark for each new feature in last Capture: // Create a landmark for each new feature in last Capture:
for (auto new_feature_ptr : new_features_last_) for (auto new_feature_ptr : new_features_last_)
......
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