Publisher and Subscriber in one python file

How to create Publisher and Subscriber in one single python file instead of creating two separate files for publisher and subscriber ?

Hi @sua07

Try this

  • Init node
  • create the publisher with the topic you want to publish
  • create a variable for this topic example: move = Twist() to cmd_vel topic
  • create a subscriber and callback
  • create a while and publish with a rate that you want.
1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.