[ros-users] rospy and simulation time

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: [ros-users] rospy and simulation time
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