Skip to content
Snippets Groups Projects
Commit f944a81c authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Move methods to cpp

parent dd1564be
No related branches found
No related tags found
No related merge requests found
...@@ -141,6 +141,29 @@ void ProcessorMotion::process(CaptureBasePtr _incoming_ptr) ...@@ -141,6 +141,29 @@ void ProcessorMotion::process(CaptureBasePtr _incoming_ptr)
incoming_ptr_ = nullptr; // This line is not really needed, but it makes things clearer. incoming_ptr_ = nullptr; // This line is not really needed, but it makes things clearer.
} }
void ProcessorMotion::getState(const TimeStamp& _ts, Eigen::VectorXs& _x)
{
CaptureMotionPtr capture_motion;
if (_ts >= origin_ptr_->getTimeStamp())
// timestamp found in the current processor buffer
capture_motion = last_ptr_;
else
// We need to search in previous keyframes for the capture containing a motion buffer with the queried time stamp
capture_motion = getCaptureMotionContainingTimeStamp(_ts);
if (capture_motion)
{
// We found a CaptureMotion whose buffer contains the time stamp
VectorXs state_0 = capture_motion->getOriginFramePtr()->getState();
VectorXs delta = capture_motion->getDeltaCorrected(origin_ptr_->getCalibration(), _ts);
Scalar dt = _ts - capture_motion->getBuffer().get().front().ts_;
statePlusDelta(state_0, delta, dt, _x);
}
else
// We could not find any CaptureMotion for the time stamp requested
std::runtime_error("Could not find any Capture for the time stamp requested");
}
CaptureMotionPtr ProcessorMotion::findCaptureContainingTimeStamp(const TimeStamp& _ts) const CaptureMotionPtr ProcessorMotion::findCaptureContainingTimeStamp(const TimeStamp& _ts) const
{ {
//std::cout << "ProcessorMotion::findCaptureContainingTimeStamp: ts = " << _ts.getSeconds() << "." << _ts.getNanoSeconds() << std::endl; //std::cout << "ProcessorMotion::findCaptureContainingTimeStamp: ts = " << _ts.getSeconds() << "." << _ts.getNanoSeconds() << std::endl;
......
...@@ -452,31 +452,6 @@ inline Eigen::VectorXs ProcessorMotion::getState(const TimeStamp& _ts) ...@@ -452,31 +452,6 @@ inline Eigen::VectorXs ProcessorMotion::getState(const TimeStamp& _ts)
return x; return x;
} }
inline void ProcessorMotion::getState(const TimeStamp& _ts, Eigen::VectorXs& _x)
{
CaptureMotionPtr capture_motion;
if (_ts >= origin_ptr_->getTimeStamp())
// timestamp found in the current processor buffer
capture_motion = last_ptr_;
else
// We need to search in previous keyframes for the capture containing a motion buffer with the queried time stamp
capture_motion = getCaptureMotionContainingTimeStamp(_ts);
if (capture_motion)
{
// We found a CaptureMotion whose buffer contains the time stamp
VectorXs state_0 = capture_motion->getOriginFramePtr()->getState();
VectorXs delta = capture_motion->getDeltaCorrected(origin_ptr_->getCalibration(), _ts);
Scalar dt = _ts - capture_motion->getBuffer().get().front().ts_;
statePlusDelta(state_0, delta, dt, _x);
}
else
// We could not find any CaptureMotion for the time stamp requested
std::runtime_error("Could not find any Capture for the time stamp requested");
}
inline wolf::TimeStamp ProcessorMotion::getCurrentTimeStamp() inline wolf::TimeStamp ProcessorMotion::getCurrentTimeStamp()
{ {
return getBuffer().get().back().ts_; return getBuffer().get().back().ts_;
......
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