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

A good start how to use ROS can be found here. When you reach step 11 then you learn how to publish and subscribe in ROS. For point clouds using the Kinect camera, then you need to setup you subscriber to retrieve point clouds, which is found under the sensor_msgs documentation. Down below you can find the simple schematic for a class that reads the point cloud data from the kinect.

#include <ros/ros.h>
#include <pcl_ros/point_cloud.h>
#include <sensor_msgs/PointCloud2.h>

using namespace ros;
using namespace sensor_msgs;

class processPoint {
    NodeHandle nh;
    Subscriber sub;

public:
    processPoint() {
        sub = nh.subscribe<sensor_msgs::PointCloud2>("/camera/rgb/points", 1, &processPoint::processCloud, this);
    }

    ~processPoint() {   
     }

    void processCloud( const sensor_msgs::PointCloud2ConstPtr& cloud );
};

#include "processPoint.hpp"

void processPoint::processCloud( const sensor_msgs::PointCloud2ConstPtr& cloud ) {

}

int main(int argc, char **argv) {

    init(argc, argv, "processPoint");

    processPoint processPoint;

    Rate spin_rate(1);

    while( ok() ) {
        spinOnce();

        spin_rate.sleep();
    }
}