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

Remove shared_from_this in the lmk case

Frame and Feature cases are marked with FIXME for later evaluation
parent 500d3c1e
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FrameBasePtr _frame_ptr, bool ...@@ -38,7 +38,7 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FrameBasePtr _frame_ptr, bool
// add constraint to frame // add constraint to frame
FrameBasePtr frm_o = frame_other_ptr_.lock(); FrameBasePtr frm_o = frame_other_ptr_.lock();
if (frm_o) if (frm_o)
frm_o->addConstrainedBy(shared_from_this()); frm_o->addConstrainedBy(shared_from_this()); // FIXME: cannot do shared_from_this in constructor!
std::cout << "constructed +c" << id() << std::endl; std::cout << "constructed +c" << id() << std::endl;
} }
...@@ -58,7 +58,7 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FeatureBasePtr _feature_ptr, ...@@ -58,7 +58,7 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FeatureBasePtr _feature_ptr,
// add constraint to feature // add constraint to feature
FeatureBasePtr ftr_o = feature_other_ptr_.lock(); FeatureBasePtr ftr_o = feature_other_ptr_.lock();
if (ftr_o) if (ftr_o)
ftr_o->addConstrainedBy(shared_from_this()); ftr_o->addConstrainedBy(shared_from_this()); // FIXME: cannot do shared_from_this in constructor!
std::cout << "constructed +c" << id() << std::endl; std::cout << "constructed +c" << id() << std::endl;
} }
...@@ -76,11 +76,6 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, LandmarkBasePtr _landmark_ptr ...@@ -76,11 +76,6 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, LandmarkBasePtr _landmark_ptr
landmark_other_ptr_(_landmark_ptr) landmark_other_ptr_(_landmark_ptr)
{ {
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
// add constraint to landmark
LandmarkBasePtr lmk_o = landmark_other_ptr_.lock();
if (lmk_o)
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
lmk_o->addConstrainedBy(shared_from_this()); // FIXME: cannot do shared_from_this in constructor!
std::cout << "constructed +c" << id() << std::endl; std::cout << "constructed +c" << id() << std::endl;
} }
......
...@@ -130,17 +130,18 @@ void ProcessorTrackerLandmark::establishConstraints() ...@@ -130,17 +130,18 @@ void ProcessorTrackerLandmark::establishConstraints()
//std::cout << "ProcessorTrackerLandmark::establishConstraints" << std::endl; //std::cout << "ProcessorTrackerLandmark::establishConstraints" << std::endl;
//std::cout << "\tfeatures:" << last_ptr_->getFeatureList().size() << std::endl; //std::cout << "\tfeatures:" << last_ptr_->getFeatureList().size() << std::endl;
//std::cout << "\tcorrespondences: " << matches_landmark_from_last_.size() << std::endl; //std::cout << "\tcorrespondences: " << matches_landmark_from_last_.size() << std::endl;
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
for (auto last_feature : last_ptr_->getFeatureList()) for (auto last_feature : last_ptr_->getFeatureList())
{ {
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; auto lmk = matches_landmark_from_last_[last_feature]->landmark_ptr_;
ConstraintBasePtr ctr_ptr = createConstraint(last_feature, ConstraintBasePtr ctr_ptr = createConstraint(last_feature,
matches_landmark_from_last_[last_feature]->landmark_ptr_); lmk);
if (ctr_ptr != nullptr) if (ctr_ptr != nullptr) // constraint links
{ {
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
last_feature->addConstraint(ctr_ptr); last_feature->addConstraint(ctr_ptr);
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
lmk->addConstrainedBy(ctr_ptr);
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
} }
std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl;
} }
......
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