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

Format using clang-format

parent 3e70d4cd
No related branches found
No related tags found
3 merge requests!476spdlog version upgrade,!472Merge ProcessorLandmarkExternal,!468Resolve "multiple processors per sensor"
......@@ -33,79 +33,113 @@ WOLF_PTR_TYPEDEFS(ProcessorTrackerFeatureDummyDummy);
class ProcessorTrackerFeatureDummyDummy : public ProcessorTrackerFeatureDummy
{
public:
ProcessorTrackerFeatureDummyDummy(ParamsProcessorTrackerFeatureDummyPtr& _params) :
ProcessorTrackerFeatureDummy(_params){}
void setLast(CaptureBasePtr _last_ptr){ last_ptr_ = _last_ptr; }
void setInc(CaptureBasePtr _incoming_ptr){ incoming_ptr_ = _incoming_ptr; }
public:
ProcessorTrackerFeatureDummyDummy(ParamsProcessorTrackerFeatureDummyPtr& _params)
: ProcessorTrackerFeatureDummy(_params)
{
}
unsigned int callProcessKnown(){ return this->processKnown(); }
void setLast(CaptureBasePtr _last_ptr)
{
last_ptr_ = _last_ptr;
}
void setInc(CaptureBasePtr _incoming_ptr)
{
incoming_ptr_ = _incoming_ptr;
}
unsigned int callProcessNew(const int& _max_new_features){ return this->processNew(_max_new_features); }
unsigned int callProcessKnown()
{
return this->processKnown();
}
unsigned int callDetectNewFeatures(const int& _max_features,
const CaptureBasePtr& _capture,
FeatureBasePtrList& _features_out){ return this->detectNewFeatures(_max_features, _capture, _features_out); }
unsigned int callProcessNew(const int& _max_new_features)
{
return this->processNew(_max_new_features);
}
unsigned int callTrackFeatures(const FeatureBasePtrList& _features_in,
unsigned int callDetectNewFeatures(const int& _max_features,
const CaptureBasePtr& _capture,
FeatureBasePtrList& _features_out,
FeatureMatchMap& _feature_correspondences){ return this->trackFeatures(_features_in, _capture, _features_out, _feature_correspondences); }
FeatureBasePtrList& _features_out)
{
return this->detectNewFeatures(_max_features, _capture, _features_out);
}
FactorBasePtr callEmplaceFactor(FeatureBasePtr _feature_ptr, FeatureBasePtr _feature_other_ptr){ return this->emplaceFactor(_feature_ptr, _feature_other_ptr); }
unsigned int callTrackFeatures(const FeatureBasePtrList& _features_in,
const CaptureBasePtr& _capture,
FeatureBasePtrList& _features_out,
FeatureMatchMap& _feature_correspondences)
{
return this->trackFeatures(_features_in, _capture, _features_out, _feature_correspondences);
}
void callEstablishFactors(){ this->establishFactors();}
FactorBasePtr callEmplaceFactor(FeatureBasePtr _feature_ptr, FeatureBasePtr _feature_other_ptr)
{
return this->emplaceFactor(_feature_ptr, _feature_other_ptr);
}
TrackMatrix getTrackMatrix(){ return track_matrix_; }
void callEstablishFactors()
{
this->establishFactors();
}
FeatureMatchMap getMatchesLastFromIncoming() { return matches_last_from_incoming_; }
TrackMatrix getTrackMatrix()
{
return track_matrix_;
}
void callReset()
{
this->resetDerived();
origin_ptr_ = last_ptr_;
last_ptr_ = incoming_ptr_;
incoming_ptr_ = nullptr;
};
FeatureMatchMap getMatchesLastFromIncoming()
{
return matches_last_from_incoming_;
}
void callReset()
{
this->resetDerived();
origin_ptr_ = last_ptr_;
last_ptr_ = incoming_ptr_;
incoming_ptr_ = nullptr;
};
};
// Use the following in case you want to initialize tests with predefines variables or methods.
class ProcessorTrackerFeatureDummyDoubledTest : public testing::Test
{
public:
ProblemPtr problem;
SensorBasePtr sensor;
ParamsProcessorTrackerFeatureDummyPtr params;
ProcessorTrackerFeatureDummyDummyPtr processor_1, processor_2;
// ~ProcessorTrackerFeatureDummyDoubledTest() override{}
void SetUp() override
{
// Wolf problem
problem = Problem::create("PO", 2);
// Install camera
sensor = problem->installSensor("SensorOdom2d", "dummy sensor", (Eigen::Vector3d() << 0,0,0).finished(), std::make_shared<ParamsSensorBase>());
// Install processor
params = std::make_shared<ParamsProcessorTrackerFeatureDummy>();
params->max_new_features = 10;
params->min_features_for_keyframe = 7;
params->time_tolerance = 0.5;
params->voting_active = true;
params->n_tracks_lost = 2; // 1 (the first) track is lost each time trackFeatures is called
processor_1 = std::make_shared<ProcessorTrackerFeatureDummyDummy>(params);
processor_1->setName("Processor 1");
processor_1->link(sensor);
processor_2 = std::make_shared<ProcessorTrackerFeatureDummyDummy>(params);
processor_2->setName("Processor 2");
processor_2->link(sensor);
problem->print(4,1,1,1);
}
public:
ProblemPtr problem;
SensorBasePtr sensor;
ParamsProcessorTrackerFeatureDummyPtr params;
ProcessorTrackerFeatureDummyDummyPtr processor_1, processor_2;
// ~ProcessorTrackerFeatureDummyDoubledTest() override{}
void SetUp() override
{
// Wolf problem
problem = Problem::create("PO", 2);
// Install camera
sensor = problem->installSensor("SensorOdom2d",
"dummy sensor",
(Eigen::Vector3d() << 0, 0, 0).finished(),
std::make_shared<ParamsSensorBase>());
// Install processor
params = std::make_shared<ParamsProcessorTrackerFeatureDummy>();
params->max_new_features = 10;
params->min_features_for_keyframe = 7;
params->time_tolerance = 0.5;
params->voting_active = true;
params->n_tracks_lost = 2; // 1 (the first) track is lost each time trackFeatures is called
processor_1 = std::make_shared<ProcessorTrackerFeatureDummyDummy>(params);
processor_1->setName("Processor 1");
processor_1->link(sensor);
processor_2 = std::make_shared<ProcessorTrackerFeatureDummyDummy>(params);
processor_2->setName("Processor 2");
processor_2->link(sensor);
problem->print(4, 1, 1, 1);
}
};
// TEST_F(ProcessorTrackerFeatureDummyDoubledTest, installProcessor)
......@@ -117,7 +151,7 @@ class ProcessorTrackerFeatureDummyDoubledTest : public testing::Test
// TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_one_prc)
// {
// // Create a capture
// // Create a capture
// CaptureBasePtr capture = std::make_shared<CaptureVoid>(0, sensor);
// // Process by one processor
......@@ -126,10 +160,9 @@ class ProcessorTrackerFeatureDummyDoubledTest : public testing::Test
// problem->print(4,1,1,1);
// }
TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_once_one_prc_then_other)
{
// Create a capture
// Create a capture
CaptureBasePtr capture = std::make_shared<CaptureVoid>(0, sensor);
// Process by one processor
......@@ -140,7 +173,7 @@ TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_once_one_prc_then_other)
processor_2->captureCallback(capture);
auto frame_2 = capture->getFrame();
problem->print(4,1,1,1);
problem->print(4, 1, 1, 1);
ASSERT_EQ(problem->getTrajectory()->getFrameMap().size(), 1);
......@@ -152,7 +185,7 @@ TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_once)
// Process by both processors automatically in sequence
CaptureBasePtr capture = std::make_shared<CaptureVoid>(0, sensor);
capture->process();
problem->print(4,1,1,1);
problem->print(4, 1, 1, 1);
ASSERT_EQ(problem->getTrajectory()->getFrameMap().size(), 1);
}
......@@ -167,12 +200,12 @@ TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_twice)
capture = std::make_shared<CaptureVoid>(1, sensor);
capture->process();
problem->print(4,1,1,1);
problem->print(4, 1, 1, 1);
}
TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_thrice)
{
// Create a capture
// Create a capture
CaptureBasePtr capture = std::make_shared<CaptureVoid>(0, sensor);
// Process by both processors automatically in sequence
......@@ -184,21 +217,21 @@ TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_thrice)
capture = std::make_shared<CaptureVoid>(2, sensor);
capture->process();
problem->print(2,1,1,1);
problem->print(2, 1, 1, 1);
}
TEST_F(ProcessorTrackerFeatureDummyDoubledTest, process_loop)
{
for (TimeStamp t(0); t <= 6; t = t+1)
for (TimeStamp t(0); t <= 6; t = t + 1)
{
auto capture = std::make_shared<CaptureVoid>(t, sensor);
capture->process();
}
problem->print(2,1,1,1);
problem->print(2, 1, 1, 1);
}
int main(int argc, char **argv)
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
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