diff --git a/include/core/capture/capture_base.h b/include/core/capture/capture_base.h index 9914ff93adc0157976dab7efae9baf9397d5b17e..c6a91bbf5c3ee1ff81cd8c65991c9352b3b45c30 100644 --- a/include/core/capture/capture_base.h +++ b/include/core/capture/capture_base.h @@ -176,8 +176,8 @@ inline unsigned int CaptureBase::id() const inline FrameBasePtr CaptureBase::getFrame() const { - frame_ptr_.expired(); - return frame_ptr_.lock(); + if(frame_ptr_.expired()) return nullptr; + else return frame_ptr_.lock(); } inline void CaptureBase::setFrame(const FrameBasePtr _frm_ptr) diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index ab0e9b9cf222bbb16ab9e6713d273fbedadde8fe..3e127c9cb01067b5a7a6170984d28debacc409bc 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -466,7 +466,7 @@ class ProcessorMotion : public ProcessorBase, public IsMotion bool state_blocks, std::ostream& stream , std::string _tabs = "") const override; - +CaptureMotionPtr last_ptr_; protected: // Attributes SizeEigen x_size_; ///< The size of the state vector @@ -475,7 +475,7 @@ class ProcessorMotion : public ProcessorBase, public IsMotion SizeEigen delta_cov_size_; ///< the size of the delta covariances matrix SizeEigen calib_size_; ///< the size of the calibration parameters (TBD in derived classes) CaptureMotionPtr origin_ptr_; - CaptureMotionPtr last_ptr_; + CaptureMotionPtr incoming_ptr_; protected: diff --git a/test/gtest_processor_base.cpp b/test/gtest_processor_base.cpp index 814ac262a48c196bb291bf10d2af282300cbc57f..5c62cac885fe2af03d832433f8c497f5081507a0 100644 --- a/test/gtest_processor_base.cpp +++ b/test/gtest_processor_base.cpp @@ -116,6 +116,9 @@ TEST(ProcessorBase, KeyFrameCallback) capt_odo->setTimeStamp(t); std::cout << "2\n"; problem->check(1); + auto proc_odo_motion = std::static_pointer_cast<ProcessorMotion>(proc_odo); + auto last_ptr = proc_odo_motion->last_ptr_; + auto last_ptr_frame = last_ptr->getFrame(); proc_odo->captureCallback(capt_odo); std::cout << "3\n";