12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- #include " autoware/localization_util/diagnostics_module .hpp"
15
+ #include " autoware/universe_utils/ros/diagnostics_interface .hpp"
16
16
17
17
#include < rclcpp/rclcpp.hpp>
18
18
21
21
#include < algorithm>
22
22
#include < string>
23
23
24
- namespace autoware ::localization_util
24
+ namespace autoware ::universe_utils
25
25
{
26
- DiagnosticsModule::DiagnosticsModule (rclcpp::Node * node, const std::string & diagnostic_name)
26
+ DiagnosticInterface::DiagnosticInterface (rclcpp::Node * node, const std::string & diagnostic_name)
27
27
: clock_(node->get_clock ())
28
28
{
29
29
diagnostics_pub_ =
@@ -34,7 +34,7 @@ DiagnosticsModule::DiagnosticsModule(rclcpp::Node * node, const std::string & di
34
34
diagnostics_status_msg_.hardware_id = node->get_name ();
35
35
}
36
36
37
- void DiagnosticsModule ::clear ()
37
+ void DiagnosticInterface ::clear ()
38
38
{
39
39
diagnostics_status_msg_.values .clear ();
40
40
diagnostics_status_msg_.values .shrink_to_fit ();
@@ -43,7 +43,7 @@ void DiagnosticsModule::clear()
43
43
diagnostics_status_msg_.message = " " ;
44
44
}
45
45
46
- void DiagnosticsModule ::add_key_value (const diagnostic_msgs::msg::KeyValue & key_value_msg)
46
+ void DiagnosticInterface ::add_key_value (const diagnostic_msgs::msg::KeyValue & key_value_msg)
47
47
{
48
48
auto it = std::find_if (
49
49
std::begin (diagnostics_status_msg_.values ), std::end (diagnostics_status_msg_.values ),
@@ -56,25 +56,23 @@ void DiagnosticsModule::add_key_value(const diagnostic_msgs::msg::KeyValue & key
56
56
}
57
57
}
58
58
59
- template <>
60
- void DiagnosticsModule::add_key_value (const std::string & key, const std::string & value)
59
+ void DiagnosticInterface::add_key_value (const std::string & key, const std::string & value)
61
60
{
62
61
diagnostic_msgs::msg::KeyValue key_value;
63
62
key_value.key = key;
64
63
key_value.value = value;
65
64
add_key_value (key_value);
66
65
}
67
66
68
- template <>
69
- void DiagnosticsModule::add_key_value (const std::string & key, const bool & value)
67
+ void DiagnosticInterface::add_key_value (const std::string & key, bool value)
70
68
{
71
69
diagnostic_msgs::msg::KeyValue key_value;
72
70
key_value.key = key;
73
71
key_value.value = value ? " True" : " False" ;
74
72
add_key_value (key_value);
75
73
}
76
74
77
- void DiagnosticsModule ::update_level_and_message (const int8_t level, const std::string & message)
75
+ void DiagnosticInterface ::update_level_and_message (const int8_t level, const std::string & message)
78
76
{
79
77
if ((level > diagnostic_msgs::msg::DiagnosticStatus::OK)) {
80
78
if (!diagnostics_status_msg_.message .empty ()) {
@@ -87,12 +85,12 @@ void DiagnosticsModule::update_level_and_message(const int8_t level, const std::
87
85
}
88
86
}
89
87
90
- void DiagnosticsModule ::publish (const rclcpp::Time & publish_time_stamp)
88
+ void DiagnosticInterface ::publish (const rclcpp::Time & publish_time_stamp)
91
89
{
92
90
diagnostics_pub_->publish (create_diagnostics_array (publish_time_stamp));
93
91
}
94
92
95
- diagnostic_msgs::msg::DiagnosticArray DiagnosticsModule ::create_diagnostics_array (
93
+ diagnostic_msgs::msg::DiagnosticArray DiagnosticInterface ::create_diagnostics_array (
96
94
const rclcpp::Time & publish_time_stamp) const
97
95
{
98
96
diagnostic_msgs::msg::DiagnosticArray diagnostics_msg;
@@ -105,4 +103,4 @@ diagnostic_msgs::msg::DiagnosticArray DiagnosticsModule::create_diagnostics_arra
105
103
106
104
return diagnostics_msg;
107
105
}
108
- } // namespace autoware::localization_util
106
+ } // namespace autoware::universe_utils
0 commit comments