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

Redesign Prb::getTimeStamp()

parent 9ca95d47
No related branches found
No related tags found
1 merge request!380Resolve "Problem::getState/getTimeStamp considering not initialized processors"
Pipeline #5669 passed
...@@ -419,27 +419,27 @@ FrameBasePtr Problem::emplaceFrame(FrameType _frame_key_type, // ...@@ -419,27 +419,27 @@ FrameBasePtr Problem::emplaceFrame(FrameType _frame_key_type, //
TimeStamp Problem::getTimeStamp ( ) const TimeStamp Problem::getTimeStamp ( ) const
{ {
if (not processor_is_motion_list_.empty() ) // Use most recent Motion processor data TimeStamp ts = TimeStamp::Invalid();
{
TimeStamp ts(0); for (const auto& prc : processor_is_motion_list_)
for (const auto& prc : processor_is_motion_list_) if (prc->getTimeStamp().ok())
if (prc->getTimeStamp() > ts) if ( (not ts.ok() ) or prc->getTimeStamp() > ts)
ts = prc->getTimeStamp(); ts = prc->getTimeStamp();
return ts;
}
else if (not ts.ok())
{ {
const auto& last_kf_or_aux = trajectory_ptr_->getLastKeyOrAuxFrame(); const auto& last_kf_or_aux = trajectory_ptr_->getLastKeyOrAuxFrame();
if (last_kf_or_aux) if (last_kf_or_aux)
return last_kf_or_aux->getTimeStamp(); // Use last estimated frame's state ts = last_kf_or_aux->getTimeStamp(); // Use last estimated frame's state
else
{
WOLF_WARN( "Problem has no Keyframe so no timestamp can be obtained!");
return TimeStamp::Invalid();
}
} }
if (not ts.ok())
WOLF_WARN( "Problem has nowhere to find a valid timestamp!");
return 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