Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The call to ros::init() will parse argc and argv looking for the := operator and seting private parameters and remappings. It then modifies argc and argvto leave any unrecognized command-line parameters for your code to parse. This behavior is documented in roscpp Initialization and Shutdown

Per the documentation on remapping arguments, any remapping arguments that start with _ are interpreted as setting a private parameter, and other arguments that do not start with _ are interpreted as topic remappings.

As described in roscpp Parameters, you can retrieve private parameters by creating a private NodeHandle and calling getParam() on it:

ros::NodeHandle nh("~");
std::string param;
nh.getParam("private_name", param);

It's also possible to retrieve remappings from a NodeHandle object, but unless you're explicitly trying to use this for more complex topic or service remappings within your node, it's not recommended.