amcl_pose header stamp is not correct

asked 2018-09-19 12:21:16 -0500

Tiz gravatar image

updated 2018-09-25 09:54:09 -0500

Hi All,

I'm not sure how recent this problem is, but I noticed that when I run some tests with my robots (turtlebot2s) the amcl_pose header stamp starts counting from 0 until the test ends. (Its important to note that I use Stage simulator for this, I've not tested if the physical amcl_pose stamps are wrong.) However, the reset of my status messages are stamped with the rospy.Time.now() stamp, which obviously doesn't start from 0. This is very inconvenient since I use rosbag to play back recordings of my tests and wanted to do some amcl and status message analysis but the time stamps are all wrong.

I was hoping that someone knows if there is any obvious fix for this issue. Perhaps a setting I could have accidentally tweaked unknowingly that could have messed up the header time-stamp? I know I can still work out the time-stamp issue manually for each test by changing all the correct timestamps to 0 as well, but this won't fix the fact that the terminal also shows 2 time-stamps and rqt_console also switches time-stamps depending on the node that it's displaying messages of.

Edit (solved, but additional information/resources would be appreciated): Reviewing the comment by gvdhoorn and looking at own code I think I found the problem. In Python, I have written a 'global' stamp function. Every time the script sends a message the header is stamped using the command rostime.get_rostime(). However, before this command the function sets rospy.rostime.switch_to_wallclock() and this turned out to be the problem all along. The code I'm working with was originally written for hydro then updated for indigo and slightly tweaked for kinetic. I've only worked in indigo and kinetic myself. But this is the first time I've noticed the time stamp mismatch, and falsely thought that amcl_pose starting at 0 was the problem. But as gvdhoorn pointed out this is a feature not a bug :)

If anyone knows of any significant changes to rospy.rostime functionality it would be helpful or if they know why rospy.rostime.switch_to_wallclock() used to work but now causes a time stamp mismatch, it would be very useful to me!

Thanks, and sorry for the misunderstanding!

Tiz

edit retag flag offensive close merge delete

Comments

1

amcl_pose header stamp starts counting from 0 until the test ends. (Its important to note that I use Stage simulator [..]

simulators tend to set use_sim_time to true, which makes the clock start at 0.

If stage does this, I believe this is could be expected behaviour.

gvdhoorn gravatar image gvdhoorn  ( 2018-09-19 14:16:51 -0500 )edit

Hi gvdhoorn, First of all, thanks for replying! This didn't solve my particular problem. However, you reminded me of /use_sim_time's function. This was enough to get me on the right path. I've edited my question above.

Tiz gravatar image Tiz  ( 2018-09-25 09:38:00 -0500 )edit

If you've solved your problem it would be best to post your edit as the actual answer.

Then you can accept your own answer and future readers would clearly see the question as answered.

Right now it's difficult to see what the resolution status is as you've edited in your answer in the question.

gvdhoorn gravatar image gvdhoorn  ( 2018-09-25 10:28:49 -0500 )edit

As to your new question(s) about rospy.rostime.switch_to_wallclock(): please post that as a new question and make sure to link to this one (you can use #qNNNNN where NNNNN is the question ID (part of the url)).

gvdhoorn gravatar image gvdhoorn  ( 2018-09-25 10:29:34 -0500 )edit