How to obtain the msg format of a topic on runtime?
Hi,
I need to implement a dynamic subscription mechanism, that monitors the available topics. Firstly it takes a view to the msg format of new topics and subscribes to this one depending on a special data format. The first step, to know the current available topics works fine with the following code:
available_topics_old=[]
def monitor():
while not rospy.is_shutdown():
master = rosgraph.masterapi.Master('/rostopic')
available_topics = master.getPublishedTopics('/')
new_topics=[]
for topic in available_topics:
if not topic in available_topics_old:
new_topics.append(topic)
if new_topics:
# here I need to know the format(file) of the assigned msg
rospy.sleep(1.0)
How can I get the msg format of the topic?
Best wishes from Germany
Poseidonius