yuchuli пре 1 година
родитељ
комит
0e135dd4cc
1 измењених фајлова са 22 додато и 5 уклоњено
  1. 22 5
      src/tool/view_pcdmap/main.cpp

+ 22 - 5
src/tool/view_pcdmap/main.cpp

@@ -26,7 +26,7 @@ int  GetOptLong(int argc, char *argv[]) {
     int opt; // getopt_long() 的返回值
     int digit_optind = 0; // 设置短参数类型及是否需要参数
 
-    strncpy(gstr_mapname,"/home/nvidia/BorregasAve.pcd",255);
+    strncpy(gstr_mapname,"/home/nvidia/map.pcd",255);
     // 如果option_index非空,它指向的变量将记录当前找到参数符合long_opts里的
     // 第几个元素的描述,即是long_opts的下标值
     int option_index = 0;
@@ -101,6 +101,10 @@ void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
     o.x = 0;
     o.y = 0;
     o.z = 0;
+
+
+
+   viewer.resetCamera();
     //添加球体
 
 //    viewer.addSphere (o, 1, "sphere", 0);
@@ -123,7 +127,12 @@ void viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
 
     ss << "Point Cloud Count: " << user_data;
     viewer.removeShape ("text", 0);
-    viewer.addText (ss.str(), 200, 300, "text", 0);
+//    viewer.addText (ss.str(), 200, 300, "text", 0);
+
+//    viewer.resetCamera();
+
+//    viewer.addCoordinateSystem(1.0);
+
 
 
 
@@ -150,23 +159,31 @@ int main(int argc, char *argv[])
                 new pcl::PointCloud<pcl::PointXYZI>());
     std::string path = gstr_mapname;
 
+    std::cout<<" pcd path: "<<path<<std::endl;
+
     if(path.length() < 1)
     {
         std::cout<<"Please use -p set pcd path."<<std::endl;
         return 0;
     }
 
+    pcl::io::loadPCDFile<pcl::PointXYZI>(path,*point_cloud);
+    viewer1.showCloud(point_cloud);
+
     //This will only get called once
     viewer1.runOnVisualizationThreadOnce (viewerOneOff);
 
     //This will get called once per visualization iteration
-    viewer1.runOnVisualizationThread (viewerPsycho);
+//    viewer1.runOnVisualizationThread (viewerPsycho);
 
 
 
-    pcl::io::loadPCDFile<pcl::PointXYZI>(path,*point_cloud);
 
-    viewer1.showCloud(point_cloud);
+
+
+
+    viewer1.runOnVisualizationThread (viewerPsycho);
+
 
     while(!viewer1.wasStopped())
     {