Function cras::toValidRosName
Defined in File string_utils.hpp
Function Documentation
-
::std::string cras::toValidRosName(const ::std::string &text, bool baseName = true, const ::std::optional<::std::string> &fallbackName = ::std::nullopt)
Make sure the given string can be used as ROS name.
- Parameters:
text – The text to convert.
baseName – If true, the text represents only one “level” of names. If False, it can be the absolute or relative name with ~ and /.
fallbackName – If specified, this name will be used if the automated conversion fails. This name is not checked to be valid.
- Throws:
std::invalid_argument – If the given text cannot be converted to a valid ROS name, and no
fallback_nameis specified.- Returns:
The valid ROS graph resource name.