Skip to content

Commit 572427d

Browse files
feat: change from node_death_monitor from process_alive_monitor
Signed-off-by: Kyoichi Sugahara <kyoichi.sugahara@tier4.jp>
1 parent 8ef11c7 commit 572427d

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
lines changed

system/autoware_node_death_monitor/launch/autoware_node_death_monitor.launch.xml

-12
This file was deleted.

system/autoware_process_alive_monitor/CHANGELOG.rst

Whitespace-only changes.

system/autoware_node_death_monitor/CMakeLists.txt system/autoware_process_alive_monitor/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(autoware_node_death_monitor)
2+
project(autoware_process_alive_monitor)
33

44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
66

77
ament_auto_add_library(${PROJECT_NAME} SHARED
8-
src/autoware_node_death_monitor.cpp
8+
src/autoware_process_alive_monitor.cpp
99
)
1010

1111
rclcpp_components_register_node(${PROJECT_NAME}
12-
PLUGIN "autoware::node_death_monitor::NodeDeathMonitor"
12+
PLUGIN "autoware::process_alive_monitor::ProcessAliveMonitor"
1313
EXECUTABLE ${PROJECT_NAME}_node)
1414

1515
ament_auto_package(INSTALL_TO_SHARE

system/autoware_node_death_monitor/README.md system/autoware_process_alive_monitor/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# autoware_node_death_monitor
1+
# autoware_process_alive_monitor
22

33
This package provides a monitoring node that detects ROS 2 node crashes by analyzing `launch.log` files, rather than subscribing to `/rosout` logs.
44

55
---
66

77
## Overview
88

9-
- **Node name**: `autoware_node_death_monitor`
9+
- **Node name**: `autoware_process_alive_monitor`
1010
- **Monitored file**: `launch.log`
1111
- **Detected event**: Looks for lines containing the substring `"process has died"` and extracts the node name and exit code.
1212

@@ -16,7 +16,7 @@ When a crash or unexpected shutdown occurs, `ros2 launch` typically outputs a li
1616
[ERROR] [node_name-1]: process has died [pid 12345, exit code 139, cmd '...']
1717
```
1818

19-
The `autoware_node_death_monitor` node continuously reads the latest `launch.log` file, detects these messages, and logs a warning or marks the node as "dead."
19+
The `autoware_process_alive_monitor` node continuously reads the latest `launch.log` file, detects these messages, and logs a warning or marks the node as "dead."
2020

2121
---
2222

@@ -48,10 +48,10 @@ The `autoware_node_death_monitor` node continuously reads the latest `launch.log
4848
| `check_interval` | `double` | `1.0` | Timer interval (seconds) for scanning the log file. |
4949
| `enable_debug` | `bool` | `false` | Enables debug logging for detailed output. |
5050

51-
Example **`autoware_node_death_monitor.param.yaml`**:
51+
Example **`autoware_process_alive_monitor.param.yaml`**:
5252

5353
```yaml
54-
autoware_node_death_monitor:
54+
autoware_process_alive_monitor:
5555
ros__parameters:
5656
ignore_node_names:
5757
- rviz2

system/autoware_node_death_monitor/include/autoware_node_death_monitor/autoware_node_death_monitor.hpp system/autoware_process_alive_monitor/include/autoware_process_alive_monitor/autoware_process_alive_monitor.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_
16-
#define AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_
15+
#ifndef AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_
16+
#define AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_
1717

1818
#include "rclcpp/rclcpp.hpp"
1919

@@ -22,17 +22,17 @@
2222
#include <unordered_map>
2323
#include <vector>
2424

25-
namespace autoware::node_death_monitor
25+
namespace autoware::process_alive_monitor
2626
{
2727

28-
class NodeDeathMonitor : public rclcpp::Node
28+
class ProcessAliveMonitor : public rclcpp::Node
2929
{
3030
public:
3131
/**
32-
* @brief Constructor for NodeDeathMonitor
32+
* @brief Constructor for ProcessAliveMonitor
3333
* @param options Node options for configuration
3434
*/
35-
explicit NodeDeathMonitor(const rclcpp::NodeOptions & options);
35+
explicit ProcessAliveMonitor(const rclcpp::NodeOptions & options);
3636

3737
private:
3838
/**
@@ -67,6 +67,6 @@ class NodeDeathMonitor : public rclcpp::Node
6767
bool enable_debug_{false}; // Enable debug output
6868
};
6969

70-
} // namespace autoware::node_death_monitor
70+
} // namespace autoware::process_alive_monitor
7171

72-
#endif // AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_
72+
#endif // AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<launch>
2+
<!-- Parameter -->
3+
<arg name="config_file" default="$(find-pkg-share autoware_process_alive_monitor)/config/autoware_process_alive_monitor.param.yaml"/>
4+
5+
<!-- Set log level -->
6+
<arg name="log_level" default="info"/>
7+
8+
<node pkg="autoware_process_alive_monitor" exec="autoware_process_alive_monitor_node" name="process_alive_monitor" output="screen" args="--ros-args --log-level $(var log_level)">
9+
<!-- Parameter -->
10+
<param from="$(var config_file)"/>
11+
</node>
12+
</launch>

system/autoware_node_death_monitor/package.xml system/autoware_process_alive_monitor/package.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<package format="3">
3-
<name>autoware_node_death_monitor</name>
3+
<name>autoware_process_alive_monitor</name>
44
<version>0.0.1</version>
5-
<description>The node_death_monitor package</description>
5+
<description>The process_alive_monitor package</description>
66

77
<maintainer email="kyoichi.sugahara@tier4.jp">Kyoichi Sugahara</maintainer>
88
<license>Apache License 2.0</license>

system/autoware_node_death_monitor/src/autoware_node_death_monitor.cpp system/autoware_process_alive_monitor/src/autoware_process_alive_monitor.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "autoware_node_death_monitor/autoware_node_death_monitor.hpp"
15+
#include "autoware_process_alive_monitor/autoware_process_alive_monitor.hpp"
1616

1717
#include <filesystem>
1818
#include <fstream>
@@ -22,7 +22,7 @@
2222

2323
namespace fs = std::filesystem;
2424

25-
namespace autoware::node_death_monitor
25+
namespace autoware::process_alive_monitor
2626
{
2727

2828
/**
@@ -76,8 +76,8 @@ static fs::path find_latest_launch_log()
7676
return fs::path();
7777
}
7878

79-
NodeDeathMonitor::NodeDeathMonitor(const rclcpp::NodeOptions & options)
80-
: Node("autoware_node_death_monitor", options)
79+
ProcessAliveMonitor::ProcessAliveMonitor(const rclcpp::NodeOptions & options)
80+
: Node("autoware_process_alive_monitor", options)
8181
{
8282
ignore_node_names_ =
8383
declare_parameter<std::vector<std::string>>("ignore_node_names", std::vector<std::string>{});
@@ -109,10 +109,10 @@ NodeDeathMonitor::NodeDeathMonitor(const rclcpp::NodeOptions & options)
109109

110110
auto interval_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(
111111
std::chrono::duration<double>(check_interval_));
112-
timer_ = create_wall_timer(interval_ns, std::bind(&NodeDeathMonitor::on_timer, this));
112+
timer_ = create_wall_timer(interval_ns, std::bind(&ProcessAliveMonitor::on_timer, this));
113113
}
114114

115-
void NodeDeathMonitor::read_launch_log_diff()
115+
void ProcessAliveMonitor::read_launch_log_diff()
116116
{
117117
if (launch_log_path_.empty()) {
118118
return;
@@ -150,7 +150,7 @@ void NodeDeathMonitor::read_launch_log_diff()
150150
std::streampos last_valid_pos = static_cast<std::streampos>(last_file_pos_);
151151

152152
size_t iteration = 0;
153-
while (true) {
153+
while (rclcpp::ok) {
154154
// Check current position
155155
std::streampos current_pos_start = ifs.tellg();
156156
if (current_pos_start == std::streampos(-1)) {
@@ -200,7 +200,7 @@ void NodeDeathMonitor::read_launch_log_diff()
200200
}
201201
}
202202

203-
void NodeDeathMonitor::parse_log_line(const std::string & line)
203+
void ProcessAliveMonitor::parse_log_line(const std::string & line)
204204
{
205205
const std::string target_str = "process has died";
206206
if (line.find(target_str) == std::string::npos) {
@@ -286,7 +286,7 @@ void NodeDeathMonitor::parse_log_line(const std::string & line)
286286
}
287287
}
288288

289-
void NodeDeathMonitor::on_timer()
289+
void ProcessAliveMonitor::on_timer()
290290
{
291291
read_launch_log_diff();
292292

@@ -304,7 +304,7 @@ void NodeDeathMonitor::on_timer()
304304
}
305305
}
306306

307-
} // namespace autoware::node_death_monitor
307+
} // namespace autoware::process_alive_monitor
308308

309309
#include <rclcpp_components/register_node_macro.hpp>
310-
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::node_death_monitor::NodeDeathMonitor)
310+
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::process_alive_monitor::ProcessAliveMonitor)

0 commit comments

Comments
 (0)