diff --git a/system/duplicated_node_checker/config/duplicated_node_checker.param.yaml b/system/duplicated_node_checker/config/duplicated_node_checker.param.yaml index 96dce7eb360e4..412c59e66e2c9 100644 --- a/system/duplicated_node_checker/config/duplicated_node_checker.param.yaml +++ b/system/duplicated_node_checker/config/duplicated_node_checker.param.yaml @@ -2,3 +2,5 @@ ros__parameters: update_rate: 10.0 add_duplicated_node_names_to_msg: true # if true, duplicated node names are added to msg + nodes_to_ignore: # List of nodes to ignore when checking for duplicates + - /rviz2 diff --git a/system/duplicated_node_checker/include/duplicated_node_checker/duplicated_node_checker_core.hpp b/system/duplicated_node_checker/include/duplicated_node_checker/duplicated_node_checker_core.hpp index 9d806754f3c20..66e125de666b7 100644 --- a/system/duplicated_node_checker/include/duplicated_node_checker/duplicated_node_checker_core.hpp +++ b/system/duplicated_node_checker/include/duplicated_node_checker/duplicated_node_checker_core.hpp @@ -33,6 +33,9 @@ class DuplicatedNodeChecker : public rclcpp::Node std::unordered_set unique_names; std::vector identical_names; for (auto name : input_name_lists) { + if (nodes_to_ignore_.count(name) != 0) { + continue; + } if (unique_names.find(name) != unique_names.end()) { identical_names.push_back(name); } else { @@ -49,6 +52,7 @@ class DuplicatedNodeChecker : public rclcpp::Node diagnostic_updater::Updater updater_{this}; rclcpp::TimerBase::SharedPtr timer_; bool add_duplicated_node_names_to_msg_; + std::unordered_set nodes_to_ignore_; }; } // namespace duplicated_node_checker diff --git a/system/duplicated_node_checker/src/duplicated_node_checker_core.cpp b/system/duplicated_node_checker/src/duplicated_node_checker_core.cpp index 384c8fdc46c5f..c9bc07cffde72 100644 --- a/system/duplicated_node_checker/src/duplicated_node_checker_core.cpp +++ b/system/duplicated_node_checker/src/duplicated_node_checker_core.cpp @@ -29,6 +29,11 @@ DuplicatedNodeChecker::DuplicatedNodeChecker(const rclcpp::NodeOptions & node_op { double update_rate = declare_parameter("update_rate"); add_duplicated_node_names_to_msg_ = declare_parameter("add_duplicated_node_names_to_msg"); + + std::vector nodes_to_ignore_vector = + declare_parameter>("nodes_to_ignore"); + nodes_to_ignore_.insert(nodes_to_ignore_vector.begin(), nodes_to_ignore_vector.end()); + updater_.setHardwareID("duplicated_node_checker"); updater_.add("duplicated_node_checker", this, &DuplicatedNodeChecker::produceDiagnostics);