ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In case someone finds this useful, here is how I solved it:

Convert the sensor msg to a PointCloud<pointxyz>, this removes all fields except xyz, then convert back to a sensor msg.

An example:

  sensor_msgs::PointCloud2 msg; // contains x,y,z and other fields such as intensity
  pcl::PointCloud<pcl::PointXYZ> tmp;
  pcl::fromROSMsg( msg, tmp );
  // Here you could perform operations on the point cloud
  pcl::toROSMsg( tmp, msg );