Skip to content

Commit 82aea7b

Browse files
dkoldaevDmitrii Koldaev
and
Dmitrii Koldaev
authored
feat(duplicated_node_checker): add duplicate nodes to ignore (autowarefoundation#7959)
* feat: add duplicate nodes to ignore Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> * remove talker Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> * newline Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> * commments Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> * pre-commit and sign Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> * rviz->rviz2 Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> --------- Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> Co-authored-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
1 parent 53bd126 commit 82aea7b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

system/duplicated_node_checker/config/duplicated_node_checker.param.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
ros__parameters:
33
update_rate: 10.0
44
add_duplicated_node_names_to_msg: true # if true, duplicated node names are added to msg
5+
nodes_to_ignore: # List of nodes to ignore when checking for duplicates
6+
- /rviz2

system/duplicated_node_checker/include/duplicated_node_checker/duplicated_node_checker_core.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class DuplicatedNodeChecker : public rclcpp::Node
3333
std::unordered_set<std::string> unique_names;
3434
std::vector<std::string> identical_names;
3535
for (auto name : input_name_lists) {
36+
if (nodes_to_ignore_.count(name) != 0) {
37+
continue;
38+
}
3639
if (unique_names.find(name) != unique_names.end()) {
3740
identical_names.push_back(name);
3841
} else {
@@ -49,6 +52,7 @@ class DuplicatedNodeChecker : public rclcpp::Node
4952
diagnostic_updater::Updater updater_{this};
5053
rclcpp::TimerBase::SharedPtr timer_;
5154
bool add_duplicated_node_names_to_msg_;
55+
std::unordered_set<std::string> nodes_to_ignore_;
5256
};
5357
} // namespace duplicated_node_checker
5458

system/duplicated_node_checker/src/duplicated_node_checker_core.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ DuplicatedNodeChecker::DuplicatedNodeChecker(const rclcpp::NodeOptions & node_op
2929
{
3030
double update_rate = declare_parameter<double>("update_rate");
3131
add_duplicated_node_names_to_msg_ = declare_parameter<bool>("add_duplicated_node_names_to_msg");
32+
33+
std::vector<std::string> nodes_to_ignore_vector =
34+
declare_parameter<std::vector<std::string>>("nodes_to_ignore");
35+
nodes_to_ignore_.insert(nodes_to_ignore_vector.begin(), nodes_to_ignore_vector.end());
36+
3237
updater_.setHardwareID("duplicated_node_checker");
3338
updater_.add("duplicated_node_checker", this, &DuplicatedNodeChecker::produceDiagnostics);
3439

0 commit comments

Comments
 (0)