[ros-users] How to identify the subscriber or the topic name related to a callback

Brian Gerkey gerkey at willowgarage.com
Wed Feb 2 03:59:48 UTC 2011

On Tue, Feb 1, 2011 at 11:49 AM, Jeremy Leibs <leibs at willowgarage.com> wrote:
> I apologize, I hadn't seen the full context of the original message,
> just Brian's response.  I see you are already using The MessageEvent.
> You can get the topic using something like:
> ros::M_string connection_header = event.getConnectionHeader();
> std::string topic = connection_header["topic"];

That's much better!  For some reason, I thought that
getConnectionHeader() gave you a string that you would have to parse


More information about the ros-users mailing list