Function nav2_util::sanitize_node_name

Function Documentation

std::string nav2_util::sanitize_node_name(const std::string &potential_node_name)

Replace invalid characters in a potential node name.

There is frequently a need to create internal nodes. They must have a name, and commonly the name is based on some parameter related to the node’s purpose. However, only alphanumeric characters and ‘_’ are allowed in node names. This function replaces any invalid character with a ‘_’

Parameters:

potential_node_name[in] Potential name but possibly with invalid charaters.

Returns:

A copy of the input string but with non-alphanumeric characters replaced with ‘_’