Ask Your Question
1

How to obtain list of all available topics [python]

asked 2017-03-06 10:30:42 -0600

vvyogi gravatar image

In my gazebo model I have 9 differential drive vehicles.
When I execute rostopic list i get

/bot_0/cmd_vel
/bot_0/odom
/bot_1/cmd_vel
/bot_1/odom
/bot_2/cmd_vel
/bot_2/odom
/bot_3/cmd_vel
/bot_3/odom
/bot_4/cmd_vel
/bot_4/odom
/bot_5/cmd_vel
/bot_5/odom
/bot_6/cmd_vel
/bot_6/odom
/bot_7/cmd_vel
/bot_7/odom
/bot_8/cmd_vel
/bot_8/odom
/clock
/gazebo/link_states
...    and so on

I wish to find out all the odom topics in python script and subscribe to all of them using the message_filter

However, I am not being able to find/locate the getTopics() function as is mentioned here Kindly let me know what package do I import to get the getTopics() function working.

Any help is appreciated. Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-03-06 10:50:56 -0600

The getTopics function is C++ only. The equivalent function in Python is get_published_topics.

edit flag offensive delete link more

Comments

Note that this only gives topics that are advertised while rostopic list also shows topics that are only subscribed to by some node.

Felix Widmaier gravatar imageFelix Widmaier ( 2018-02-09 02:53:01 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-06 10:28:05 -0600

Seen: 3,294 times

Last updated: Mar 06 '17