Skip to content

Instantly share code, notes, and snippets.

@SweiLz
Created February 17, 2019 10:25
Show Gist options
  • Save SweiLz/ec738d7d35bb601e1dcde8bf0f254915 to your computer and use it in GitHub Desktop.
Save SweiLz/ec738d7d35bb601e1dcde8bf0f254915 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