Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

!/usr/bin/env python

import rospy

from std_msgs.msg import Int32

rospy.init_node('topic_publisher')

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

r = rospy.Rate(1)

count = 0

while not rospy.is_shutdown():

pub.publish(count)

count += 1

r.sleep()

ERROR: File "/home/baris/catkin_ws/src/basics/src/deneme.py", line 12, in <module> r.sleep() File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 99, in sleep sleep(self._remaining(curr_time)) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 157, in sleep raise rospy.exceptions.ROSInterruptException("ROS shutdown request")

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.

!/usr/bin/env python

import rospy

rospy

from std_msgs.msg import Int32

Int32 rospy.init_node('topic_publisher')

rospy.init_node('topic_publisher')

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

10) r = rospy.Rate(1) count = 0 while not rospy.is_shutdown(): pub.publish(count) count += 1 r.sleep()

r = rospy.Rate(1)

count = 0

while not rospy.is_shutdown():

pub.publish(count)

count += 1

r.sleep()

ERROR: File "/home/baris/catkin_ws/src/basics/src/deneme.py", line 12, in <module> r.sleep() File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 99, in sleep sleep(self._remaining(curr_time)) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 157, in sleep raise rospy.exceptions.ROSInterruptException("ROS shutdown request")

request")

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.

!/usr/bin/env python

code:

#!/usr/bin/env python

import rospy

from std_msgs.msg import Int32

rospy.init_node('topic_publisher')

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

r = rospy.Rate(1)

count = 0

while not rospy.is_shutdown():

   pub.publish(count)

   count += 1

   r.sleep()




ERROR:
File "/home/baris/catkin_ws/src/basics/src/deneme.py", line 12, in <module>
    r.sleep()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 99, in sleep
    sleep(self._remaining(curr_time))
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/timer.py", line 157, in sleep
raise rospy.exceptions.ROSInterruptException("ROS shutdown request")