Robotics StackExchange | Archived questions

Disparity between `rospy.get_published_topics()` and `rostopic list`

I'm trying to write some helper functions to supplement rospy's clunky subscribe/publish methods, and I'm trying to validate if the given topic matches a known topic.

So I'm trying to check the topic against the output from rospy.get_published_topics(). However, I'm finding that this often returns a little less than rostopic list. Why is this? What would cause rospy to not see the same topics as rostopic? It seems to exclude all topics that use the std_msg/Empty type. Why would this be?

Asked by Cerin on 2018-03-12 11:45:14 UTC

Comments

From the code API documentation of rospy : "Retrieve list of topics that the master is reporting as being published" could mean that the topic have to be published on to be detected by the function...

Asked by Delb on 2018-03-13 09:30:11 UTC

... have you tried rostopic echo on the topics found with rostopic list but not by rospy.get_published_topics() ?

Asked by Delb on 2018-03-13 09:30:54 UTC

Answers