From 9833b373cfe8654bb2e04b9cbb3d15a26327abe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Wed, 26 Oct 2016 21:44:01 +0200 Subject: [PATCH] Transfer ProcessorMotion::makeFrame() to ProcessorBase::makeFrame() --- src/processor_base.cpp | 15 +++++++++++---- src/processor_base.h | 3 ++- src/processor_motion.h | 18 +++++++++--------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/processor_base.cpp b/src/processor_base.cpp index 4e15a70fe..beb4018b1 100644 --- a/src/processor_base.cpp +++ b/src/processor_base.cpp @@ -28,10 +28,8 @@ bool ProcessorBase::permittedKeyFrame() return getProblem()->permitKeyFrame(shared_from_this()); } -void ProcessorBase::makeFrame(CaptureBasePtr _capture_ptr, FrameKeyType _type) +FrameBasePtr ProcessorBase::makeFrame(CaptureBasePtr _capture_ptr, FrameKeyType _type) { - std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; - // We need to create the new free Frame to hold what will become the last Capture FrameBasePtr new_frame_ptr = getProblem()->createFrame(_type, _capture_ptr->getTimeStamp()); @@ -41,7 +39,16 @@ void ProcessorBase::makeFrame(CaptureBasePtr _capture_ptr, FrameKeyType _type) // Keyframe callback in order to let the other processors to establish their constraints getProblem()->keyFrameCallback(_capture_ptr->getFramePtr(), shared_from_this(), time_tolerance_); - std::cout << __FILE__ << ":" << __FUNCTION__ << "():" << __LINE__ << std::endl; + return new_frame_ptr; +} + +FrameBasePtr ProcessorBase::makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type) +{ + // We need to create the new free Frame to hold what will become the last Capture + FrameBasePtr new_frame_ptr = getProblem()->createFrame(_type, _state, _capture_ptr->getTimeStamp()); + + new_frame_ptr->addCapture(_capture_ptr); // Add incoming Capture to the new Frame + return new_frame_ptr; } void ProcessorBase::remove() diff --git a/src/processor_base.h b/src/processor_base.h index 7fdce5893..5900ed583 100644 --- a/src/processor_base.h +++ b/src/processor_base.h @@ -54,7 +54,8 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce /**\brief make a Frame with the provided Capture */ - virtual void makeFrame(CaptureBasePtr _capture_ptr, FrameKeyType _type = NON_KEY_FRAME); + FrameBasePtr makeFrame(CaptureBasePtr _capture_ptr, FrameKeyType _type = NON_KEY_FRAME); + FrameBasePtr makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type = NON_KEY_FRAME); virtual bool keyFrameCallback(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) = 0; diff --git a/src/processor_motion.h b/src/processor_motion.h index 7f06324fd..861c0ffa0 100644 --- a/src/processor_motion.h +++ b/src/processor_motion.h @@ -178,7 +178,7 @@ class ProcessorMotion : public ProcessorBase // void reset(CaptureMotion2* _capture_ptr); - FrameBasePtr makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type); +// FrameBasePtr makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type = NON_KEY_FRAME); MotionBuffer& getBuffer(); @@ -658,14 +658,14 @@ inline void ProcessorMotion::splitBuffer(const TimeStamp& _t_split, MotionBuffer last_ptr_->getBuffer().split(_t_split, _oldest_part); } -inline FrameBasePtr ProcessorMotion::makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type) -{ - // We need to create the new free Frame to hold what will become the last Capture - FrameBasePtr new_frame_ptr = getProblem()->createFrame(_type, _state, _capture_ptr->getTimeStamp()); - - new_frame_ptr->addCapture(_capture_ptr); // Add incoming Capture to the new Frame - return new_frame_ptr; -} +//FrameBasePtr ProcessorMotion::makeFrame(CaptureBasePtr _capture_ptr, const Eigen::VectorXs& _state, FrameKeyType _type) +//{ +// // We need to create the new free Frame to hold what will become the last Capture +// FrameBasePtr new_frame_ptr = getProblem()->createFrame(_type, _state, _capture_ptr->getTimeStamp()); +// +// new_frame_ptr->addCapture(_capture_ptr); // Add incoming Capture to the new Frame +// return new_frame_ptr; +//} inline void ProcessorMotion::resetDerived() { -- GitLab