Template Function nav2_util::declare_or_get_parameter(NodeT, const std::string&, const ParamType&, const ParameterDescriptor&)

Function Documentation

template<typename ParamType, typename NodeT>
ParamType nav2_util::declare_or_get_parameter(NodeT node, const std::string &parameter_name, const ParamType &default_value, const ParameterDescriptor &parameter_descriptor = ParameterDescriptor())

If the parameter is already declared, returns its value, otherwise declares it and returns the default value If the parameter is already declared, returns its value, otherwise declares it and returns the default value. The method can be configured to print a warn message or throw an InvalidParameterValueException when the override is missing by enabling the parameters warn_on_missing_params or strict_param_loading respectively.

Parameters:
  • node[in] Pointer to a node object

  • parameter_name[in] Name of the parameter

  • default_value[in] Default value of the parameter

  • parameter_descriptor[in] Optional parameter descriptor

Returns:

The value of the param from the override if existent, otherwise the default value