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

Merge branch 'feature/capture_process' into 'devel'

Feature/capture process

See merge request mobile_robotics/wolf!238
parents 5b1f59da 60f5743b
No related branches found
No related tags found
1 merge request!238Feature/capture process
Pipeline #2443 passed
...@@ -50,6 +50,8 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture ...@@ -50,6 +50,8 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture
// Type // Type
virtual bool isMotion() const { return false; } virtual bool isMotion() const { return false; }
bool process();
unsigned int id(); unsigned int id();
TimeStamp getTimeStamp() const; TimeStamp getTimeStamp() const;
void setTimeStamp(const TimeStamp& _ts); void setTimeStamp(const TimeStamp& _ts);
...@@ -220,6 +222,14 @@ inline void CaptureBase::setTimeStampToNow() ...@@ -220,6 +222,14 @@ inline void CaptureBase::setTimeStampToNow()
time_stamp_.setToNow(); time_stamp_.setToNow();
} }
inline bool CaptureBase::process()
{
assert (getSensorPtr() != nullptr && "Attempting to process a capture with no associated sensor. Either set the capture's sensor or call sensor->process(capture) instead.");
return getSensorPtr()->process(shared_from_this());
}
} // namespace wolf } // namespace wolf
#endif #endif
...@@ -61,8 +61,9 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr) ...@@ -61,8 +61,9 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
pack->key_frame->addCapture(incoming_ptr_); pack->key_frame->addCapture(incoming_ptr_);
// Process info // Process info
// TrackerFeature: We only process new features in Last, here last = nullptr, so we do not have anything to do.
// TrackerLandmark: If we have given a map, all landmarks in the map are know. Process them.
processKnown(); processKnown();
// We only process new features in Last, here last = nullptr, so we do not have anything to do.
// Update pointers // Update pointers
resetDerived(); resetDerived();
......
...@@ -103,6 +103,15 @@ TEST(CaptureBase, addFeatureList) ...@@ -103,6 +103,15 @@ TEST(CaptureBase, addFeatureList)
ASSERT_EQ(C->getFeatureList().back(), f_last); ASSERT_EQ(C->getFeatureList().back(), f_last);
} }
TEST(CaptureBase, process)
{
SensorBasePtr S(std::make_shared<SensorBase>("DUMMY", nullptr, nullptr, nullptr, 2));
CaptureBasePtr C(std::make_shared<CaptureBase>("DUMMY", 1.5, nullptr));
ASSERT_DEATH({C->process();},""); // No sensor in the capture should fail
C->setSensorPtr(S);
ASSERT_TRUE(C->process()); // This should not fail (although it does nothing)
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
......
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