diff --git a/system/autoware_node_death_monitor/launch/autoware_node_death_monitor.launch.xml b/system/autoware_node_death_monitor/launch/autoware_node_death_monitor.launch.xml deleted file mode 100644 index 7d217f614556c..0000000000000 --- a/system/autoware_node_death_monitor/launch/autoware_node_death_monitor.launch.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/system/autoware_process_alive_monitor/CHANGELOG.rst b/system/autoware_process_alive_monitor/CHANGELOG.rst new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/system/autoware_node_death_monitor/CMakeLists.txt b/system/autoware_process_alive_monitor/CMakeLists.txt similarity index 66% rename from system/autoware_node_death_monitor/CMakeLists.txt rename to system/autoware_process_alive_monitor/CMakeLists.txt index 8bf400e0c0649..3d4f50c5c3428 100644 --- a/system/autoware_node_death_monitor/CMakeLists.txt +++ b/system/autoware_process_alive_monitor/CMakeLists.txt @@ -1,15 +1,15 @@ cmake_minimum_required(VERSION 3.14) -project(autoware_node_death_monitor) +project(autoware_process_alive_monitor) find_package(autoware_cmake REQUIRED) autoware_package() ament_auto_add_library(${PROJECT_NAME} SHARED - src/autoware_node_death_monitor.cpp + src/autoware_process_alive_monitor.cpp ) rclcpp_components_register_node(${PROJECT_NAME} - PLUGIN "autoware::node_death_monitor::NodeDeathMonitor" + PLUGIN "autoware::process_alive_monitor::ProcessAliveMonitor" EXECUTABLE ${PROJECT_NAME}_node) ament_auto_package(INSTALL_TO_SHARE diff --git a/system/autoware_node_death_monitor/README.md b/system/autoware_process_alive_monitor/README.md similarity index 87% rename from system/autoware_node_death_monitor/README.md rename to system/autoware_process_alive_monitor/README.md index 7df8393a64d03..f84d60227cbf5 100644 --- a/system/autoware_node_death_monitor/README.md +++ b/system/autoware_process_alive_monitor/README.md @@ -1,4 +1,4 @@ -# autoware_node_death_monitor +# autoware_process_alive_monitor This package provides a monitoring node that detects ROS 2 node crashes by analyzing `launch.log` files, rather than subscribing to `/rosout` logs. @@ -6,7 +6,7 @@ This package provides a monitoring node that detects ROS 2 node crashes by analy ## Overview -- **Node name**: `autoware_node_death_monitor` +- **Node name**: `autoware_process_alive_monitor` - **Monitored file**: `launch.log` - **Detected event**: Looks for lines containing the substring `"process has died"` and extracts the node name and exit code. @@ -16,7 +16,7 @@ When a crash or unexpected shutdown occurs, `ros2 launch` typically outputs a li [ERROR] [node_name-1]: process has died [pid 12345, exit code 139, cmd '...'] ``` -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." +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." --- @@ -48,10 +48,10 @@ The `autoware_node_death_monitor` node continuously reads the latest `launch.log | `check_interval` | `double` | `1.0` | Timer interval (seconds) for scanning the log file. | | `enable_debug` | `bool` | `false` | Enables debug logging for detailed output. | -Example **`autoware_node_death_monitor.param.yaml`**: +Example **`autoware_process_alive_monitor.param.yaml`**: ```yaml -autoware_node_death_monitor: +autoware_process_alive_monitor: ros__parameters: ignore_node_names: - rviz2 diff --git a/system/autoware_node_death_monitor/config/autoware_node_death_monitor.param.yaml b/system/autoware_process_alive_monitor/config/autoware_process_alive_monitor.param.yaml similarity index 100% rename from system/autoware_node_death_monitor/config/autoware_node_death_monitor.param.yaml rename to system/autoware_process_alive_monitor/config/autoware_process_alive_monitor.param.yaml diff --git a/system/autoware_node_death_monitor/include/autoware_node_death_monitor/autoware_node_death_monitor.hpp b/system/autoware_process_alive_monitor/include/autoware_process_alive_monitor/autoware_process_alive_monitor.hpp similarity index 78% rename from system/autoware_node_death_monitor/include/autoware_node_death_monitor/autoware_node_death_monitor.hpp rename to system/autoware_process_alive_monitor/include/autoware_process_alive_monitor/autoware_process_alive_monitor.hpp index ec4392294b5d8..b258f639bcfeb 100644 --- a/system/autoware_node_death_monitor/include/autoware_node_death_monitor/autoware_node_death_monitor.hpp +++ b/system/autoware_process_alive_monitor/include/autoware_process_alive_monitor/autoware_process_alive_monitor.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_ -#define AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_ +#ifndef AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_ +#define AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_ #include "rclcpp/rclcpp.hpp" @@ -22,17 +22,17 @@ #include #include -namespace autoware::node_death_monitor +namespace autoware::process_alive_monitor { -class NodeDeathMonitor : public rclcpp::Node +class ProcessAliveMonitor : public rclcpp::Node { public: /** - * @brief Constructor for NodeDeathMonitor + * @brief Constructor for ProcessAliveMonitor * @param options Node options for configuration */ - explicit NodeDeathMonitor(const rclcpp::NodeOptions & options); + explicit ProcessAliveMonitor(const rclcpp::NodeOptions & options); private: /** @@ -67,6 +67,6 @@ class NodeDeathMonitor : public rclcpp::Node bool enable_debug_{false}; // Enable debug output }; -} // namespace autoware::node_death_monitor +} // namespace autoware::process_alive_monitor -#endif // AUTOWARE_NODE_DEATH_MONITOR__AUTOWARE_NODE_DEATH_MONITOR_HPP_ +#endif // AUTOWARE_PROCESS_ALIVE_MONITOR__AUTOWARE_PROCESS_ALIVE_MONITOR_HPP_ diff --git a/system/autoware_process_alive_monitor/launch/autoware_process_alive_monitor.launch.xml b/system/autoware_process_alive_monitor/launch/autoware_process_alive_monitor.launch.xml new file mode 100644 index 0000000000000..11966c7b27bb0 --- /dev/null +++ b/system/autoware_process_alive_monitor/launch/autoware_process_alive_monitor.launch.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/system/autoware_node_death_monitor/package.xml b/system/autoware_process_alive_monitor/package.xml similarity index 83% rename from system/autoware_node_death_monitor/package.xml rename to system/autoware_process_alive_monitor/package.xml index 39b524ff78d01..08b0f5ef8fceb 100644 --- a/system/autoware_node_death_monitor/package.xml +++ b/system/autoware_process_alive_monitor/package.xml @@ -1,8 +1,8 @@ - autoware_node_death_monitor + autoware_process_alive_monitor 0.0.1 - The node_death_monitor package + The process_alive_monitor package Kyoichi Sugahara Apache License 2.0 diff --git a/system/autoware_node_death_monitor/src/autoware_node_death_monitor.cpp b/system/autoware_process_alive_monitor/src/autoware_process_alive_monitor.cpp similarity index 93% rename from system/autoware_node_death_monitor/src/autoware_node_death_monitor.cpp rename to system/autoware_process_alive_monitor/src/autoware_process_alive_monitor.cpp index 93597ab09d575..3ee44016711c4 100644 --- a/system/autoware_node_death_monitor/src/autoware_node_death_monitor.cpp +++ b/system/autoware_process_alive_monitor/src/autoware_process_alive_monitor.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "autoware_node_death_monitor/autoware_node_death_monitor.hpp" +#include "autoware_process_alive_monitor/autoware_process_alive_monitor.hpp" #include #include @@ -22,7 +22,7 @@ namespace fs = std::filesystem; -namespace autoware::node_death_monitor +namespace autoware::process_alive_monitor { /** @@ -76,8 +76,8 @@ static fs::path find_latest_launch_log() return fs::path(); } -NodeDeathMonitor::NodeDeathMonitor(const rclcpp::NodeOptions & options) -: Node("autoware_node_death_monitor", options) +ProcessAliveMonitor::ProcessAliveMonitor(const rclcpp::NodeOptions & options) +: Node("autoware_process_alive_monitor", options) { ignore_node_names_ = declare_parameter>("ignore_node_names", std::vector{}); @@ -109,10 +109,10 @@ NodeDeathMonitor::NodeDeathMonitor(const rclcpp::NodeOptions & options) auto interval_ns = std::chrono::duration_cast( std::chrono::duration(check_interval_)); - timer_ = create_wall_timer(interval_ns, std::bind(&NodeDeathMonitor::on_timer, this)); + timer_ = create_wall_timer(interval_ns, std::bind(&ProcessAliveMonitor::on_timer, this)); } -void NodeDeathMonitor::read_launch_log_diff() +void ProcessAliveMonitor::read_launch_log_diff() { if (launch_log_path_.empty()) { return; @@ -150,7 +150,7 @@ void NodeDeathMonitor::read_launch_log_diff() std::streampos last_valid_pos = static_cast(last_file_pos_); size_t iteration = 0; - while (true) { + while (rclcpp::ok) { // Check current position std::streampos current_pos_start = ifs.tellg(); if (current_pos_start == std::streampos(-1)) { @@ -200,7 +200,7 @@ void NodeDeathMonitor::read_launch_log_diff() } } -void NodeDeathMonitor::parse_log_line(const std::string & line) +void ProcessAliveMonitor::parse_log_line(const std::string & line) { const std::string target_str = "process has died"; if (line.find(target_str) == std::string::npos) { @@ -286,7 +286,7 @@ void NodeDeathMonitor::parse_log_line(const std::string & line) } } -void NodeDeathMonitor::on_timer() +void ProcessAliveMonitor::on_timer() { read_launch_log_diff(); @@ -304,7 +304,7 @@ void NodeDeathMonitor::on_timer() } } -} // namespace autoware::node_death_monitor +} // namespace autoware::process_alive_monitor #include -RCLCPP_COMPONENTS_REGISTER_NODE(autoware::node_death_monitor::NodeDeathMonitor) +RCLCPP_COMPONENTS_REGISTER_NODE(autoware::process_alive_monitor::ProcessAliveMonitor)