rospy.get_rostime() always return 0 out of while True loop
when I place rospy.get_rostime() in while loop like this
while True:
print(rospy.get_rostime())
I get the result like this:
...
1120344000000
1120344000000
1120344000000
1120344000000
1120344000000
1120344000000
1120345000000
1120345000000
1120345000000
1120345000000
...
but when I change it to
i = 0
while i in xrange(10):
print(rospy.get_rostime())
i = i + 1
it returns
...
0
0
0
0
0
0
0
0
0
0
...
why??
Please show us all of the code.
rospy.get_rostime()
can return0
, fi when you haven't calledrospy.init_node()
.That's all the code. Another two line above it is:
import rospy
androspy.init_node("something")
which is fundamental or else where is the result came from?? Another thing is if I don't callrospy.init_node("something")
it will not return zero btw but it will ask wheretf is myrospy.init_node()
If that is all the code then I'm not surprised it doesn't work. You must initialise time properly, which is done when
rospy.init_node(..)
is called.