At the very end, this is how remapping is implemented (in roscpp/libros/names.cpp):
std::string remap(const std::string& name)
{
std::string resolved = resolve(name, false);
M_string::const_iterator it = g_remappings.find(resolved);
if (it != g_remappings.end())
{
return it->second;
}
return name;
}
In words: for a given name
, lookup the mapping from name
to some other string
, and if there is such a mapping registered, return the "other string
".
Otherwise, return the name
we were given.
The Python implementation does something similar.
This function is used by other functions such as ros::names::resolve(..) (documentation) which are used throughout the ROS codebase to resolve local names to global ones.
Is it possible to directly have nodes run without wrapping them in launch files and still have topic remapping abilities?
Yes. See wiki/Remapping Arguments for information on that. Any argument to a rosrun
invocation that is not prefixed with a _
or __
is assumed to be a remap argument.
Can you expand your question a little by showing us what you've found already?