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
9042ff0e
Commit
9042ff0e
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
avoidSingularCovariance using while called in setMeasurementInformation
parent
fbaf95bf
No related branches found
No related tags found
1 merge request
!207
FeatureBase: covariance, information, square root information upper matrices
Pipeline
#1764
failed
6 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/feature_base.cpp
+15
-7
15 additions, 7 deletions
src/feature_base.cpp
with
15 additions
and
7 deletions
src/feature_base.cpp
+
15
−
7
View file @
9042ff0e
...
...
@@ -107,10 +107,9 @@ void FeatureBase::setMeasurementInformation(const Eigen::MatrixXs & _meas_info)
// set (ensuring symmetry)
measurement_covariance_
=
_meas_info
.
inverse
().
selfadjointView
<
Eigen
::
Upper
>
();
WOLF_ASSERT_COVARIANCE_MATRIX
(
measurement_covariance_
);
// Avoid singular covariance
//
avoidSingularCovariance();
avoidSingularCovariance
();
// compute square root information upper matrix
measurement_sqrt_information_upper_
=
computeSqrtUpper
(
_meas_info
);
...
...
@@ -145,12 +144,21 @@ void FeatureBase::avoidSingularCovariance()
if
(
eigensolver
.
info
()
==
Eigen
::
Success
)
{
// All eigenvalues must be >= 0:
//std::cout << "pre\n" << measurement_covariance_ << std::endl;
if
((
eigensolver
.
eigenvalues
().
array
()
<
Constants
::
EPS
).
all
())
Scalar
epsilon
=
Constants
::
EPS
;
while
((
eigensolver
.
eigenvalues
().
array
()
<
Constants
::
EPS
).
any
())
{
std
::
cout
<<
"----- any negative eigenvalue or too close to zero
\n
"
;
std
::
cout
<<
"previous eigenvalues: "
<<
eigensolver
.
eigenvalues
().
transpose
()
<<
std
::
endl
;
std
::
cout
<<
"previous determinant: "
<<
measurement_covariance_
.
determinant
()
<<
std
::
endl
;
measurement_covariance_
=
eigensolver
.
eigenvectors
()
*
eigensolver
.
eigenvalues
().
cwiseMax
(
Constants
::
EPS
).
asDiagonal
()
*
eigensolver
.
eigenvalues
().
cwiseMax
(
epsilon
).
asDiagonal
()
*
eigensolver
.
eigenvectors
().
transpose
();
//std::cout << "post\n" << measurement_covariance_ << std::endl;
eigensolver
.
compute
(
measurement_covariance_
);
std
::
cout
<<
"epsilon used: "
<<
epsilon
<<
std
::
endl
;
std
::
cout
<<
"posterior eigenvalues: "
<<
eigensolver
.
eigenvalues
().
transpose
()
<<
std
::
endl
;
std
::
cout
<<
"posterior determinant: "
<<
measurement_covariance_
.
determinant
()
<<
std
::
endl
;
epsilon
*=
10
;
}
}
else
WOLF_ERROR
(
"Couldn't compute covariance eigen decomposition"
);
...
...
@@ -161,7 +169,7 @@ void FeatureBase::avoidSingularCovariance()
measurement_covariance_ += Eigen::MatrixXs::Identity(measurement_covariance_.rows(), measurement_covariance_.cols()) * eps_scalar; // avoid singular covariance
eps_scalar*=10;
}*/
assert
(
measurement_covariance_
.
determinant
()
>
0
&&
"Couldn't avoid singular covariance"
);
WOLF_ASSERT_COVARIANCE_MATRIX
(
measurement_covariance_
);
}
}
// namespace wolf
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