Order of rospy.Publisher and rospy.Subscriber with rospy.init_node()

asked 2020-07-23 09:36:55 -0500

astronaugrrt gravatar image

Hey I am new to ROS, sorry for the basic question. I learnt that when defining publisher, we use rospy.publisher and then rospy.init_node but when defining a subscriber, we use rospy.init_node and then rospy.subscriber Is there a reason for the switch of order? It would make more sense to me for the nodes to be defined first in both cases and then define the node type (which topic to subscribe or publish to)? Thanks.

edit retag flag offensive close merge delete