Skip to content

Instantly share code, notes, and snippets.

@marcoarruda
Created November 6, 2017 11:46
Show Gist options
  • Save marcoarruda/45b19eb801cb9f040ef3e962e9306195 to your computer and use it in GitHub Desktop.
Save marcoarruda/45b19eb801cb9f040ef3e962e9306195 to your computer and use it in GitHub Desktop.
Rospy publisher
import rospy
from std_msgs.msg import String
pub = rospy.Publisher('topic_name', String, queue_size=10)
rospy.init_node('node_name')
r = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
pub.publish("hello world")
r.sleep()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment