ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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);
2 | No.2 Revision |
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);
3 | No.3 Revision |
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);