本文整理汇总了C++中FileIO::loadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileIO::loadFromFile方法的具体用法?C++ FileIO::loadFromFile怎么用?C++ FileIO::loadFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileIO
的用法示例。
在下文中一共展示了FileIO::loadFromFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " inputfile outputfile" << std::endl;
return 1;
}
FileIO fileIO;
try {
fileIO.loadFromFile(argv[1]);
} catch(const std::runtime_error& e) {
std::cerr << e.what() << std::endl;
return 2;
}
std::cout << "Calibrating..." << std::endl;
Eigen::Matrix3d calibrationMatrix = OdometryCalibration::calibrateOdometry(fileIO.measurements);
std::cout << "Calibration finished. The calibration matrix is: " << std::endl;
std::cout << calibrationMatrix << std::endl;
std::vector<Odometry> calibratedOdometry;
calibratedOdometry.reserve(fileIO.uncalibrated.size());
for (std::vector<Odometry>::const_iterator it = fileIO.uncalibrated.begin(); it != fileIO.uncalibrated.end(); ++it) {
calibratedOdometry.push_back(OdometryCalibration::applyOdometryCorrection(*it, calibrationMatrix));
}
try {
fileIO.writeToFile(argv[2], calibratedOdometry);
} catch(const std::runtime_error& e) {
std::cerr << e.what() << std::endl;
return 3;
}
return 0;
}
示例2: catch
TEST(OdometryCalibration, Calibration) {
FileIO fileIO;
std::string path = ros::package::getPath("odometry_calibration") + "/data/calib.dat";
try {
fileIO.loadFromFile(path.c_str());
} catch(const std::runtime_error& e) {
ASSERT_TRUE(false) << "Could not load calibration data file";
}
Eigen::Matrix3d calibrationMatrix = OdometryCalibration::calibrateOdometry(fileIO.measurements);
ASSERT_NEAR(-0.0754092, calibrationMatrix.determinant(), 1e-5);
}