8 boost::filesystem::path
p(outfile);
10 if (p.extension() ==
".yaml")
12 std::cout <<
timestamp <<
"SaveMetaInformation(YAML): " << outfile << std::endl;
13 std::ofstream out(outfile.c_str());
17 else if (p.extension() ==
".slam6d")
22 if (node[
"pose_estimate"])
30 boost::filesystem::path outfilePath(outfile);
31 boost::filesystem::path dir = outfilePath.parent_path();
32 boost::filesystem::path posePath(outfilePath.stem().string() +
".pose");
33 boost::filesystem::path poseOutPath = p.parent_path() / posePath;
35 std::cout <<
timestamp <<
"SaveMetaInformation(SLAM6D): " << poseOutPath << std::endl;
40 if (node[
"registration"])
44 boost::filesystem::path outfilePath(outfile);
45 boost::filesystem::path dir = outfilePath.parent_path();
46 boost::filesystem::path framesPath(outfilePath.stem().string() +
".frames");
47 boost::filesystem::path framesOutPath = p.parent_path() / framesPath;
48 std::cout <<
timestamp <<
"SaveMetaInformation(SLAM6D): " << framesOutPath << std::endl;
56 boost::filesystem::path inPath(in);
57 if (inPath.extension() ==
".yaml")
60 if (boost::filesystem::exists(inPath))
63 <<
"LoadMetaInformation(YAML): Loading " << inPath << std::endl;
64 n = YAML::LoadFile(inPath.string());
69 <<
"LoadMetaInformation(YAML): Unable to find yaml file: " << inPath << std::endl;
73 else if (inPath.extension() ==
".slam6d")
77 boost::filesystem::path dir = inPath.parent_path();
78 boost::filesystem::path posePath(inPath.stem().string() +
".pose");
79 boost::filesystem::path poseInPath = inPath.parent_path() / posePath;
80 std::ifstream in_str(poseInPath.c_str());
84 <<
"LoadMetaInformation(SLAM6D): Loading " << poseInPath << std::endl;
86 double x, y, z, r, t,
p;
87 in_str >> x >> y >> z >> r >> t >>
p;
92 node[
"pose_estimate"] = poseEstimate;
97 <<
"LoadMetaInformation(SLAM6D): Warning: No pose file found." << std::endl;
100 boost::filesystem::path framesPath(inPath.stem().string() +
".frames");
101 boost::filesystem::path framesInPath = inPath.parent_path() / framesPath;
102 if (boost::filesystem::exists(framesInPath))
105 <<
"LoadMetaInformation(SLAM6D): Loading " << framesInPath << std::endl;
106 Transformd registration = getTransformationFromFrames<double>(framesInPath);
107 node[
"registration"] = registration;
112 <<
"LoadMetaInformation(SLAM6D): Warning: No pose file found." << std::endl;
void getPoseFromMatrix(BaseVector< T > &position, BaseVector< T > &angles, const Transform< T > &mat)
Computes a Euler representation from the given transformation matrix.
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Eigen::Vector3d Vector3d
Eigen 3D vector, double precision.
Transform< T > poseToMatrix(const Vector3< T > &position, const Vector3< T > &rotation)
Converts a Pose to a Matrix.
Transform< double > Transformd
4x4 double precision transformation matrix
Transform< float > Transformf
4x4 single precision transformation matrix
void writePose(const BaseVector< float > &position, const BaseVector< float > &angles, const boost::filesystem::path &out)
Writes pose information in Euler representation to the given file.
YAML::Node loadMetaInformation(const std::string &in)
void writeFrame(const Transform< T > &transform, const boost::filesystem::path &framesOut)
Writes a Eigen transformation into a .frames file.
void saveMetaInformation(const std::string &outfile, const YAML::Node &node)