Hi Patrick,
It looks like there is a race condition in the rospy initialization
code. I created a ticket and fix here:
https://code.ros.org/trac/ros/ticket/3123
thanks,
Ken
On Thu, Nov 4, 2010 at 3:08 PM, Patrick Doyle <
wpdster@gmail.com> wrote:
> Hi Ken,
> Thanks for the quick reply. Even as I pasted the code into my email,
> I was thinking "Gee, isn't there supposed to be the name of the code
> somewhere in here?". Oh well, they say that memory is the second
> thing to go...
>
> I added the following line:
>
> rospy.init_node('test')
>
> immediately following the the 2 import statements and ran the code again.
>
> With pr2_empty_world.launch running, I ran the code. It exited at
> (simulated) t=5.
>
> Then, when I ran it again, it exited immediately.... each time.
> (Now _this_ is similar to the timeout issue I mentioned earler.)
>
>
> Is that to be expected? Did I miss something else?
>
> --wpd
>
>
> On Thu, Nov 4, 2010 at 5:18 PM, Ken Conley <kwc@willowgarage.com> wrote:
>> 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@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@code.ros.org
>>> https://code.ros.org/mailman/listinfo/ros-users
>>>
>> _______________________________________________
>> ros-users mailing list
>> ros-users@code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
> _______________________________________________
> ros-users mailing list
> ros-users@code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>