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
99aeb151
Commit
99aeb151
authored
6 years ago
by
PierreGtch
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for ProcessorLoopClosureBase
parent
21049017
No related branches found
No related tags found
1 merge request
!290
Resolve "ProcessorLoopClosureBase class"
Pipeline
#3741
passed
6 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/CMakeLists.txt
+4
-0
4 additions, 0 deletions
test/CMakeLists.txt
test/gtest_processor_loopclosure_base.cpp
+103
-0
103 additions, 0 deletions
test/gtest_processor_loopclosure_base.cpp
with
107 additions
and
0 deletions
test/CMakeLists.txt
+
4
−
0
View file @
99aeb151
...
@@ -178,6 +178,10 @@ target_link_libraries(gtest_map_yaml ${PROJECT_NAME})
...
@@ -178,6 +178,10 @@ target_link_libraries(gtest_map_yaml ${PROJECT_NAME})
wolf_add_gtest
(
gtest_param_prior gtest_param_prior.cpp
)
wolf_add_gtest
(
gtest_param_prior gtest_param_prior.cpp
)
target_link_libraries
(
gtest_param_prior
${
PROJECT_NAME
}
)
target_link_libraries
(
gtest_param_prior
${
PROJECT_NAME
}
)
# ProcessorLoopClosureBase class test
wolf_add_gtest
(
gtest_processor_loopclosure_base gtest_processor_loopclosure_base.cpp
)
target_link_libraries
(
gtest_processor_loopclosure_base
${
PROJECT_NAME
}
)
# ProcessorMotion in 2D
# ProcessorMotion in 2D
wolf_add_gtest
(
gtest_odom_2D gtest_odom_2D.cpp
)
wolf_add_gtest
(
gtest_odom_2D gtest_odom_2D.cpp
)
target_link_libraries
(
gtest_odom_2D
${
PROJECT_NAME
}
)
target_link_libraries
(
gtest_odom_2D
${
PROJECT_NAME
}
)
...
...
This diff is collapsed.
Click to expand it.
test/gtest_processor_loopclosure_base.cpp
0 → 100644
+
103
−
0
View file @
99aeb151
#include
"core/utils/utils_gtest.h"
#include
"core/problem/problem.h"
#include
"core/capture/capture_void.h"
#include
"core/processor/processor_loopclosure_base.h"
// STL
#include
<iterator>
#include
<iostream>
using
namespace
wolf
;
using
namespace
Eigen
;
WOLF_PTR_TYPEDEFS
(
ProcessorLoopClosureDummy
);
// dummy class:
class
ProcessorLoopClosureDummy
:
public
ProcessorLoopClosureBase
{
private:
bool
*
factor_created
;
public:
ProcessorLoopClosureDummy
(
ProcessorParamsLoopClosurePtr
_params_loop_closure
,
bool
&
factor_created
)
:
ProcessorLoopClosureBase
(
"LOOP CLOSURE DUMMY"
,
_params_loop_closure
),
factor_created
(
&
factor_created
){};
std
::
pair
<
FrameBasePtr
,
CaptureBasePtr
>
public_selectPairKC
(){
return
selectPairKC
();};
protected
:
bool
voteComputeFeatures
(
CaptureBasePtr
_incoming_ptr
)
{
return
true
;};
bool
voteSearchLoopClosure
(
CaptureBasePtr
_incoming_ptr
)
{
return
true
;};
bool
computeFeatures
(
std
::
pair
<
FrameBasePtr
,
CaptureBasePtr
>
kc_pair
)
{
kc_pair
.
second
->
setFrame
(
kc_pair
.
first
);
return
true
;};
CaptureBasePtr
findLoopCandidate
(
CaptureBasePtr
_capture
)
{
for
(
FrameBasePtr
kf
:
getProblem
()
->
getTrajectory
()
->
getFrameList
())
{
if
(
kf
->
isKey
())
{
for
(
CaptureBasePtr
cap
:
kf
->
getCaptureList
())
{
return
cap
;
}
};}
return
nullptr
;
};
void
createFactors
(
CaptureBasePtr
_capture_1
,
CaptureBasePtr
_capture_2
)
{
std
::
cout
<<
"factor created
\n
"
;
*
factor_created
=
true
;
};
};
TEST
(
ProcessorLoopClosureBase
,
installProcessor
)
{
using
namespace
wolf
;
using
std
::
shared_ptr
;
using
std
::
make_shared
;
using
std
::
static_pointer_cast
;
using
Eigen
::
Vector2s
;
bool
factor_created
=
false
;
Scalar
dt
=
0.01
;
// Wolf problem
ProblemPtr
problem
=
Problem
::
create
(
"PO"
,
2
);
// Install tracker (sensor and processor)
auto
sens_lc
=
SensorBase
::
emplace
<
SensorBase
>
(
problem
->
getHardware
(),
"SENSOR BASE"
,
std
::
make_shared
<
StateBlock
>
(
Eigen
::
VectorXs
::
Zero
(
2
)),
std
::
make_shared
<
StateBlock
>
(
Eigen
::
VectorXs
::
Zero
(
1
)),
std
::
make_shared
<
StateBlock
>
(
Eigen
::
VectorXs
::
Zero
(
2
)),
2
);
ProcessorParamsLoopClosurePtr
params
=
std
::
make_shared
<
ProcessorParamsLoopClosure
>
();
ProcessorLoopClosureDummyPtr
proc_lc
=
std
::
make_shared
<
ProcessorLoopClosureDummy
>
(
params
,
factor_created
);
proc_lc
->
link
(
sens_lc
);
std
::
cout
<<
"sensor & processor created and added to wolf problem"
<<
std
::
endl
;
// initialize
TimeStamp
t
(
0.0
);
Vector3s
x
(
0
,
0
,
0
);
Matrix3s
P
=
Matrix3s
::
Identity
()
*
0.1
;
problem
->
setPrior
(
x
,
P
,
t
,
dt
/
2
);
// KF1
// new KF
t
+=
dt
;
FrameBasePtr
kf
=
FrameBase
::
create_PO_2D
(
KEY
,
t
,
x
);
//KF2
proc_lc
->
keyFrameCallback
(
kf
,
dt
/
2
);
// new capture
CaptureVoidPtr
capt_lc
(
make_shared
<
CaptureVoid
>
(
t
,
sens_lc
));
proc_lc
->
captureCallback
(
capt_lc
);
proc_lc
->
process
(
capt_lc
);
ASSERT_TRUE
(
factor_created
);
}
int
main
(
int
argc
,
char
**
argv
)
{
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