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

Read message structure at runtime from advertised topic

asked 2017-09-07 02:57:13 -0600

Mehdi. gravatar image

I have been looking in the roscore source code with no success. I want to "read" the structure of a given message (by topic name for example). By structure I mean a tree showing the fields a message has and their data types. The format doesn't really matter (XML, JSON etc.).

Is this possible to do in C++? One of my goals would be to dynamically generate a message container at runtime in c++ (maybe eventually a subscriber too).

The only solution I found right know is to run rosmsg show MSG and parse its output.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-07 04:40:13 -0600

gvdhoorn gravatar image

No easy core support for this afaik, but I believe ros_type_introspection can do what you want.

edit flag offensive delete link more

Comments

Thanks, that is exactly what I needed.

Mehdi. gravatar image Mehdi.  ( 2017-09-07 07:16:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-07 02:57:13 -0600

Seen: 387 times

Last updated: Sep 07 '17