Question: i wrote a subscriber python code but i did not find the mistake #!/usr/bin/env python import rospy from std_msgs.msg import String def talker() : pub
i wrote a subscriber python code but i did not find the mistake
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
def talker() :
pub = rospy.Publisher('our_first_topic',String,queue_size=10)
rospy.init_node('publisher_node' ,anonymous=True)
rate = rospy.Rate(10)
while not rospy.is_shutdown():
first_msg = "Catch me :)"
rospy.loginfo(first_msg)
pub.publish(first_msg)
rate.sleep()
if __name__ == '__main__':
talker()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
