Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ros python publisher

#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String

def talker():
    pub = rospy.Publisher('chatter', String, queue_size=10)
    rospy.init_node('talker', anonymous=True)
    rate = rospy.Rate(10) # 10hz
    while not rospy.is_shutdown():
        hello_str = "hello world %s" % rospy.get_time()
        rospy.loginfo(hello_str)
        pub.publish(hello_str)
        rate.sleep()

if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass
Comment

PREVIOUS NEXT
Code Example
Python :: python datetime minus 1 day 
Python :: how to separate x and y from mouse position python 
Python :: get ip from request django 
Python :: typage in python 
Python :: heatmap(df_train.corr()) 
Python :: numpy softmax 
Python :: python wait 5 seconds then display 
Python :: how to display qr code in python 
Python :: get output of ps aux grep python 
Python :: open a filename starting with in python 
Python :: pandas sort columns by name 
Python :: static and media files in django 
Python :: format numbers in dataframe pandas 
Python :: remove item from list while looping 
Python :: sum of a column in pandas 
Python :: message box for python 
Python :: $ sudo pip install pdml2flow-frame-inter-arrival-time 
Python :: Set up and run a two-sample independent t-test 
Python :: how to increase and decrease volume of speakers using python 
Python :: how to tell python to create a random numer 
Python :: sns scatter plot 
Python :: python init matrix 
Python :: python blueprint 
Python :: python immutable default parameters 
Python :: generate 12 random numbers python 
Python :: filter blank rows python csv 
Python :: create dataframe with column names pandas 
Python :: qmenu get item value python 
Python :: Fill NaN of a column with values from another column 
Python :: python selenium geolocation 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =