Template Function nav_2d_utils::searchAndGetParam

Function Documentation

template<class param_t>
param_t nav_2d_utils::searchAndGetParam(const nav2_util::LifecycleNode::SharedPtr &nh, const std::string &param_name, const param_t &default_value)

Search for a parameter and load it, or use the default value.

This templated function shortens a commonly used ROS pattern in which you search for a parameter and get its value if it exists, otherwise returning a default value.

Parameters:
  • nh – NodeHandle to start the parameter search from

  • param_name – Name of the parameter to search for

  • default_value – Value to return if not found

Returns:

Value of parameter if found, otherwise the default_value