Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1516

rospy.get_time() returns 0 when using gazebo

$
0
0
Hi, When I run my code, I run into two problems. First, when I call `rospy.get_time()`, it returns 0. Secondly, in my while loop, perhaps due to the first issue, it only iterates once. Here is my code: #!/usr/bin/env python import rospy from geometry_msgs.msg import Twist topicName = "cmd_vel_mux/teleop" pub = rospy.Publisher("cmd_vel_mux/input/teleop", Twist, queue_size=10) rospy.init_node('drive_time') b_time = rospy.get_time() print b_time n = 0 while rospy.get_time() < b_time + 5: n+=1 t = Twist() t.linear.x = 0.1 pub.publish(t) rospy.sleep(0.1) print n print "done" t = Twist() t.linear.x = 0.1 pub.publish(t) I am running a turtlebot in gazebo using `turtlebot_world.launch`. I tried changing the param `use_sim_time` to false and to true and it didn't work either way. When I initialize a node by typing it into the interpreter, `rospy.get_time()` works fine. Any ideas as to why this is happening?

Viewing all articles
Browse latest Browse all 1516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>