1.命令行输入点云文件名
std::vector<int> pcd_filename_indices = pcl::console::parse_file_extension_argument (argc, argv, "pcd");//搜索命令行中输入的.pcd类的文件,并将索引存放在pcd_filename_indices中
std::string file_name = argv[pcd_filename_indices[0]];
pcl::io::loadPCDFile (file_name, *cloud);//加载点云文件
**if (pcl::console::find_argument (argc, argv, "-h") >= 0)**//查找命令行中的关键字
2.多行注释和取消注释
选中注释内容 ctrl+k 然后 Ctrl+c
取消注释:Ctrl+k 然后 Ctrl+u
3.bool类型定义
例如: bool a(false)
4.VS无法打开源文件及无法打开链接库文件的解决方法
https://blog.csdn.net/qq_28779503/article/details/70599653
5.没有与这些操作数匹配的运算符<<
添加头文件string
6.“error C2653: “sensor_msgs”: 不是类或命名空间名称”
原因:
在PCL1.9中将PointCloud2加入了pcl名字空间,sensor_msgs是旧的方式,不再使用。
sensor_msgs::PointCloud2::Ptr cloud (new sensor_msgs::PointCloud2 ());
sensor_msgs::PointCloud2::Ptr cloud_filtered (new sensor_msgs::PointCloud2 ());
修改为:
pcl::PCLPointCloud2::Ptr cloud(new pcl::PCLPointCloud2());
pcl::PCLPointCloud2::Ptr cloud_filtered(new pcl::PCLPointCloud2());
7.没有与参数列表匹配的重载函数pcl::visualization::CloudViewer ::showCloud
点云数据类型不对,需要数据类型转换,例如:
pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud1(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromPCLPointCloud2(*cloud, *cloud1);
实现从PCLPointCloud2到PointCloud《pcl::PointXYZ》的转换。
8.vs程序修改后,直接调试的运行结果是前一次运行的,需要项目全部重新生成。
右键全部重新生成。