LoginSignup
8
4

More than 5 years have passed since last update.

ROSでのPCLの扱い

Last updated at Posted at 2016-02-20

相互変換

PointCloud2 -> PointCloud<PointT>

$ sudo apt-get install ros-indigo-pcl-conversions

#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl_conversions/pcl_conversions.h>
// 以下の2つは使わないこと。現在は使えない。
// #include <pcl/ros/conversions.h>
// #include <pcl/conversions.h>

void Callback(const sensor_msgs::PointCloud2ConstPtr& input) {
  pcl::PointCloud<pcl::PointXYZ> cloud;
  pcl::fromROSMsg (*input, cloud);
}

int main(int argc, char** argv) {
  ....
  ros::Subscriber sub = nh.subscribe<sensor_msgs::PointCloud2>("velodyne_points", 10, Callback);
}
8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4