Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ class LifecycleNode : public node_interfaces::LifecycleNodeInterface,
ParameterT & value,
const ParameterT & alternative_value) const;

/// Return the parameter value, or the "alternative_value" if not set.
/**
* \sa rclcpp::Node::get_parameter_or
*/
template<typename ParameterT>
ParameterT
get_parameter_or(
const std::string & name,
const ParameterT & alternative_value) const;

/// Return the parameters by the given parameter names.
/**
* \sa rclcpp::Node::get_parameters
Expand Down
11 changes: 11 additions & 0 deletions rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,16 @@ LifecycleNode::get_parameter_or(
return got_parameter;
}

template<typename ParameterT>
ParameterT
LifecycleNode::get_parameter_or(
const std::string & name,
const ParameterT & alternative_value) const
{
ParameterT parameter;
get_parameter_or(name, parameter, alternative_value);
return parameter;
}

} // namespace rclcpp_lifecycle
#endif // RCLCPP_LIFECYCLE__LIFECYCLE_NODE_IMPL_HPP_