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

Tully Foote tfoote at willowgarage.com
Thu Sep 9 18:24:20 UTC 2010


Ivan,
The node name is actually embedded in the ROS_INFO output, although it does
not display to the console.

If you are debugging several nodes at once I suggest you try the tool
rxconsole. http://www.ros.org/wiki/rxconsole It displays the debugging info,
line number, and more.  And its output can be filtered using regexs.  It's
display can be paused and scrolled back, refiltered etc.

This also will work for multiple machines and terminals, so you don't have
to worry about launching everything together to get debugging interleaved.

To your question, I don't actually know how to print the name.  Good design
principles would suggest that you don't need to know the name within the
node because all names can be remapped, and if they are then they would be
fragile if the name was coded inside.

Tully

On Thu, Sep 9, 2010 at 10:22 AM, Ivan Dryanovski
<ivan.dryanovski at gmail.com>wrote:

> 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
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



-- 
Tully Foote
Systems Engineer
Willow Garage, Inc.
tfoote at willowgarage.com
(650) 475-2827
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100909/ea73e18f/attachment-0003.html>


More information about the ros-users mailing list