File tree 2 files changed +12
-0
lines changed
system/autoware_component_monitor/src
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ ComponentMonitor::ComponentMonitor(const rclcpp::NodeOptions & node_options)
17
17
}
18
18
19
19
pid_ = getpid ();
20
+ usage_msg_.pid = pid_;
20
21
}
21
22
22
23
void ComponentMonitor::timer_callback ()
@@ -25,6 +26,15 @@ void ComponentMonitor::timer_callback()
25
26
26
27
get_cpu_usage ();
27
28
get_mem_usage ();
29
+ publish ();
30
+ }
31
+
32
+ void ComponentMonitor::publish ()
33
+ {
34
+ std_msgs::msg::Header header;
35
+ header.stamp = now ();
36
+ header.frame_id = " component_monitor" ;
37
+ usage_msg_.header = header;
28
38
usage_pub_->publish (usage_msg_);
29
39
}
30
40
Original file line number Diff line number Diff line change 3
3
#include " rclcpp/rclcpp.hpp"
4
4
5
5
#include " autoware_internal_msgs/msg/system_usage.hpp"
6
+ #include " std_msgs/msg/header.hpp"
6
7
7
8
#include " boost/filesystem.hpp"
8
9
#include " boost/process.hpp"
@@ -20,6 +21,7 @@ class ComponentMonitor : public rclcpp::Node
20
21
21
22
private:
22
23
void timer_callback ();
24
+ void publish ();
23
25
std::stringstream run_command (const std::string & cmd) const ;
24
26
static std::vector<std::string> get_fields (std::stringstream & std_out);
25
27
static float to_float (const std::string & str);
You can’t perform that action at this time.
0 commit comments