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 duplicated node names to msg #5382

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
@@ -1,3 +1,4 @@
/**:
ros__parameters:
update_rate: 10.0
add_duplicated_node_names_to_msg: false # if true, duplicated node names are added to msg
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class DuplicatedNodeChecker : public rclcpp::Node

diagnostic_updater::Updater updater_{this};
rclcpp::TimerBase::SharedPtr timer_;
bool add_duplicated_node_names_to_msg_;
};
} // namespace duplicated_node_checker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
: Node("duplicated_node_checker", node_options)
{
double update_rate = declare_parameter<double>("update_rate");
add_duplicated_node_names_to_msg_ = declare_parameter<bool>("add_duplicated_node_names_to_msg");

Check warning on line 31 in system/duplicated_node_checker/src/duplicated_node_checker_core.cpp

View check run for this annotation

Codecov / codecov/patch

system/duplicated_node_checker/src/duplicated_node_checker_core.cpp#L31

Added line #L31 was not covered by tests
updater_.setHardwareID("duplicated_node_checker");
updater_.add("duplicated_node_checker", this, &DuplicatedNodeChecker::produceDiagnostics);

Expand Down Expand Up @@ -63,8 +64,14 @@
std::string msg;
int level;
if (identical_names.size() > 0) {
msg = "Error";
level = DiagnosticStatus::ERROR;
msg = "Error: Duplicated nodes detected";
if (add_duplicated_node_names_to_msg_) {
std::set<std::string> unique_identical_names(identical_names.begin(), identical_names.end());
for (const auto & name : unique_identical_names) {
msg += " " + name;

Check warning on line 72 in system/duplicated_node_checker/src/duplicated_node_checker_core.cpp

View check run for this annotation

Codecov / codecov/patch

system/duplicated_node_checker/src/duplicated_node_checker_core.cpp#L69-L72

Added lines #L69 - L72 were not covered by tests
}
}
for (auto name : identical_names) {
stat.add("Duplicated Node Name", name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
/autoware/system/service_log_checker: { sf_at: "warn", lf_at: "none", spf_at: "none" }
/autoware/system/duplicated_node_checker: default
# /autoware/system/resource_monitoring: { sf_at: "warn", lf_at: "error", spf_at: "none" }
# /autoware/system/duplicated_node_checker: default
Copy link
Contributor

@Owen-Liuyuxuan Owen-Liuyuxuan Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I know what is the motivation for adding this commented line in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/autoware/vehicle/node_alive_monitoring: default

Expand Down
Loading