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

Revision history [back]

click to hide/show revision 1
initial version

I am not 100% sure I completely understood what you intent to do, but I think your basic intent is to subscribe to a message of which you do not know the type (at least at compile time, maybe in your lib-part even not at runtime). If so maybe it'd be of interest for you how this is done in topic_tools/throttle:

https://github.com/ros/ros_comm/blob/indigo-devel/tools/topic_tools/src/throttle.cpp

There a message is subscribed (and republished) without knowing its type. This is achieved by a class called ShapeShifter that exposes type getter / md5sum getter etc. for an arbitrary message type:

https://github.com/ros/ros_comm/blob/indigo-devel/tools/topic_tools/include/topic_tools/shape_shifter.h