[ros-users] Access to node name (cpp)

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ivan Dryanovski
Date:  
To: ros-users
Subject: [ros-users] Access to node name (cpp)
Hi,

Can I access the name of a node from inside a cpp program? I know that
one of the argv** arguments passed through the program is
"__name:=FOO". Is there an easier way to access that, without having
to parse through the argv values?

What I am eventually interested in is having the name of the node
prepended to ROS_INFO statements. I was going to do it manually by
finding the name of the node and doing

ROS_INFO("%s: Some message here.", nodeName_);

Which would result in

FOO: Some message here.

If someone has a suggestion for a cleaner way to do this, let me know please!

Thanks,
Ivan Dryanovski