Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
2de90a11
Commit
2de90a11
authored
1 year ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Format using clang-format
parent
3e70d4cd
No related branches found
No related tags found
3 merge requests
!476
spdlog version upgrade
,
!472
Merge ProcessorLandmarkExternal
,
!468
Resolve "multiple processors per sensor"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_processor_tracker_two_processors_one_sensor.cpp
+104
-71
104 additions, 71 deletions
test/gtest_processor_tracker_two_processors_one_sensor.cpp
with
104 additions
and
71 deletions
test/gtest_processor_tracker_two_processors_one_sensor.cpp
+
104
−
71
View file @
2de90a11
...
...
@@ -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
call
Track
Features
(
const
FeatureBasePtrList
&
_features
_in
,
unsigned
int
call
DetectNew
Features
(
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
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment