Skip to content

Commit

Permalink
fix for backward compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Davide Faconti <[email protected]>
  • Loading branch information
facontidavide committed Jan 19, 2024
1 parent 42dcd13 commit fcb9080
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ inline std::set<int> convertFromString(StringView key)
}

/**
* @brief Return parameter value from behavior tree node or ros2 parameter file
* @brief Return parameter value from behavior tree node or ros2 parameter file.
* @param node rclcpp::Node::SharedPtr
* @param param_name std::string
* @param behavior_tree_node the node
* @return <T>
* @param behavior_tree_node T2
* @return <T1>
*/
template<typename T>
T deconflictPortAndParamFrame(
template<typename T1, typename T2 = const BT::TreeNode>
T1 deconflictPortAndParamFrame(
rclcpp::Node::SharedPtr node,
std::string param_name,
const BT::TreeNode * behavior_tree_node)
{
T param_value;
bool param_from_input = behavior_tree_node->getInput<T>(param_name, param_value);
T1 param_value;
bool param_from_input = behavior_tree_node->getInput<T1>(param_name, param_value);

if constexpr (std::is_same_v<T, std::string>) {
if constexpr (std::is_same_v<T1, std::string>) {
// not valid if port doesn't exist or it is an empty string
param_from_input &= !param_value.empty();
}
Expand Down

0 comments on commit fcb9080

Please sign in to comment.