Template Function fuse_core::getParam(node_interfaces::NodeInterfaces<node_interfaces::Parameters>, const std::string&, const T&, const rcl_interfaces::msg::ParameterDescriptor&, bool)

Function Documentation

template<class T>
T fuse_core::getParam(node_interfaces::NodeInterfaces<node_interfaces::Parameters> interfaces, const std::string &parameter_name, const T &default_value, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor(), bool ignore_override = false)

Compatibility wrapper for ros2 params in ros1 syntax.

Declare a parameter if not declared, otherwise, get its value.

This is needed because the node parameters interface does not do the type conversions to and from ParameterValue for us.

Parameters:
  • interfaces[in] - The node interfaces used to load the parameter

  • parameter_name[in] - The ROS parameter name

  • default_value[out] - The default value for this parameter

  • parameter_descriptor[in] - An optional, custom description for the parameter.

  • ignore_override[in] When true, the parameter override is ignored. Default to false.

Throws:

rclcpp::exceptions::InvalidParameterTypeException – if the parameter type does not match

Returns:

The value of the parameter.