Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
plugins
vision
Commits
7d14b4d6
Commit
7d14b4d6
authored
4 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Make test more robust, also using perturb()
parent
406897d0
No related branches found
No related tags found
2 merge requests
!24
After 2nd RAL submission
,
!20
Resolve "follow core:#313"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_factor_pixel_hp.cpp
+10
-35
10 additions, 35 deletions
test/gtest_factor_pixel_hp.cpp
with
10 additions
and
35 deletions
test/gtest_factor_pixel_hp.cpp
+
10
−
35
View file @
7d14b4d6
...
...
@@ -279,7 +279,8 @@ TEST_F(FactorPixelHpTest, testSolveLandmarkAltered)
L1
->
unfix
();
auto
orig
=
L1
->
point
();
L1
->
getP
()
->
setState
(
L1
->
getState
().
vector
(
"P"
)
+
Vector4d
::
Random
());
L1
->
getP
()
->
perturb
(
1.0
);
std
::
string
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
std
::
cout
<<
report
<<
std
::
endl
;
...
...
@@ -341,11 +342,11 @@ TEST_F(FactorPixelHpTest, testSolveFramePosition)
//landmarks to camera coordinates
Transform
<
double
,
3
,
Isometry
>
T_w_r
=
Translation
<
double
,
3
>
(
F1
->
getP
()
->
getState
())
*
Quaterniond
(
F1
->
getO
()
->
getState
().
data
());
=
Translation
<
double
,
3
>
(
F1
->
getP
()
->
getState
())
*
Quaterniond
(
F1
->
getO
()
->
getState
().
data
());
Transform
<
double
,
3
,
Isometry
>
T_r_c
=
Translation
<
double
,
3
>
(
I1
->
getSensorP
()
->
getState
())
*
Quaterniond
(
I1
->
getSensorO
()
->
getState
().
data
());
=
Translation
<
double
,
3
>
(
I1
->
getSensorP
()
->
getState
())
*
Quaterniond
(
I1
->
getSensorO
()
->
getState
().
data
());
Eigen
::
Matrix
<
double
,
4
,
1
>
lmkHP2_c
=
T_r_c
.
inverse
()
*
T_w_r
.
inverse
()
*
lmkHP2
;
Eigen
::
Matrix
<
double
,
4
,
1
>
lmkHP3_c
=
T_r_c
.
inverse
()
*
T_w_r
.
inverse
()
*
lmkHP3
;
Eigen
::
Matrix
<
double
,
4
,
1
>
lmkHP4_c
=
T_r_c
.
inverse
()
*
T_w_r
.
inverse
()
*
lmkHP4
;
...
...
@@ -395,15 +396,10 @@ TEST_F(FactorPixelHpTest, testSolveFramePosition)
auto
orig
=
F1
->
getP
()
->
getState
();
//change state
Vector3d
position
;
position
<<
Vector3d
::
Random
()
*
100
;
//2.0, 2.0, 2.0;
auto
ori
=
F1
->
getO
()
->
getState
();
// Vector7d state;
// state << position, ori;
F1
->
setState
(
"PO"
,
{
position
,
ori
});
F1
->
getP
()
->
unfix
();
F1
->
getP
()
->
perturb
(
0.1
);
F1
->
getO
()
->
fix
();
F1
->
getP
()
->
unfix
();
std
::
string
report
=
solver
->
solve
(
wolf
::
SolverManager
::
ReportVerbosity
::
FULL
);
...
...
@@ -415,9 +411,7 @@ TEST_F(FactorPixelHpTest, testSolveFramePosition)
// This test checks 3 DoF (3doF are observable).
ASSERT_MATRIX_APPROX
(
F1
->
getP
()
->
getState
(),
orig
,
1e-6
);
Eigen
::
VectorXd
expect
=
c11
->
expectation
();
ASSERT_FLOAT_EQ
(
expect
(
0
,
0
),
f11
->
getMeasurement
()(
0
,
0
));
ASSERT_FLOAT_EQ
(
expect
(
1
,
0
),
f11
->
getMeasurement
()(
1
,
0
));
ASSERT_MATRIX_APPROX
(
c11
->
expectation
(),
f11
->
getMeasurement
(),
1e-3
);
}
...
...
@@ -584,26 +578,7 @@ TEST_F(FactorPixelHpTest, testSolveBundleAdjustment)
ASSERT_MATRIX_APPROX
(
L4
->
getP
()
->
getState
(),
l4
,
1e-6
);
// perturb states
// kfs
for
(
auto
kf
:
*
problem
->
getTrajectory
())
{
if
(
kf
==
F1
)
continue
;
if
(
!
kf
->
getP
()
->
isFixed
())
kf
->
getP
()
->
setState
(
kf
->
getP
()
->
getState
()
+
0.2
*
Vector3d
::
Random
());
if
(
!
kf
->
getO
()
->
isFixed
())
kf
->
getO
()
->
setState
((
Quaterniond
(
kf
->
getO
()
->
getState
().
data
())
*
exp_q
(
0.2
*
Vector3d
::
Random
())).
coeffs
());
}
// lmks
for
(
auto
lmk
:
problem
->
getMap
()
->
getLandmarkList
())
{
if
(
lmk
==
L1
)
continue
;
if
(
!
lmk
->
isFixed
())
lmk
->
getP
()
->
setState
(
lmk
->
getP
()
->
getState
()
+
0.2
*
Vector4d
::
Random
());
}
problem
->
perturb
(
0.1
);
// solve again
problem
->
print
(
1
,
0
,
1
,
1
);
...
...
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