Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import rospy
- from std_msgs.msg import Int8
- from random import randint
- def talker():
- pub = rospy.Publisher('chatter', Int8, queue_size=10)
- rospy.init_node('talker', anonymous=True)
- rate = rospy.Rate(1) # 10hz
- while not rospy.is_shutdown():
- #hello_str = ran4
- hello_str = randint(1,5)
- rospy.loginfo(hello_str)
- pub.publish(hello_str)
- rate.sleep()
- if __name__ == '__main__':
- try:
- talker()
- except rospy.ROSInterruptException:
- pass
Add Comment
Please, Sign In to add comment