OpenPTrack / open_ptrack

Original open source people tracking library (now deprecated with the release of OPT v2 "Gnocchi").
http://openptrack.org/
BSD 3-Clause "New" or "Revised" License
319 stars 109 forks source link

How frames and msg are synchronized ? #131

Closed enrabre closed 7 years ago

enrabre commented 7 years ago

I have extracted frames and tracks information from a recorded ROS bag. I thought that the seq number was used to linked tracks msg and frames, but it does not seem to match. Even timestamps do not matched.

Find below the first image msg:

header: 
  seq: 5661
  stamp: 
    secs: 1494495073
    nsecs: 279655284
  frame_id: /kinect2_head_rgb_optical_frame
height: 540
width: 960
encoding: bgr8
is_bigendian: 0
step: 2880
data: [168, 182, 171, 168, 182, 171, 162, 176, 165, 164, 178, 167, 167, 181, 170, 169, 183, 171,         166, 183, 170, 166, 183, 170, 166, 183, 170, 166, 183, 170, 165, 182, 169, 165, 182, 169, 163, 180, 167, 165, 182, 169, 164, 181, 168, 166, 183, 170, 167, 181, 169, 166, 180, 168, 164, 181, 168, 166, 183, 170, 166, 183, 170, 166, 183, 170, 167, 184, 171, 166, 183, 170, 164, 182, 169, 165, 183, 170, 165, 183, 170, 165, 183, 170, 163, 181, 168, 163, 181, 168, 163, 180, 166, 166, 183, 169, 166, 183, 169, 165, 182, 168, 168, 185, 172, 165, 182, 169, 167, 184, 171, 165, 182, 169, 166, 183, 170, 166, 183, 170, 164, 181, 168, 166, 183, 170, 166, 183, 170, 166, 183, 170, 165, 182, 169, 166, 183, 169, 165, 182, 168, 164, 182, 165, 162, 179, 165, 166, 183, 169, 165, 182, 169, 164, 181, 168, 166, 180, 168, 168, 182, 170, 166, 180, 168, 167, ....

and the first tracks msg:

header: 
  seq: 3971
  stamp: 
    secs: 1494495073
    nsecs: 476670519
  frame_id: /world
tracks: 
    id: 24
    x: 4.73943106855
    y: -0.792312920538
    height: 1.7104242855
    distance: 4.61215496063
    age: 31.873657
    confidence: 0.101043581348
    visibility: 0
    box_2D: 
      x: 522
      y: 259
      width: 97
      height: 195

Is there a way to have an unique ID between frames and msg ?

marketto89 commented 7 years ago

Hi @enrabre

The answer to your question is that you cannot have a perfect synchronization within tracks and frames. The tracks are computed from the detections, which are generated by each couple sensor/computer. The timing information (header.stamp) you can find inside the detection messages is the same as the one of the point cloud used as the input. On the other hand, the tracks use as timing information the current time when they are created.

If you want, you can approximately synchronize detections (-> point cloud -> frames) and tracks by using the ROS approximate time synchronizer. Another way, is to make the tracks have the same timing information as the detections from which they are created (i.e. change this line) and then compile and record again the data.