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

Revision history [back]

First you need to create a class method that will be called each time a new message is received from /pose2D topic (I will assume that it publishes geometry_msgs/Pose2D messages):

void PointCloud::pose_callback(const geometry_msgs::Pose2DConstPtr& message)
{
    // process the message here
}

Then to create you subscriber you would do:

pose_sub = n.subscribe("/pose2D", 1, &PointCloud::pose_callback, &this);

First you need to create a class method that will be called each time a new message is received from /pose2D topic (I will assume that it publishes geometry_msgs/Pose2D messages):

void PointCloud::pose_callback(const geometry_msgs::Pose2DConstPtr& message)
{
    // process the message here
}

Then to create you a subscriber to /pose2D topic you would do:

pose_sub = n.subscribe("/pose2D", 1, &PointCloud::pose_callback, &this);

First you need to create a class method that will be called each time a new message is received from /pose2D topic (I will assume that it publishes geometry_msgs/Pose2D messages):

void PointCloud::pose_callback(const geometry_msgs::Pose2DConstPtr& message)
{
    // process the message here
}

Then to create a subscriber to /pose2D topic you would do:

pose_sub = n.subscribe("/pose2D", 1, &PointCloud::pose_callback, &this);
this);