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

moved setProblem from PM to PB and removed automatic setOrigin

parent b09c423a
No related branches found
No related tags found
1 merge request!367Resolve "Factors in a non-key frame or null frame"
......@@ -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
*
......
......@@ -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:
......
......@@ -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)
......
......@@ -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;
......
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