Manipulate ROS time

asked 2018-03-28 08:54:53 -0500

MOSFET gravatar image

Hello,

I would like to "jump" forward in ROS time by using setNow. But the point is, that after calling ROS::setNow(newNow), the ROS::time::now() function always returns the same value, the newNow value. By calling ROS::time::init() the g_use_sim_time is set to false again, but the now time is the old time again.

Is it possible to achieve a "jump" in ROS::time::now()?

I am running ROS kinetic.

edit retag flag offensive close merge delete

Comments

Just to avoid an xy-problem (and don't take this the wrong way): can you explain what it is that you're actually trying to achieve?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-28 08:57:41 -0500 )edit

I am replaying data files into the ROS system. Some files are having a long waiting time at the beginning, and to avoid waiting everytime I would like to make an initial jump to the first timestamp.

PS: there are different workarounds, by not manipulating the ros Time, but they have dissadvantages

MOSFET gravatar image MOSFET  ( 2018-03-28 09:01:53 -0500 )edit

Are these data files rosbags?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-28 09:07:07 -0500 )edit

Not rosbags, but a similiar data container format.

MOSFET gravatar image MOSFET  ( 2018-03-28 09:46:27 -0500 )edit
1

I'm wondering if it might not make sense to have your 'player' publish to the clock topic - as rosbag does. That would put you in complete control of the clock values used in the ROS application (ie: other nodes) that receives the data.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-28 10:21:14 -0500 )edit