[ros-users] rospy and simulation time

Patrick Doyle wpdster at gmail.com
Thu Nov 4 20:58:27 UTC 2010


Is it possible to make rospy use simulation time instead of wall-clock time?

Consider the following program:

#!/usr/bin/env python
import roslib; roslib.load_manifest('wpdtb')
import rospy

print "About to sleep for 5 seconds..."
rospy.sleep(5)
print "done"

I run this on a slow machine (i.e. one in which simulation time runs
slower than real time).  If I start up roscore in one window, and run
this in a second window, it exits after 5 seconds as expected.  If
instead I launch the PR2 simulator in one window:

$ roslaunch pr2_gazabo pr2_empty_world.launch

and run this in a second window, it still exits after about 5
wallclock seconds.  I thought the /use_sim_time parameter would have
made this wait 5 simulated seconds.

I have similar problems with rospy.rate().  And I've given up all
together passing a Duration() timeout to wait_for_service().

--wpd



More information about the ros-users mailing list