Class ParameterReader

Class Documentation

class ParameterReader

This is class is meant as a replacement for the filters::FilterBase<T>::getParam method. This class offer declaring and reading paramters. It only returns a value if the the user has set the parameter in the parameter configuration yaml file and does not return a default value if the parameter is not found (unlike the FilterBase method mentioned above).

Public Functions

inline ParameterReader(std::string param_prefix, rclcpp::node_interfaces::NodeParametersInterface::SharedPtr params_interface)

Constructor

Parameters:
  • param_prefix – The parameter prefix.

  • params_interface – The node parameters interface to use.

template<typename T>
inline bool get_template(const std::string &name, T &value_out, rclcpp::ParameterType param_type)

Retrives parameter value when defined by user.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

  • param_type – The excpected type of the parameter.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, int &value_out)

Reads parameter of type int.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, double &value_out)

Reads parameter of type double.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, std::string &value_out)

Reads parameter of type std::string.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, bool &value_out)

Reads parameter of type boolean.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, std::vector<double> &value_out)

Reads parameter of type array of double.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.

inline bool get(const std::string &name, std::vector<std::string> &value_out)

Reads parameter of type array of string.

Parameters:
  • name – The name of the parameter to read.

  • value_out – The value of the parameter, will only be changed if the parameter is found.

Returns:

- true if a parameter defined by the user is found.