Skip to content

Commit

Permalink
Merge pull request RainerKuemmerle#234 from opcode81/slam-3d-read-imp…
Browse files Browse the repository at this point in the history
…rovements

Improvements in read methods of ParameterSE3Offset and EdgeSE3Prior
  • Loading branch information
RainerKuemmerle authored Feb 14, 2018
2 parents b3fd650 + cd884c9 commit 23a62fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 deletions g2o/types/slam3d/edge_se3_prior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ namespace g2o {
setMeasurement(internal::fromVectorQT(meas));
// don't need this if we don't use it in error calculation (???)
// information matrix is the identity for features, could be changed to allow arbitrary covariances
if (is.bad()) {
return false;
if (is.good()) {
for ( int i=0; i<information().rows(); i++)
for (int j=i; j<information().cols(); j++){
is >> information()(i,j);
if (i!=j)
information()(j,i)=information()(i,j);
}
}
for ( int i=0; i<information().rows() && is.good(); i++)
for (int j=i; j<information().cols() && is.good(); j++){
is >> information()(i,j);
if (i!=j)
information()(j,i)=information()(i,j);
}
if (is.bad()) {
// we overwrite the information matrix
information().setIdentity();
}
return true;
return !is.fail();
}

bool EdgeSE3Prior::write(std::ostream& os) const {
Expand Down
2 changes: 1 addition & 1 deletion g2o/types/slam3d/parameter_se3_offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace g2o {
// normalize the quaternion to recover numerical precision lost by storing as human readable text
Vector4::MapType(off.data()+3).normalize();
setOffset(internal::fromVectorQT(off));
return is.good();
return !is.fail();
}

bool ParameterSE3Offset::write(std::ostream& os) const {
Expand Down

0 comments on commit 23a62fd

Please sign in to comment.