Function cras::getParam(const ::ros::NodeHandle&, const ::std::string&, const ::cras::optional<const char *>&, const ::std::string&, const ::cras::GetParamOptions<::std::string>&)
Defined in File node_utils.hpp
Function Documentation
-
inline ::std::string cras::getParam(const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional<const char*> &defaultValue, const ::std::string &unit = "", const ::cras::GetParamOptions<::std::string> &options = {})
Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified).
This is a variant allowing use of C-string instead of std::string.
- Parameters:
node – [in] The node handle from which parameters are read.
name – [in] Name of the parameter.
defaultValue – [in] The default value to use. If std::nullopt, then the parameter is required. If a required param is not found, a GetParamException is thrown.
unit – [in] Optional string serving as a [physical/SI] unit of the parameter, just to make the messages more informative.
options – [in] Options specifying detailed behavior of this function. Use the braced initializer syntax for comfortable writing, e.g.
{.throwIfConvertFails = true, .allowNestedParams = false}.
- Returns:
The loaded parameter value.