perception_pcl icon indicating copy to clipboard operation
perception_pcl copied to clipboard

ProjectInliers receives outdated inputs

Open sthoduka opened this issue 8 years ago • 0 comments

Hi, I'm using the SacSegmentation and ProjectInliers nodelets to find planes. There are times when we want to stop the plane finder for a while (for example by stopping the camera node) and restart it after say 10 seconds. When the camera is restarted, the first output from ProjectInliers has a timestamp corresponding to the pointclouds from the first point cloud inputs.

Here is a sample launch file I'm using. What I'm describing can be reproduced by the following:

  1. launch camera pointed at a vertical wall
  2. launch plane finder (sample.launch)
  3. echo header of ProjectInliers output (rostopic echo /perception/project_plane_inliers/output/header)
  4. kill the camera launch file
  5. Note the last timestamp of ProjectInliers output
  6. Wait for a while and restart camera launch file
  7. Note the first and second timestamp of ProjectInliers output

For example, the timestamps I get are: From (5):

seq: 219
stamp: 
  secs: 1459428523
  nsecs: 205892078
frame_id: camera_rgb_optical_frame

---

From (7):

seq: 220
stamp: 
  secs: 1459428523
  nsecs: 305999271
frame_id: camera_rgb_optical_frame

---
seq: 221
stamp: 
  secs: 1459428542
  nsecs: 418833725
frame_id: camera_rgb_optical_frame

---

I've dug into the problem a bit and found that it's caused by the time synchronized subscriber (for input, indices and model) in ProjectInliers. The time synchronizer is triggered after a new set of indices are published here but before the model is published in the next line. When that happens, the best set available to the synchronizer consists of the old model, inliers and input pointcloud, so ProjectInliers receives this old set instead of the new model and inliers. This is happening with both the exact time synchronizer (in hydro) and the approximate time synchronizer (in indigo). The approximate time synchronizer is used in indigo because of #115. A minimum queue size (as specified by the parameter max_queue_size) of 2 is required to get any output at all from ProjectInliers. But because of this, the queue contains old data.

Is there a way to fix this or get around this problem? I realize this issue is partially related to the time synchronizer. Thanks

sthoduka avatar Mar 31 '16 13:03 sthoduka