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

setProcessorMotion machinery protected and moved to ProcessorMotion::setProblem

parent 024d3436
No related branches found
No related tags found
1 merge request!274Resolve "Emplace API inconsistent with ProcessorTrackerFeature/Landmark functions"
This commit is part of merge request !274. Comments created here will be created in the context of that merge request.
...@@ -38,6 +38,7 @@ enum Notification ...@@ -38,6 +38,7 @@ enum Notification
class Problem : public std::enable_shared_from_this<Problem> class Problem : public std::enable_shared_from_this<Problem>
{ {
friend SolverManager; // Enable SolverManager to acces protected functions (consumeXXXNotificationMap()) friend SolverManager; // Enable SolverManager to acces protected functions (consumeXXXNotificationMap())
friend ProcessorMotion;
protected: protected:
HardwareBasePtr hardware_ptr_; HardwareBasePtr hardware_ptr_;
...@@ -134,20 +135,23 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -134,20 +135,23 @@ class Problem : public std::enable_shared_from_this<Problem>
const std::string& _corresponding_sensor_name, // const std::string& _corresponding_sensor_name, //
const std::string& _params_filename = ""); const std::string& _params_filename = "");
/** /**
Custom installProcessor to be used with parameters server Custom installProcessor to be used with parameters server
*/ */
ProcessorBasePtr installProcessor(const std::string& _prc_type, // ProcessorBasePtr installProcessor(const std::string& _prc_type, //
const std::string& _unique_processor_name, // const std::string& _unique_processor_name, //
const std::string& _corresponding_sensor_name, // const std::string& _corresponding_sensor_name, //
const paramsServer& _server); const paramsServer& _server);
/** \brief Set the processor motion protected:
/** \brief Set the processor motion
* *
* Set the processor motion. * Set the processor motion.
*/ */
void setProcessorMotion(ProcessorMotionPtr _processor_motion_ptr); void setProcessorMotion(ProcessorMotionPtr _processor_motion_ptr);
ProcessorMotionPtr setProcessorMotion(const std::string& _unique_processor_name); ProcessorMotionPtr setProcessorMotion(const std::string& _unique_processor_name);
void clearProcessorMotion(); void clearProcessorMotion();
public:
ProcessorMotionPtr& getProcessorMotion(); ProcessorMotionPtr& getProcessorMotion();
// Trajectory branch ---------------------------------- // Trajectory branch ----------------------------------
......
...@@ -209,6 +209,8 @@ class ProcessorMotion : public ProcessorBase ...@@ -209,6 +209,8 @@ class ProcessorMotion : public ProcessorBase
*/ */
FrameBasePtr setOrigin(const Eigen::VectorXs& _x_origin, const TimeStamp& _ts_origin); FrameBasePtr setOrigin(const Eigen::VectorXs& _x_origin, const TimeStamp& _ts_origin);
virtual void setProblem(ProblemPtr);
MotionBuffer& getBuffer(); MotionBuffer& getBuffer();
const MotionBuffer& getBuffer() const; const MotionBuffer& getBuffer() const;
......
...@@ -163,17 +163,8 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // ...@@ -163,17 +163,8 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, //
ProcessorBasePtr prc_ptr = ProcessorFactory::get().create(uppercase(_prc_type), _unique_processor_name, _prc_params, _corresponding_sensor_ptr); ProcessorBasePtr prc_ptr = ProcessorFactory::get().create(uppercase(_prc_type), _unique_processor_name, _prc_params, _corresponding_sensor_ptr);
prc_ptr->configure(_corresponding_sensor_ptr); prc_ptr->configure(_corresponding_sensor_ptr);
// _corresponding_sensor_ptr->addProcessor(prc_ptr);
prc_ptr->link(_corresponding_sensor_ptr); prc_ptr->link(_corresponding_sensor_ptr);
// setting the origin in all processor motion if origin already setted
if (prc_ptr->isMotion() && prior_is_set_)
(std::static_pointer_cast<ProcessorMotion>(prc_ptr))->setOrigin(getLastKeyFrame());
// setting the main processor motion
if (prc_ptr->isMotion() && processor_motion_ptr_ == nullptr)
processor_motion_ptr_ = std::static_pointer_cast<ProcessorMotion>(prc_ptr);
return prc_ptr; return prc_ptr;
} }
......
...@@ -681,4 +681,20 @@ PackKeyFramePtr ProcessorMotion::computeProcessingStep() ...@@ -681,4 +681,20 @@ PackKeyFramePtr ProcessorMotion::computeProcessingStep()
return pack; return pack;
} }
void ProcessorMotion::setProblem(ProblemPtr _problem)
{
if (_problem == nullptr || _problem == this->getProblem())
return;
NodeBase::setProblem(_problem);
// set the origin
if (origin_ptr_ == nullptr && this->getProblem()->getLastKeyFrame() != nullptr)
this->setOrigin(this->getProblem()->getLastKeyFrame());
// set the main processor motion
if (this->getProblem()->getProcessorMotion() == nullptr)
this->getProblem()->setProcessorMotion(std::static_pointer_cast<ProcessorMotion>(shared_from_this()));
};
} }
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