title: ROS no message published on a topic when I played a rosbag
body: <p>I'm trying to create a rosbag from my own image(RGB-D) and IMU data by using code like this:</p>
  <pre><code>        sensor_msgs::ImagePtr ros_rgb_msg;
          ros_rgb_msg = imgrgb.toImageMsg();
          ros_rgb_msg-&gt;header.seq = iFrame;
          ros_rgb_msg-&gt;header.stamp = stamp;
          ros_rgb_msg-&gt;header.frame_id = iFrame;
          bag.write(&quot;cam0/image_raw&quot;, stamp,ros_rgb_msg);
  
          sensor_msgs::ImagePtr ros_depth_msg;
          ros_depth_msg = imgdepth.toImageMsg();
          ros_depth_msg-&gt;header.seq = iFrame;
          ros_depth_msg-&gt;header.stamp = stamp;
          ros_depth_msg-&gt;header.frame_id = iFrame;
          bag.write(&quot;cam0/depth&quot;, stamp, ros_depth_msg);
  
          sensor_msgs::Imu imu_msg;
          imu_msg.header.stamp = stamp;
          imu_msg.header.seq = iFrame;
          imu_msg.header.frame_id = &quot;imu&quot;;
          imu_msg.angular_velocity.x = tmpgyros.data[0];
          imu_msg.angular_velocity.y = tmpgyros.data[1];
          imu_msg.angular_velocity.z = tmpgyros.data[2];
          imu_msg.linear_acceleration.x = tmpacc.data[0];
          imu_msg.linear_acceleration.y = tmpacc.data[1];
          imu_msg.linear_acceleration.z = tmpacc.data[2];
  
          imu_msg.angular_velocity_covariance[0] = 0.001f;
          imu_msg.angular_velocity_covariance[1] = 0.0f;
          imu_msg.angular_velocity_covariance[2] = 0.0f;
          imu_msg.angular_velocity_covariance[3] = 0.0f;
          imu_msg.angular_velocity_covariance[4] = 0.001f;
          imu_msg.angular_velocity_covariance[5] = 0.0f;
          imu_msg.angular_velocity_covariance[6] = 0.0f;
          imu_msg.angular_velocity_covariance[7] = 0.0f;
          imu_msg.angular_velocity_covariance[8] = 0.001f;
          imu_msg.linear_acceleration_covariance = imu_msg.orientation_covariance =imu_msg.angular_velocity_covariance;
          bag.write(&quot;/imu0&quot;, stamp, imu_msg);
  </code></pre>
  <p>where iFrame is an <code>int</code> representing that the iFrame-th image is being written into the bag, the beginning six lines of the code write the RGB part into the bag and publish them on <code>cam0/image_raw</code>, the next six lines write the depth part into the bag and publish them on <code>cam0/depth</code></p>
  <p>Then I try to use the generated bag as the input for VINS, in <code>feature_tracker_node.cpp</code>, I modified the subscriber as below</p>
  <pre><code>ros::Subscriber sub_img = n.subscribe(&quot;cam0/image_raw&quot;, 100, img_callback);
  </code></pre>
  <p>However, when I first run <code>roslaunch vins_estimator euroc.launch</code> then run<code>rosbag play mytest.bag</code> in two different terminals, I use <code>rostopic hz cam0/image_raw</code> to watch the message on the node, but it shows no message is published on this node while both of the two terminals are running. And the callback function in <code>feature_tracker_node.cpp</code> ,that is ,<code>void img_callback(const sensor_msgs::ImageConstPtr &amp;img_msg) </code>is never called.</p>
  <p>But when I watch <code>imu0</code>,it works perfectly, many messages are published on this topic.</p>
  <p>I also used</p>
  <pre><code>        cv_bridge::CvImageConstPtr ptr1;
          ptr1 = cv_bridge::toCvCopy(ros_rgb_msg, sensor_msgs::image_encodings::RGB8);
          cv::imshow(&quot;test bag1&quot;,ptr1-&gt;image);
          cv::waitKey(0);
  </code></pre>
  <p>to check whether the image is broken before I write it into the bag, however, the image shown is not broken</p>
  <p>Anyone know what may cause the problem ?</p>