Fixed the last failing unit test
parent
15ab2b27bc
commit
95e59d7c5d
|
@ -1 +1,3 @@
|
||||||
|
VERTEX_SE3:QUAT 0 0 0 0 0 0 0 1
|
||||||
|
VERTEX_SE3:QUAT 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423
|
||||||
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 1 1 1 1 1 10000 2 2 2 2 10000 3 3 3 10000 4 4 10000 5 10000
|
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 1 1 1 1 1 10000 2 2 2 2 10000 3 3 3 10000 4 4 10000 5 10000
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
VERTEX_SE3:QUAT 0 0 0 0 0 0 0 1
|
||||||
|
VERTEX_SE3:QUAT 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423
|
||||||
|
VERTEX_SE3:QUAT 2 1.9935 0.023275 0.003793 0.351729 0.597838 -0.584174 -0.421446
|
||||||
|
VERTEX_SE3:QUAT 3 2.00429 1.02431 0.018047 0.331798 -0.200659 0.919323 0.067024
|
||||||
|
VERTEX_SE3:QUAT 4 0.999908 1.05507 0.020212 -0.035697 -0.46249 0.445933 0.765488
|
||||||
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
EDGE_SE3:QUAT 0 1 1.00137 0.01539 0.004948 0.190253 0.283162 -0.392318 0.85423 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
||||||
EDGE_SE3:QUAT 1 2 0.523923 0.776654 0.326659 -0.311512 -0.656877 0.678505 -0.105373 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
EDGE_SE3:QUAT 1 2 0.523923 0.776654 0.326659 -0.311512 -0.656877 0.678505 -0.105373 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
||||||
EDGE_SE3:QUAT 2 3 0.910927 0.055169 -0.411761 0.595795 -0.561677 0.079353 0.568551 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
EDGE_SE3:QUAT 2 3 0.910927 0.055169 -0.411761 0.595795 -0.561677 0.079353 0.568551 10000 0 0 0 0 0 10000 0 0 0 0 10000 0 0 0 10000 0 0 10000 0 10000
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
template<class ValueType>
|
template<class ValueType>
|
||||||
struct _ValuesKeyValuePair {
|
struct _ValuesKeyValuePair {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
* Atlanta, Georgia 30332-0415
|
* Atlanta, Georgia 30332-0415
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
|
@ -330,8 +329,9 @@ void save2D(const NonlinearFactorGraph& graph, const Values& config,
|
||||||
fstream stream(filename.c_str(), fstream::out);
|
fstream stream(filename.c_str(), fstream::out);
|
||||||
|
|
||||||
// save poses
|
// save poses
|
||||||
|
|
||||||
BOOST_FOREACH(const Values::ConstKeyValuePair& key_value, config) {
|
BOOST_FOREACH(const Values::ConstKeyValuePair& key_value, config) {
|
||||||
const Pose2& pose = dynamic_cast<const Pose2&>(key_value.value);
|
const Pose2& pose = key_value.value.cast<Pose2>();
|
||||||
stream << "VERTEX2 " << key_value.key << " " << pose.x() << " " << pose.y()
|
stream << "VERTEX2 " << key_value.key << " " << pose.x() << " " << pose.y()
|
||||||
<< " " << pose.theta() << endl;
|
<< " " << pose.theta() << endl;
|
||||||
}
|
}
|
||||||
|
@ -373,26 +373,23 @@ GraphAndValues readG2o(const string& g2oFile, const bool is3D,
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void writeG2o(const NonlinearFactorGraph& graph, const Values& estimate,
|
void writeG2o(const NonlinearFactorGraph& graph, const Values& estimate,
|
||||||
const string& filename) {
|
const string& filename) {
|
||||||
|
|
||||||
fstream stream(filename.c_str(), fstream::out);
|
fstream stream(filename.c_str(), fstream::out);
|
||||||
|
|
||||||
// save 2D & 3D poses
|
// save 2D & 3D poses
|
||||||
BOOST_FOREACH(const Values::ConstKeyValuePair& key_value, estimate) {
|
Values::ConstFiltered<Pose2> viewPose2 = estimate.filter<Pose2>();
|
||||||
|
BOOST_FOREACH(const Values::ConstFiltered<Pose2>::KeyValuePair& key_value, viewPose2) {
|
||||||
const Pose2* pose2D = dynamic_cast<const Pose2*>(&key_value.value);
|
stream << "VERTEX_SE2 " << key_value.key << " " << key_value.value.x() << " "
|
||||||
if(pose2D){
|
<< key_value.value.y() << " " << key_value.value.theta() << endl;
|
||||||
stream << "VERTEX_SE2 " << key_value.key << " " << pose2D->x() << " "
|
|
||||||
<< pose2D->y() << " " << pose2D->theta() << endl;
|
|
||||||
}
|
}
|
||||||
const Pose3* pose3D = dynamic_cast<const Pose3*>(&key_value.value);
|
|
||||||
if(pose3D){
|
Values::ConstFiltered<Pose3> viewPose3 = estimate.filter<Pose3>();
|
||||||
Point3 p = pose3D->translation();
|
BOOST_FOREACH(const Values::ConstFiltered<Pose3>::KeyValuePair& key_value, viewPose3) {
|
||||||
Rot3 R = pose3D->rotation();
|
Point3 p = key_value.value.translation();
|
||||||
|
Rot3 R = key_value.value.rotation();
|
||||||
stream << "VERTEX_SE3:QUAT " << key_value.key << " " << p.x() << " " << p.y() << " " << p.z()
|
stream << "VERTEX_SE3:QUAT " << key_value.key << " " << p.x() << " " << p.y() << " " << p.z()
|
||||||
<< " " << R.toQuaternion().x() << " " << R.toQuaternion().y() << " " << R.toQuaternion().z()
|
<< " " << R.toQuaternion().x() << " " << R.toQuaternion().y() << " " << R.toQuaternion().z()
|
||||||
<< " " << R.toQuaternion().w() << endl;
|
<< " " << R.toQuaternion().w() << endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// save edges (2D or 3D)
|
// save edges (2D or 3D)
|
||||||
BOOST_FOREACH(boost::shared_ptr<NonlinearFactor> factor_, graph) {
|
BOOST_FOREACH(boost::shared_ptr<NonlinearFactor> factor_, graph) {
|
||||||
|
|
Loading…
Reference in New Issue