diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 9bc5027fd8e8cbcc0729aed9b897765b21862ec7..d8a1361ac8e4f3590c7b569f3de18e6a114fb742 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -515,6 +515,13 @@ inline Eigen::VectorXs ProcessorMotion::getCurrentState() inline void ProcessorMotion::getCurrentState(Eigen::VectorXs& _x) { + // ensure integrity + assert(origin_ptr_ && "Trying to access origin_ptr_ but it is nullptr!"); + + // ensure proper size of the provided reference + _x.resize( getProblem()->getFrameStructureSize() ); + + // do get timestamp and state corrected by possible self-calibrations Scalar Dt = getCurrentTimeStamp() - origin_ptr_->getTimeStamp(); statePlusDelta(origin_ptr_->getFrame()->getState(), last_ptr_->getDeltaCorrected(origin_ptr_->getCalibration()), Dt, _x); }