3 #include <pcl/common/transforms.h>
4 #include <pcl/point_cloud.h>
5 #include <pcl/point_types.h>
7 #include <cartographer/sensor/rangefinder_point.h>
13 ::pcl::PointCloud<::pcl::PointXYZ>
16 ::pcl::PointCloud<::pcl::PointXYZ> cloud;
17 cloud.reserve(points.size());
22 std::back_inserter(cloud.points),
23 [](
const auto& point) {
24 return pcl::PointXYZ{point.position.x(), point.position.y(), point.position.z()};
29 cloud.width = cloud.size();
34 ::pcl::PointCloud<::pcl::PointXYZ>
35 toPCL(
const std::vector<::cartographer::sensor::TimedRangefinderPoint>& points)
40 ::pcl::PointCloud<::pcl::PointXYZ>
41 toPCL(
const std::vector<::cartographer::sensor::RangefinderPoint>& points)
46 ::pcl::PointCloud<::pcl::PointXYZ>
47 toPCL(
const auto& pointCloud, const ::cartographer::transform::Rigid3d& pose)
49 ::pcl::PointCloud<pcl::PointXYZ> cloudOut;
50 cloudOut.reserve(pointCloud.points().size());
52 auto cloudTmp =
toPCL(pointCloud);
55 const Eigen::Vector3f t = pose.translation().cast<
float>();
57 pcl::transformPointCloud(cloudTmp, cloudOut, t,
q);
61 ::pcl::PointCloud<::pcl::PointXYZ>
62 toPCL(
const std::vector<::cartographer::sensor::TimedRangefinderPoint>& pointCloud,
63 const Eigen::Isometry3f& pose)
65 ::pcl::PointCloud<pcl::PointXYZ> cloudOut;
66 cloudOut.reserve(pointCloud.size());
68 auto cloudTmp =
toPCL(pointCloud);
70 ::pcl::transformPointCloud(cloudTmp, cloudOut, pose);