ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I recommend the following simple logic in your publisher:
/** @brief Callback for raw scan messages. */
void Convert::processScan(const velodyne_msgs::VelodyneScan::ConstPtr &scanMsg)
{
if (output_.getNumSubscribers() == 0) // no one listening?
return; // avoid much work
... // PointCloud2 conversion
output_.publish(outMsg); // publish the message
}