ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

turtle in turtlebot_gazebo is not moving

asked 2016-09-07 08:41:30 -0500

Cayero gravatar image

updated 2016-09-07 09:08:19 -0500

Hi I'm new in ROS, and I have a problem with turtlebot_gazebo.

Here I got the code which I would like to use to move the robot.

import rospy
from geometry_msgs.msg import Twist

cmd_vel_pub = rospy.Publisher('cmd_vel', Twist, queue_size=1)

red_light_twist = Twist()
green_light_twist = Twist()
green_light_twist.linear.x =5

driving_forward = False
light_change_time =
rate = rospy.Rate(10)

while not rospy.is_shutdown():
             if driving_forward:
             if light_change_time >
                        driving_forward = not driving_forward
                        light_change_time = + rospy.Duration(3)

This is the code from 'Programming robots with ROS' book.

Then in new terminal I use that command

./ cmd_vel:=cmd_vel_mux/input/teleop

and again in new terminal I'm running the code

rosrun wanderbot

after that in the previous terminal i got this

shutdown request: new node registered with the same name
Traceback (most recent call last):
 File "./", line 25, in <module>
     File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/", line 99, in
 File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/", line 157, in 
        raise rospy.exceptions.ROSInterruptException("ROS shutdown request")
rospy.exceptions.ROSInterruptException: ROS shutdown request

The turtle in gazebo is not moving. Could someone give some advice? I would be really grateful.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-03 08:57:30 -0500

harryrobotic gravatar image

in this line :

if light_change_time >
                        driving_forward = not driving_forward

should be: if light_change_time <

By the way, the author fixed the code here:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-07 06:34:37 -0500

Seen: 776 times

Last updated: Sep 07 '16