Template Class NodeletParamHelper

Inheritance Relationships

Base Types

  • public NodeletType

  • public cras::ParamHelper

Derived Type

Class Documentation

template<typename NodeletType>
class NodeletParamHelper : public virtual NodeletType, public cras::ParamHelper

This mixin allows calling the getParam() helpers.

Template Parameters:

NodeletType – Type of the base nodelet.

Subclassed by cras::NodeletBase<::nodelet::Nodelet >

Public Functions

NodeletParamHelper()
~NodeletParamHelper() override

Protected Functions

template<typename ResultType, typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr> inline inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &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).

Template Parameters:
  • ResultType – Param type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).

  • ParamServerType – Intermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.

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:

A wrapper containing the loaded parameter value and details about the function execution.

template<typename ResultType, typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr> inline inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

Template Parameters:
  • ResultType – Param type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).

  • ParamServerType – Intermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.

Parameters:
  • node[in] The node handle from which parameters are read.

  • name[in] Name of the parameter.

  • defaultValue[in] The default value to use.

  • 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:

A wrapper containing the loaded parameter value and details about the function execution.

template<typename ResultType, typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types<ResultType, ParamServerType>* = nullptr>
inline ResultType getParam(const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional<ResultType> &defaultValue = ResultType(), const ::std::string &unit = "", const ::cras::GetParamOptions<ResultType, ParamServerType> &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).

Template Parameters:
  • ResultType – Param type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).

  • ParamServerType – Intermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.

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.

template<typename ResultType, typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types<ResultType, ParamServerType>* = nullptr>
inline ResultType getParam(const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue = ResultType(), const ::std::string &unit = "", const ::cras::GetParamOptions<ResultType, ParamServerType> &options = {})

Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified).

Template Parameters:
  • ResultType – Param type (the C++ type). It is converted from the intermediate ParamServerType using options.toResult function (which defaults to static_cast).

  • ParamServerType – Intermediate type to which the XmlRpcValue read from parameter server is converted. The conversion is done using options.toParam function (which defaults to cras::convert). Most overloads of cras::convert are in xmlrpc_value_utils.hpp, but you can add your own.

Parameters:
  • node[in] The node handle from which parameters are read.

  • name[in] Name of the parameter.

  • defaultValue[in] The default value to use.

  • 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.

inline inline ::cras::GetParamResult<::std::string > getParamVerbose (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:

A wrapper containing the loaded parameter value and details about the function execution.

inline inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, 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, 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.

  • 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:

A wrapper containing the loaded parameter value and details about the function execution.

inline inline ::std::string 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.

inline inline ::std::string getParam (const ::ros::NodeHandle &node, const ::std::string &name, 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, 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.

  • 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.

::cras::BoundParamHelperPtr params(const ::ros::NodeHandle &node, const ::std::string &ns = "") const

Creates a version of this param helper “bound” to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters:
  • node[in] The node to bind to.

  • ns[in] If nonempty, returns just the parameters in the given namespace.

Returns:

The bound param helper.

::cras::BoundParamHelperPtr privateParams(const ::std::string &ns = "") const

Creates a version of this param helper “bound” to the private nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters:

ns[in] If nonempty, returns just the parameters in the given namespace.

Returns:

The bound param helper.

::cras::BoundParamHelperPtr publicParams(const ::std::string &ns = "") const

Creates a version of this param helper “bound” to the public nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters:

ns[in] If nonempty, returns just the parameters in the given namespace.

Returns:

The bound param helper.

::cras::BoundParamHelperPtr paramsForNodeHandle(const ::ros::NodeHandle &node) const

Creates a version of this param helper “bound” to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls.

Parameters:

node[in] The node to bind to.

Returns:

The bound param helper.