Functions
node_handle_namespaces.cpp File Reference
#include "ros/ros.h"
#include "std_msgs/String.h"
Include dependency graph for node_handle_namespaces.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

This tutorial shows the use of NodeHandle namespaces.

Each NodeHandle can be assigned a namespace the same way every node can be assigned a namespace (this is usually done through the environment variable ROS_NAMESPACE).

A namespace per NodeHandle allows you to separate different pieces of your application into different namespaces.

This prints /level1/a

If another NodeHandle is provided as the first argument to the constructor, it uses that NodeHandle's namespace as a parent namespace. Therefore, this NodeHandle will be in the /level1/level2 namespace.

This prints /level1/level2/a

Accessing private names (inside the nodes' name) is possible by creating a NodeHandle whose name starts with a tilde (~).

This prints /node_handle_namespaces/a

Definition at line 35 of file node_handle_namespaces.cpp.



roscpp_tutorials
Author(s): Morgan Quigley
autogenerated on Sat Dec 28 2013 17:34:19