diff --git a/src/capture/capture_base.cpp b/src/capture/capture_base.cpp index cc108e3a173542bcdcd3f2d106fb338a509d8423..d06149ba3f047bcca63f9e3d058e0220bbfb68bc 100644 --- a/src/capture/capture_base.cpp +++ b/src/capture/capture_base.cpp @@ -234,9 +234,9 @@ void CaptureBase::setProblem(ProblemPtr _problem) // update SensorBase::last_capture_ if (getSensor() and - getSensor()->getLastCapture() and - getSensor()->getLastCapture()->getTimeStamp() < time_stamp_) - getSensor()->setLastCapture(shared_from_this()); + (not getSensor()->getLastCapture() or + getSensor()->getLastCapture()->getTimeStamp() < time_stamp_)) + getSensor()->setLastCapture(shared_from_this()); for (auto ft : feature_list_) ft->setProblem(_problem); diff --git a/src/sensor/sensor_base.cpp b/src/sensor/sensor_base.cpp index 9e7adfd0b99009c41345826e6a3b8ad866e70957..0e2a89c12e888750073376f992353b5dd8abce96 100644 --- a/src/sensor/sensor_base.cpp +++ b/src/sensor/sensor_base.cpp @@ -555,8 +555,16 @@ CheckLog SensorBase::localCheck(bool _verbose, SensorBasePtr _sen_ptr, std::ostr // check last_capture_ if (getProblem()->getTimeStamp().ok()) { - inconsistency_explanation << "SensorBase::last_capture_ is not the actual last capture\n"; - log.assertTrue((last_capture_ != findLastCaptureBefore(getProblem()->getTimeStamp())), inconsistency_explanation); + auto last_capture_found = findLastCaptureBefore(getProblem()->getTimeStamp()); + inconsistency_explanation << "SensorBase::last_capture_: " + << (last_capture_ ? std::to_string(last_capture_->id()) : "-") + << " @ " << last_capture_ + << " is not the actual last capture: " + << (last_capture_found ? + std::to_string(last_capture_found->id()) : + "-") + << " @ " << last_capture_found << std::endl; + log.assertTrue(last_capture_ == last_capture_found, inconsistency_explanation); } return log; }