Browse Source

change view_pcdmap.

yuchuli 1 year ago
parent
commit
0e135dd4cc
1 changed files with 22 additions and 5 deletions
  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 opt; // getopt_long() 的返回值
     int digit_optind = 0; // 设置短参数类型及是否需要参数
     int digit_optind = 0; // 设置短参数类型及是否需要参数
 
 
-    strncpy(gstr_mapname,"/home/nvidia/BorregasAve.pcd",255);
+    strncpy(gstr_mapname,"/home/nvidia/map.pcd",255);
     // 如果option_index非空,它指向的变量将记录当前找到参数符合long_opts里的
     // 如果option_index非空,它指向的变量将记录当前找到参数符合long_opts里的
     // 第几个元素的描述,即是long_opts的下标值
     // 第几个元素的描述,即是long_opts的下标值
     int option_index = 0;
     int option_index = 0;
@@ -101,6 +101,10 @@ void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
     o.x = 0;
     o.x = 0;
     o.y = 0;
     o.y = 0;
     o.z = 0;
     o.z = 0;
+
+
+
+   viewer.resetCamera();
     //添加球体
     //添加球体
 
 
 //    viewer.addSphere (o, 1, "sphere", 0);
 //    viewer.addSphere (o, 1, "sphere", 0);
@@ -123,7 +127,12 @@ void viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
 
 
     ss << "Point Cloud Count: " << user_data;
     ss << "Point Cloud Count: " << user_data;
     viewer.removeShape ("text", 0);
     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>());
                 new pcl::PointCloud<pcl::PointXYZI>());
     std::string path = gstr_mapname;
     std::string path = gstr_mapname;
 
 
+    std::cout<<" pcd path: "<<path<<std::endl;
+
     if(path.length() < 1)
     if(path.length() < 1)
     {
     {
         std::cout<<"Please use -p set pcd path."<<std::endl;
         std::cout<<"Please use -p set pcd path."<<std::endl;
         return 0;
         return 0;
     }
     }
 
 
+    pcl::io::loadPCDFile<pcl::PointXYZI>(path,*point_cloud);
+    viewer1.showCloud(point_cloud);
+
     //This will only get called once
     //This will only get called once
     viewer1.runOnVisualizationThreadOnce (viewerOneOff);
     viewer1.runOnVisualizationThreadOnce (viewerOneOff);
 
 
     //This will get called once per visualization iteration
     //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())
     while(!viewer1.wasStopped())
     {
     {