ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Querying topic types in C++

asked 2012-03-13 19:03:59 -0600

Matt gravatar image

updated 2014-01-28 17:11:37 -0600

ngrennan gravatar image

I there a way in C++ to query if a topic exists and if so what message type it uses?

I am trying to write a generic visualization tool and would like to subscribe to a topic using a callback matching the topic's type.

Alternatively a method that accepts all messages but allows me to learn their type in the callback would also work.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-03-13 22:36:59 -0600

dornhege gravatar image

The xmlrpc api should be able to do that. (getPublishedTopics)

edit flag offensive delete link more
0

answered 2012-03-13 22:33:35 -0600

Victor Lopez gravatar image

Take a look at shape_shifter in the topic_tools package. http://www.ros.org/doc/api/topic_tools/html/shape__shifter_8h_source.html

You can subscribe to any topic and when a message has been received consult the message type.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-03-13 19:03:59 -0600

Seen: 2,071 times

Last updated: Mar 13 '12