title: ROS node subscription not connected
body: <p>I am using a rosbag to publish on various topics and i am trying to get my sample program to allow one node to subscribe to those topics via class method functions. But nothing is being printed out on console for the subscribers. I tried roswtf and i got</p>
  <pre><code> WARNING The following node subscriptions are unconnected:
   * /roscpp_pcl_example:
   * /camera/depth/points
  </code></pre>
  <p>Here is my program code and i am not sure where the problem lies. These are my reference for the API <a href="https://wiki.ros.org/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacks" rel="nofollow noreferrer">https://wiki.ros.org/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacks</a>
  <a href="http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29" rel="nofollow noreferrer">http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29</a></p>
  <pre><code>
  // Include the ROS library
  #include &lt;ros/ros.h&gt;
  
  // Include pcl
  #include &lt;pcl_conversions/pcl_conversions.h&gt;
  #include &lt;pcl/point_cloud.h&gt;
  #include &lt;pcl/point_types.h&gt;
  
  // Include PointCloud2 message
  #include &lt;sensor_msgs/PointCloud2.h&gt;
  #include &lt;std_msgs/String.h&gt;
  
  // Topics
  static const std::string SUB_TOPIC_1 = &quot;/ecu_pcl&quot;;
  static const std::string SUB_TOPIC_2 = &quot;/velodyne_back/velodyne_points&quot;;
  static const std::string SUB_TOPIC_3 = &quot;/velodyne_center/velodyne_points&quot;;
  static const std::string SUB_TOPIC_4 = &quot;/velodyne_front/velodyne_points&quot;
  
  
  //define class with member functions for callback usage
  //allows for subscription of various topics in the same node
  class callback_node{
      public:
  
      void callback1(const std_msgs::String::ConstPtr&amp; msg)
      {
        ROS_INFO_STREAM(msg-&gt;data.c_str());
      }
  
      void callback2(const std_msgs::String::ConstPtr&amp; msg)
      {
        ROS_INFO_STREAM(msg-&gt;data.c_str());
      }
  
      void callback3(const std_msgs::String::ConstPtr&amp; msg)
      {
        ROS_INFO_STREAM(msg-&gt;data.c_str());
      }
  
      void callback4(const std_msgs::String::ConstPtr&amp; msg)
      {
        ROS_INFO_STREAM(msg-&gt;data.c_str());
      }
  
      
  
  };
  
  int main (int argc, char** argv)
  {
      // Initialize the ROS Node &quot;roscpp_pcl_example&quot;
      ros::init (argc, argv, &quot;roscpp_pcl_example&quot;);
      ros::NodeHandle nh;
      callback_node callback_obj;
      // Print &quot;Hello&quot; message with node name to the terminal and ROS log file
      ROS_INFO_STREAM(&quot;Hello from ROS Node: &quot; &lt;&lt; ros::this_node::getName());
  
      // Create ROS Subscribers to SUB_TOPIC with a queue_size of 1000 and a callback function via class methods
      ros::Subscriber sub1 = nh.subscribe(SUB_TOPIC_1, 1000, &amp;callback_node::callback1, &amp;callback_obj);
      ros::Subscriber sub2 = nh.subscribe(SUB_TOPIC_2, 1000, &amp;callback_node::callback2, &amp;callback_obj);
      ros::Subscriber sub3 = nh.subscribe(SUB_TOPIC_3, 1000, &amp;callback_node::callback3, &amp;callback_obj);
      ros::Subscriber sub4 = nh.subscribe(SUB_TOPIC_4, 1000, &amp;callback_node::callback4, &amp;callback_obj);
  
  
      // Spin
      ros::spin();
  
      // Success
      return 0;
  }
  </code></pre>