本文整理汇总了C++中Pointcloud::savePointsToFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointcloud::savePointsToFile方法的具体用法?C++ Pointcloud::savePointsToFile怎么用?C++ Pointcloud::savePointsToFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pointcloud
的用法示例。
在下文中一共展示了Pointcloud::savePointsToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
//.........这里部分代码省略.........
Pointcloud pointc = tS.getPointCloud();
for(Pointcloud::Point p : *pointc.getPoints()){
if(p.X == 2 && p.Y == 0){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Right side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == -2 && p.Y == 0){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Left side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 0 && p.Y == 2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Upper side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 0 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Lower side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == -2 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Upper left diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 2 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Lower left diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 2 && p.Y == 2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Lower right diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == -2 && p.Y == 2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Upper right diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
}
//PointCloud test
testResultsFile << "Enviroment Simulator test PointCloud" << std::endl;
Pointcloud pC = testSim.getPointCloud();
if(pC.getPoints()->size() > 1){
testResultsFile << "Error: ";
++error;
testResultsFile << "PointCloud: " << "Radius failed" << std::endl;
}
for(Pointcloud::Point p : *pC.getPoints()){
//std::cout << "x: " << p.X << " y: " << p.Y;
if(p.X != 3){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "X wrong" << std::endl;
++error;
}
if(p.Y != -1){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Y wrong" << std::endl;
++error;
}
}
//save pc
pC.savePointsToFile("testpC.pcl");
Pointcloud loadpC;
//load pc from file
loadpC.loadPointsFromFile("testpC.pcl");
//make map from loaded pc
try{
Map pCloadMap("testpC.map", &loadpC);
//check point
if(pCloadMap.getMapObject(0,3) != 1){
testResultsFile << "PointCloud: " << "Load from file failed" << std::endl;
}
}
catch(int e){
if(e != 2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Excpention error." << std::endl;
++error;
}
}
//Done
testResultsFile << "Enviroment Simulator test done" << std::endl;
if(error == 0){
testResultsFile << "Test Succes!" << std::endl;
std::cout << "Test Succes!" << std::endl;
}
testResultsFile << '\n' << '\n';
testResultsFile.close();
std::cout << "Enviroment Simulator test done" << std::endl;
return error;
}