【问题标题】:Using PCL with 2D Laser scanners将 PCL 与 2D 激光扫描仪结合使用
【发布时间】:2014-03-19 21:54:14
【问题描述】:

我一直在研究通过激光扫描创建点云,但遇到了一些问题:

首先,PCL 没有对 hokuyo 激光的 io 支持,所以我打算为此使用 hokuyoaist 库。

我遇到的主要问题是如何将二维激光数据转换为点云 (pointcloud2),以便我可以使用 PCL 库。我知道 ROS 中的一些软件包可以做到这一点,但我真的不想接近 ROS 这样做。

提前致谢,

马旺

【问题讨论】:

  • 你想用二维数据做什么?将其按原样用于 2D 目的,或者例如将多个扫描合并为一个 3D 扫描?
  • @anderas 后者,将多次扫描合并为一个 3D 扫描
  • 假设您在 PTU 上使用 2D 扫描仪(或类似设置):您是否在每次扫描时都有 PTU 的当前方向?
  • @anderas 我把它安装在机器人的头顶上。我正计划以小幅度改变音高以改变方向。由于激光扫描仪覆盖 270* 度,我可能不需要改变偏航角。

标签: point-cloud-library ros point-clouds


【解决方案1】:

您可以使用类似(未经测试,但应该可以帮助您):

#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <vector>

// Get Hokuyo data
int numberOfDataPoints = 0; // you need to fill this
std::vector<double> hokuyoDataX,hokuyoDataY;
for(int i=0;i<numberOfDataPoints;i++)
{
    hokuyoDataX.push_back(...); // you need to fill this for the x of point i
    hokuyoDataY.push_back(...); // you need to fill this for the y of point i
}

// Define new cloud object
pcl::PointCloud<pcl::PointXY>::Ptr cloud (new pcl::PointCloud<pcl::PointXY>);
cloud->is_dense = true; // no NaN and INF expected. 
cloud->width = hokuyoDataX.size();
cloud->height = 1;
cloud->points.resize(hokuyoDataX.size());
// Now fill the pointcloud
for(int i=0; i<hokuyoDataX.size(); i++)
{
    cloud->points[i].x = hokuyoDataX[i];
    cloud->points[i].y = hokuyoDataY[i];
}

【讨论】:

  • 如果您知道数据的结构,您甚至可以将云设置为真实的高度和宽度,并获得有组织的点云。有一个有组织的点云可以促进很多算法,pcl 中的一些算法只适用于这样的云。
猜你喜欢
  • 2010-09-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-13
  • 1970-01-01
  • 2017-04-27
  • 2012-04-21
  • 2011-01-14
相关资源
最近更新 更多