Hi all,
when I subscribe to a topic, is there a way to get the name / namespace of the publishing node on reception of a message?
I know about ros::this_node::getName()
and the like [Ref] but that only yields the name/-space of the current node. For example, assume I (manually) subscribe to /rosout
and I am receiving a message send from the node /foo/bar/node1
. Is there a way to get this information (/foo/bar/node1
) in the callback?
Please note that I prefer a way to do this in roscpp.
Thanks in advance!
EDIT: Since I am dealing with custom messages here, I've simply added the namespace of the sender to my message definition. However, I thought there's probably some smarter way to do this (and I was hoping that the sender is already contained somewhere in the received message data).
Originally posted by CodeFinder on ROS Answers with karma: 100 on 2016-07-25
Post score: 0