Skip to content

Commit d7c2288

Browse files
authored
feat: componentize-system_error_monitor (#7009)
* feat: componentize-system_error_monitor Signed-off-by: TetsuKawa <kawaguchitnon@icloud.com> * modify: componentize-system_error_monitor Signed-off-by: TetsuKawa <kawaguchitnon@icloud.com> * feat: add explicit Signed-off-by: TetsuKawa <kawaguchitnon@icloud.com> --------- Signed-off-by: TetsuKawa <kawaguchitnon@icloud.com>
1 parent 2297b0c commit d7c2288

File tree

6 files changed

+13
-33
lines changed

6 files changed

+13
-33
lines changed

system/system_error_monitor/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ project(system_error_monitor)
44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
66

7-
ament_auto_add_executable(${PROJECT_NAME}
8-
src/system_error_monitor_node.cpp
7+
ament_auto_add_library(${PROJECT_NAME} SHARED
98
src/system_error_monitor_core.cpp
109
)
1110

11+
rclcpp_components_register_node(${PROJECT_NAME}
12+
PLUGIN "AutowareErrorMonitor"
13+
EXECUTABLE ${PROJECT_NAME}_node)
14+
1215
ament_auto_package(INSTALL_TO_SHARE
1316
launch
1417
config

system/system_error_monitor/include/system_error_monitor/system_error_monitor_core.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct KeyName
6464
class AutowareErrorMonitor : public rclcpp::Node
6565
{
6666
public:
67-
AutowareErrorMonitor();
67+
explicit AutowareErrorMonitor(const rclcpp::NodeOptions & options);
6868

6969
private:
7070
// Parameter

system/system_error_monitor/launch/system_error_monitor_node.launch.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<arg name="emergency_hazard_level" default="2" description="1: Safe Fault, 2: Latent Fault, 3: Single Point Fault"/>
1313

14-
<node pkg="system_error_monitor" exec="system_error_monitor" name="system_error_monitor" output="screen">
14+
<node pkg="system_error_monitor" exec="system_error_monitor_node" name="system_error_monitor" output="screen">
1515
<remap from="input/diag_array" to="/diagnostics_agg"/>
1616
<remap from="~/input/autoware_state" to="/autoware/state"/>
1717
<remap from="~/input/current_gate_mode" to="/control/current_gate_mode"/>

system/system_error_monitor/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<depend>diagnostic_msgs</depend>
1616
<depend>fmt</depend>
1717
<depend>rclcpp</depend>
18+
<depend>rclcpp_components</depend>
1819
<depend>std_srvs</depend>
1920
<depend>tier4_autoware_utils</depend>
2021
<depend>tier4_control_msgs</depend>

system/system_error_monitor/src/system_error_monitor_core.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ int isInNoFaultCondition(
202202
}
203203
} // namespace
204204

205-
AutowareErrorMonitor::AutowareErrorMonitor()
205+
AutowareErrorMonitor::AutowareErrorMonitor(const rclcpp::NodeOptions & options)
206206
: Node(
207207
"system_error_monitor",
208-
rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true)),
208+
rclcpp::NodeOptions(options).automatically_declare_parameters_from_overrides(true)),
209209
diag_array_stamp_(0, 0, this->get_clock()->get_clock_type()),
210210
autoware_state_stamp_(0, 0, this->get_clock()->get_clock_type()),
211211
current_gate_mode_stamp_(0, 0, this->get_clock()->get_clock_type()),
@@ -720,3 +720,6 @@ void AutowareErrorMonitor::loggingErrors(
720720
logger_name, get_clock(), 5000, "[Single Point Fault]: " + hazard_diag.message);
721721
}
722722
}
723+
724+
#include <rclcpp_components/register_node_macro.hpp>
725+
RCLCPP_COMPONENTS_REGISTER_NODE(AutowareErrorMonitor)

system/system_error_monitor/src/system_error_monitor_node.cpp

-27
This file was deleted.

0 commit comments

Comments
 (0)