[ros-users] rospy and simulation time

Ken Conley kwc at willowgarage.com
Thu Nov 4 21:18:56 UTC 2010


Hi Patrick,

rospy does obey simulation time, but you have to initialize a node
(i.e. you need an init_node()). Only nodes can obey simulated time
because you have to subscribe to a topic.

 - Ken

On Thu, Nov 4, 2010 at 1:58 PM, Patrick Doyle <wpdster at gmail.com> wrote:
> 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
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list