Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Created December 3, 2014 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesomebytes/75b13431f4b833748df2 to your computer and use it in GitHub Desktop.
Save awesomebytes/75b13431f4b833748df2 to your computer and use it in GitHub Desktop.
Simple header publisher
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 03/12/14
@author: Sam Pfeiffer
A simple publisher of Header messages
with seq numbers increasing.
"""
import rospy
from std_msgs.msg import Header
if __name__=="__main__":
rospy.init_node('test_topic_queue_')
pub = rospy.Publisher('/header_test', Header, queue_size=1)
seq_num = 1
while not rospy.is_shutdown():
h = Header()
h.seq = seq_num
pub.publish(h)
rospy.loginfo("Published: " + str(h.seq))
seq_num += 1
rospy.sleep(0.001)
# rostopic hz /header_test
# subscribed to [/header_test]
# average rate: 517.697
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment