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

Revision history [back]

You can use topic "/camera/depth_registered/points" and callback function as follows

    void callback(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& msg){
      BOOST_FOREACH (const pcl::PointXYZRGB& pt, msg->points){
         ROS_INFO("\t(%f, %f, %f,%d, %d, %d)\n", pt.x, pt.y, pt.z,pt.r,pt.g,pt.b);
        }

in your main you can subscribe as follows

ros::Subscriber sub = nh.subscribe<pcl::PointCloud<pcl::PointXYZRGB> >("/camera/depth_registered/points", 1, callback);

Then you can get the points with RGB valuse :)