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
1627472d
Commit
1627472d
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Fix test with composite prior
parent
a3e64d2b
No related branches found
No related tags found
1 merge request
!366
Resolve "Complete state vector new data structure?"
Pipeline
#5555
failed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/gtest_problem.cpp
+25
-13
25 additions, 13 deletions
test/gtest_problem.cpp
with
25 additions
and
13 deletions
test/gtest_problem.cpp
+
25
−
13
View file @
1627472d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
#include
"core/utils/utils_gtest.h"
#include
"core/utils/utils_gtest.h"
#include
"core/utils/logging.h"
//
#include "core/utils/logging.h"
#include
"core/problem/problem.h"
#include
"core/problem/problem.h"
#include
"core/sensor/sensor_base.h"
#include
"core/sensor/sensor_base.h"
...
@@ -109,9 +109,9 @@ TEST(Problem, SetOrigin_PO_2d)
...
@@ -109,9 +109,9 @@ TEST(Problem, SetOrigin_PO_2d)
// Eigen::VectorXd x0(3); x0 << 1,2,3;
// Eigen::VectorXd x0(3); x0 << 1,2,3;
VectorComposite
x0
(
Vector3d
(
1
,
2
,
3
),
"PO"
,
{
2
,
1
});
VectorComposite
x0
(
Vector3d
(
1
,
2
,
3
),
"PO"
,
{
2
,
1
});
// Eigen::MatrixXd P0(Eigen::MatrixXd::Identity(3,3) * 0.1); // P0 is 0.1*Id
// Eigen::MatrixXd P0(Eigen::MatrixXd::Identity(3,3) * 0.1); // P0 is 0.1*Id
VectorComposite
P
0
(
Vector3d
(
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
)),
"PO"
,
{
2
,
1
});
VectorComposite
s
0
(
Vector3d
(
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
)),
"PO"
,
{
2
,
1
});
P
->
setPriorFactor
(
x0
,
P
0
,
t0
,
1.0
);
P
->
setPriorFactor
(
x0
,
s
0
,
t0
,
1.0
);
P
->
print
(
4
,
1
,
1
,
1
);
P
->
print
(
4
,
1
,
1
,
1
);
...
@@ -125,8 +125,8 @@ TEST(Problem, SetOrigin_PO_2d)
...
@@ -125,8 +125,8 @@ TEST(Problem, SetOrigin_PO_2d)
TrajectoryBasePtr
T
=
P
->
getTrajectory
();
TrajectoryBasePtr
T
=
P
->
getTrajectory
();
FrameBasePtr
F
=
P
->
getLastFrame
();
FrameBasePtr
F
=
P
->
getLastFrame
();
CaptureBasePtr
C
=
F
->
getCaptureList
().
front
();
CaptureBasePtr
C
=
F
->
getCaptureList
().
front
();
FeatureBasePtr
f
p
=
C
->
getFeatureList
().
front
();
FeatureBasePtr
f
o
=
C
->
getFeatureList
().
front
();
FeatureBasePtr
f
o
=
C
->
getFeatureList
().
back
();
FeatureBasePtr
f
p
=
C
->
getFeatureList
().
back
();
FactorBasePtrList
fac_list
;
FactorBasePtrList
fac_list
;
F
->
getFactorList
(
fac_list
);
F
->
getFactorList
(
fac_list
);
...
@@ -148,8 +148,20 @@ TEST(Problem, SetOrigin_PO_2d)
...
@@ -148,8 +148,20 @@ TEST(Problem, SetOrigin_PO_2d)
ASSERT_FALSE
(
fac
->
getFeatureOther
());
ASSERT_FALSE
(
fac
->
getFeatureOther
());
}
}
auto
x0_vector
=
x0
.
vector
(
"PO"
);
auto
x0_vector
=
x0
.
vector
(
"PO"
);
auto
P0_vector
=
P0
.
vector
(
"PO"
);
auto
s0_vector
=
s0
.
vector
(
"PO"
);
auto
P0_matrix
=
(
P0_vector
.
array
()
*
P0_vector
.
array
()).
matrix
();
MatrixXd
P0_matrix
=
(
s0_vector
.
array
()
*
s0_vector
.
array
()).
matrix
().
asDiagonal
();
WOLF_DEBUG
(
"x0 "
,
x0
);
WOLF_DEBUG
(
"x0_vector "
,
x0_vector
.
transpose
());
WOLF_DEBUG
(
"s0 "
,
s0
);
WOLF_DEBUG
(
"s0_vector "
,
s0_vector
.
transpose
());
WOLF_DEBUG
(
"P0_matrix "
,
P0_matrix
);
WOLF_DEBUG
(
"fp meas "
,
fp
->
getMeasurement
().
transpose
());
WOLF_DEBUG
(
"fp cova "
,
fp
->
getMeasurementCovariance
());
WOLF_DEBUG
(
"fo meas "
,
fo
->
getMeasurement
().
transpose
());
WOLF_DEBUG
(
"fo cova "
,
fo
->
getMeasurementCovariance
());
// check that the Feature measurement and covariance are the ones provided
// check that the Feature measurement and covariance are the ones provided
ASSERT_MATRIX_APPROX
(
x0_vector
.
head
<
2
>
(),
fp
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
head
<
2
>
(),
fp
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
tail
<
1
>
(),
fo
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
tail
<
1
>
(),
fo
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
...
@@ -167,9 +179,9 @@ TEST(Problem, SetOrigin_PO_3d)
...
@@ -167,9 +179,9 @@ TEST(Problem, SetOrigin_PO_3d)
VectorComposite
x0
(
vec7
,
"PO"
,
{
3
,
4
});
VectorComposite
x0
(
vec7
,
"PO"
,
{
3
,
4
});
// Eigen::MatrixXd P0(6,6); P0.setIdentity(); P0 *= 0.1; // P0 is 0.1*Id
// Eigen::MatrixXd P0(6,6); P0.setIdentity(); P0 *= 0.1; // P0 is 0.1*Id
Eigen
::
VectorXd
vec6
(
6
);
vec6
<<
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
);
Eigen
::
VectorXd
vec6
(
6
);
vec6
<<
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
),
sqrt
(
0.1
);
VectorComposite
P
0
(
vec6
,
"PO"
,
{
3
,
3
});
VectorComposite
s
0
(
vec6
,
"PO"
,
{
3
,
3
});
P
->
setPriorFactor
(
x0
,
P
0
,
t0
,
1.0
);
P
->
setPriorFactor
(
x0
,
s
0
,
t0
,
1.0
);
// check that no sensor has been added
// check that no sensor has been added
ASSERT_EQ
(
P
->
getHardware
()
->
getSensorList
().
size
(),
(
SizeStd
)
0
);
ASSERT_EQ
(
P
->
getHardware
()
->
getSensorList
().
size
(),
(
SizeStd
)
0
);
...
@@ -181,8 +193,8 @@ TEST(Problem, SetOrigin_PO_3d)
...
@@ -181,8 +193,8 @@ TEST(Problem, SetOrigin_PO_3d)
TrajectoryBasePtr
T
=
P
->
getTrajectory
();
TrajectoryBasePtr
T
=
P
->
getTrajectory
();
FrameBasePtr
F
=
P
->
getLastFrame
();
FrameBasePtr
F
=
P
->
getLastFrame
();
CaptureBasePtr
C
=
F
->
getCaptureList
().
front
();
CaptureBasePtr
C
=
F
->
getCaptureList
().
front
();
FeatureBasePtr
f
p
=
C
->
getFeatureList
().
front
();
FeatureBasePtr
f
o
=
C
->
getFeatureList
().
front
();
FeatureBasePtr
f
o
=
C
->
getFeatureList
().
back
();
FeatureBasePtr
f
p
=
C
->
getFeatureList
().
back
();
FactorBasePtrList
fac_list
;
FactorBasePtrList
fac_list
;
F
->
getFactorList
(
fac_list
);
F
->
getFactorList
(
fac_list
);
...
@@ -205,8 +217,8 @@ TEST(Problem, SetOrigin_PO_3d)
...
@@ -205,8 +217,8 @@ TEST(Problem, SetOrigin_PO_3d)
}
}
auto
x0_vector
=
x0
.
vector
(
"PO"
);
auto
x0_vector
=
x0
.
vector
(
"PO"
);
auto
P
0_vector
=
P
0
.
vector
(
"PO"
);
auto
s
0_vector
=
s
0
.
vector
(
"PO"
);
auto
P0_matrix
=
(
P
0_vector
.
array
()
*
P
0_vector
.
array
()).
matrix
();
MatrixXd
P0_matrix
=
(
s
0_vector
.
array
()
*
s
0_vector
.
array
()).
matrix
()
.
asDiagonal
()
;
// check that the Feature measurement and covariance are the ones provided
// check that the Feature measurement and covariance are the ones provided
ASSERT_MATRIX_APPROX
(
x0_vector
.
head
<
3
>
(),
fp
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
head
<
3
>
(),
fp
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
tail
<
4
>
(),
fo
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
ASSERT_MATRIX_APPROX
(
x0_vector
.
tail
<
4
>
(),
fo
->
getMeasurement
(),
Constants
::
EPS_SMALL
);
...
...
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