m4nh / skimap_ros

Ros implementation of Skimap
GNU General Public License v3.0
268 stars 101 forks source link

Different timestamps inside tiago_lab.bag #9

Closed AndreaIncertiDelmonte closed 6 years ago

AndreaIncertiDelmonte commented 7 years ago

Hi, running rosbag play tiago_lar.bag --clock --pause I noticed that there is a difference of 111.7 seconds between the bag time and messages timestamps.

This can be verified with the following python code:

import rosbag
msg_counter = 1
for topic, msg, t in rosbag.Bag('tiago_lar.bag').read_messages():
    #if topic != "/tf":
    if topic == "/xtion/rgb/image_raw":
        print("Topic: {}".format(topic))
        print("t.to_sec(): {}".format(t.to_sec()))
        print("msg.header.stamp.to_sec(): {}".format(msg.header.stamp.to_sec()))
        print("Delta time: {}".format(t.to_sec() - (msg.header.stamp.to_sec())))
        print("")
        msg_counter = msg_counter + 1
    if msg_counter == 5:
        break

The code produce the following output:

Topic: /xtion/rgb/image_raw
t.to_sec(): 1472902408.28
msg.header.stamp.to_sec(): 1472902296.56
Delta time: 111.716982841

Topic: /xtion/rgb/image_raw
t.to_sec(): 1472902408.37
msg.header.stamp.to_sec(): 1472902296.66
Delta time: 111.707210302

Topic: /xtion/rgb/image_raw
t.to_sec(): 1472902408.73
msg.header.stamp.to_sec(): 1472902297.0
Delta time: 111.730161905

Topic: /xtion/rgb/image_raw
t.to_sec(): 1472902408.87
msg.header.stamp.to_sec(): 1472902297.1
Delta time: 111.778051376

So in this situation when I publish the TF from orbcamera_camera to world (ORBSLAM node) I have two secenarios;

Do you have any hint to fix this issue?

Thanks Andrea

m4nh commented 7 years ago

@AndreaIncertiDelmonte have you set the parameter:

rosparam set use_sim_time true

To force the sim time equal to one in the bag? It's strange behaviour .. however you can try to use as time "-1" or ros::Time(0) to pick the first available TF in the tree when you use tf_listener

m4nh commented 7 years ago

@AndreaIncertiDelmonte comunque io lavoro all'università di Bologna :) vedo che tu sei di reggio emilia.. Se ti interessa qualcosa in particolare su Skiamp puoi scrivermi in privato perché invece a me interessa qualcuno che lavori sull'integrazione con ORBSLAM2. Fammi sapere