PCL 注意事项

pcl::transformPointCloud 函数使用

method 1

#include <pcl/common/transforms.h>

pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudsWorld(new pcl::PointCloud<pcl::PointXYZRGB>);

Eigen::AngleAxisd zAngleAxis(posRet.theta, Eigen::Vector3d(0, 0, 1));
Eigen::Quaterniond q(zAngleAxis);
Eigen::Isometry3d pose(q);
pose(0, 3) = pos.x_pos; 
pose(1, 3) = pos.y_pos; 
pose(2, 3) = 0;

pcl::transformPointCloud(*clouds, *cloudsWorld, pose.matrix());

method 2

#include <pcl/common/transforms.h>

pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudsWorld(new pcl::PointCloud<pcl::PointXYZRGB>);

Eigen::Affine3f pose = Eigen::Affine3f::Identity();
pose.translation() << pos.x_pos, pos.y_pos, 0.0;
pose.rotate(Eigen::AngleAxisf(pos.theta, Eigen::Vector3f::UnitZ()));
pcl::transformPointCloud(*clouds, *cloudsWorld, pose);

pcl::PoiintCloudpcl::Point::Ptr

如果此类的sensor_origin_/orientation被配置,PCLViewer在显示时候会做相应的旋转和平移

posted @ 2021-03-02 17:34  采男孩的小蘑菇  阅读(410)  评论(1编辑  收藏  举报