Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(duplicated_node_checker): add duplicate nodes to ignore (#7959) #1410

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class DuplicatedNodeChecker : public rclcpp::Node
std::unordered_set<std::string> unique_names;
std::vector<std::string> 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 {
Expand All @@ -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<std::string> nodes_to_ignore_;
};
} // namespace duplicated_node_checker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ DuplicatedNodeChecker::DuplicatedNodeChecker(const rclcpp::NodeOptions & node_op
{
double update_rate = declare_parameter<double>("update_rate");
add_duplicated_node_names_to_msg_ = declare_parameter<bool>("add_duplicated_node_names_to_msg");

std::vector<std::string> nodes_to_ignore_vector =
declare_parameter<std::vector<std::string>>("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);

Expand Down
Loading