ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Hello , I m new in ROS. When I try to run the program below I get error..Program is not working. I can't understand why it is not running. [closed]

asked 2016-10-18 14:12:22 -0500

zeynep gravatar image

updated 2016-10-19 01:34:01 -0500

mgruhler gravatar image


#!/usr/bin/env python

import rospy

from std_msgs.msg import Int32


pub = rospy.Publisher('counter', Int32, queue_size = 10)

r = rospy.Rate(1)

count = 0

while not rospy.is_shutdown():


   count += 1


File "/home/baris/catkin_ws/src/basics/src/", line 12, in <module>
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/", line 99, in sleep
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/", line 157, in sleep
raise rospy.exceptions.ROSInterruptException("ROS shutdown request")
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by zeynep
close date 2016-10-19 15:30:02.540318


Looks OK to me. Does it print the error message as soon as you start it, or does it only print the error when you stop it with Ctrl-C?

ahendrix gravatar image ahendrix  ( 2016-10-19 02:30:09 -0500 )edit

This code is right, you can check this out by invoke $ rostopic echo /counter (called after: $ roscore and $ rosrun basics

abrzozowski gravatar image abrzozowski  ( 2016-10-19 11:55:33 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-19 15:29:35 -0500

zeynep gravatar image

I got it..I was expecting the program to print the screen but it just publishes the message. It is ok now.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-10-18 14:06:39 -0500

Seen: 1,698 times

Last updated: Oct 19 '16