diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index 00d5698016447ede93473c94fc36b2a57179beeb..b12d92f10a430810150040fe9277346d2f63c620 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -326,6 +326,8 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce virtual bool permittedAuxFrame() final; + virtual void setProblem(ProblemPtr) override; + public: /**\brief notify a new keyframe made by another processor * diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 4568c6fb3e04b9f3081e27666bc7e9cf3b22e806..2eebf5410599b6eca26a734884956b80f701448e 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -147,7 +147,6 @@ class ProcessorMotion : public ProcessorBase, public IsMotion protected: ParamsProcessorMotionPtr params_motion_; ProcessingStep processing_step_; ///< State machine controlling the processing step - virtual void setProblem(ProblemPtr) override; // This is the main public interface public: diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index 101bd5abb500ff95feec86e3c8969ab4f82301d5..6f28aef4d3393d1baf4a652fa4a06052ba9abb82 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -104,6 +104,23 @@ void ProcessorBase::link(SensorBasePtr _sen_ptr) WOLF_WARN("Linking with a nullptr"); } } + +void ProcessorBase::setProblem(ProblemPtr _problem) +{ + std::string str = "Processor works with " + std::to_string(dim_) + "D but problem is " + std::to_string(_problem->getDim()) + "D"; + assert((dim_ == 0 or dim_ == _problem->getDim()) && str.c_str()); + + if (_problem == nullptr or _problem == this->getProblem()) + return; + + NodeBase::setProblem(_problem); + + // adding processor is motion to the processor is motion vector + auto is_motion_ptr = std::dynamic_pointer_cast<IsMotion>(shared_from_this()); + if (is_motion_ptr) + getProblem()->addProcessorIsMotion(is_motion_ptr); +} + ///////////////////////////////////////////////////////////////////////////////////////// void BufferPackKeyFrame::add(const FrameBasePtr& _key_frame, const double& _time_tolerance) diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index b08d88dc77683f1018a0e077c58b4bd039e9bdd3..a6cddeff1fc847cdd792106b5a4039ca092410cc 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -691,24 +691,6 @@ PackKeyFramePtr ProcessorMotion::computeProcessingStep() return nullptr; } -void ProcessorMotion::setProblem(ProblemPtr _problem) -{ - std::string str = "Processor works with " + std::to_string(dim_) + "D but problem is " + std::to_string(_problem->getDim()) + "D"; - assert((dim_ == 0 or dim_ == _problem->getDim()) && str.c_str()); - - if (_problem == nullptr or _problem == this->getProblem()) - return; - - NodeBase::setProblem(_problem); - - // set the origin - if (origin_ptr_ == nullptr && this->getProblem()->getLastKeyFrame() != nullptr) - this->setOrigin(this->getProblem()->getLastKeyFrame()); - - // adding processor is motion to the processor is motion vector - getProblem()->addProcessorIsMotion(std::dynamic_pointer_cast<IsMotion>(shared_from_this())); -} - bool ProcessorMotion::storeKeyFrame(FrameBasePtr _frame_ptr) { return true;