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
        void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
    {
        // Read incoming cloud
        pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>);
        *filtered_cloud = *msg;


   }

This is how I convert it:

void cloudCallback(const pcl::PointCloud<pcl::pointxyz>::ConstPtr& msg) void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg) { { // Read incoming cloud pcl::PointCloud<pcl::PointXYZ>::Ptr pcl::PointCloud<pcl::pointxyz>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::pointxyz>); *filtered_cloud = *msg; }

}

This is how I convert it:

void cloudCallback(const pcl::PointCloud<pcl::pointxyz>::ConstPtr& pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
        {
            // Read incoming cloud
            pcl::PointCloud<pcl::pointxyz>::Ptr pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::pointxyz>);
pcl::PointCloud<pcl::PointXYZ>);
            *filtered_cloud = *msg;
}

}

This is how I convert it:

 void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
        {
            // Read incoming cloud
            pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>);
            *filtered_cloud = *msg;
 }

This is how I convert it:

  void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
     {
         // Read incoming cloud
         pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>);
         *filtered_cloud = *msg;
        }

}

This is how I convert it:

 void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
 {
     // Read incoming cloud
     pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>);
     *filtered_cloud = *msg;
}

}

This is how I convert it:use it. I am directly publishing and subscribing pcl::PointCloud types instead of sensor_msgs but if you create the new variable in the callback function as sensor_msgs it would work the same way.

void cloudCallback(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& msg)
{
    // Read incoming cloud
    pcl::PointCloud<pcl::PointXYZ>::Ptr filtered_cloud (new pcl::PointCloud<pcl::PointXYZ>);
    *filtered_cloud = *msg;
}