When I use the rostopic list commands, the output is only returning /rosout & /rosout_agg. Although when I rosrun both the subscriber and the publisher python files, that contain my new topic, they can communicate no problem. A few questions here:

Does the rostopic list command list all the topics that are part of the catkin workspace? At what point is this rostopic 'created'. In other words what command is responsible for rostopic list to generate the new topic that is created in the publisher? Thanks!


In which order do you run your commands ?

rostopic list is used to list current topics registered with the rosmaster 'node', who is launched with the roscore commands

The publisher and subscriber topics are registered to the rosmaster with the python function rospy.Publisher('chatter', String, queue_size=10) for the publisher, and rospy.Subscriber("chatter", String, callback) for the subscriber (I assume that the python file you speak about are the one from the tutorial)

So if you want to see the topics from the publisher and subscriber tutorial , you need first to launch the rosmaster with roscore, then you can open 2 new terminals and launch the publisher and subscriber on each terminal with rosrun beginner_tutorials talker.py and rosrun beginner_tutorials listener.py (don't forget to source your catkin workspace on each terminal to be able to run your workspaces' nodes).

That will register the 2 nodes on the rosmaster, the talker node will register a publisher and the listener node will register a subscriber, both on the same topic.

And now, on an another terminal, if you run rostopic list you will be able to see the topic /chatter

And if you run the command rostopic info /chatter, you will see that this topic is used by 2 nodes, talker and listener, talker is a publisher and listener a subscriber.

If you can't see it, then there is a problem. You can use all the ros* commands to debug what's happening. For example, run the command rosnode list to list which nodes are actually launched (there should be 3 nodes), run the command rostopic echo /chatter to see if your publisher is indeed publishing messages, or run the commands rostopic pub /test std_msgs/String "Hello" -r 10 and rostopic echo /test to see if you can indeed make 2 nodes works.

Also, you should ask your ROS question directly to the ROS Answers Forum, they are much more specialized :) .

| improve this answer | |
  • 2
    $\begingroup$ Just a small addition: rostopic list will show the topic as soon as there is a publisher OR a subscriber. (no need to create both before running rostopic list) $\endgroup$ – FooTheBar Mar 27 '19 at 11:55

you need to check rostopic list while the talker node is running

| improve this answer | |
  • $\begingroup$ Welcome to Robotics Swapnil Gautam. Thanks for your answer but we are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so please edit your answer to explain why it is right, ideally with citations. Answers that don't include explanations may be removed. See How to Answer for more info. $\endgroup$ – Ben May 2 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.