Skip to content

Commit 08a64be

Browse files
committed
implement safe fault handling for hazard status converter
1 parent 72c0271 commit 08a64be

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

launch/tier4_system_launch/launch/system.launch.xml

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<arg name="launch_rqt_robot_monitor" default="false"/>
4040
<arg name="launch_rqt_runtime_monitor_err" default="false"/>
4141

42+
<!-- Hazard Status Converter -->
43+
<arg name="report_only_diag" default="false"/>
44+
<arg name="report_safe_fault" default="false"/>
45+
4246
<group>
4347
<push-ros-namespace namespace="/system"/>
4448

@@ -120,7 +124,10 @@
120124

121125
<!-- Hazard Status Converter -->
122126
<group unless="$(var use_emergency_handler)">
123-
<include file="$(find-pkg-share hazard_status_converter)/launch/hazard_status_converter.launch.xml"/>
127+
<include file="$(find-pkg-share hazard_status_converter)/launch/hazard_status_converter.launch.xml">
128+
<arg name="report_only_diag" value="$(var report_only_diag)"/>
129+
<arg name="report_safe_fault" value="$(var report_safe_fault)"/>
130+
</include>
124131
</group>
125132

126133
<!-- MRM Handler -->
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<launch>
2+
<arg name="report_only_diag" default="false"/>
3+
<arg name="report_safe_fault" default="false"/>
24
<node pkg="hazard_status_converter" exec="converter" name="hazard_status_converter">
35
<remap from="~/diagnostics_graph" to="/diagnostics_graph"/>
46
<remap from="~/hazard_status" to="/system/emergency/hazard_status"/>
7+
<param name="report_only_diag" value="$(var report_only_diag)"/>
8+
<param name="report_safe_fault" value="$(var report_safe_fault)"/>
59
</node>
610
</launch>

system/hazard_status_converter/src/converter.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Converter::Converter(const rclcpp::NodeOptions & options) : Node("converter", op
2727
sub_graph_.register_create_callback(std::bind(&Converter::on_create, this, _1));
2828
sub_graph_.register_update_callback(std::bind(&Converter::on_update, this, _1));
2929
sub_graph_.subscribe(*this, 1);
30+
31+
report_only_diag_ = declare_parameter<bool>("report_only_diag", false);
32+
report_safe_fault_ = declare_parameter<bool>("report_safe_fault", false);
3033
}
3134

3235
void Converter::on_create(DiagGraph::ConstSharedPtr graph)
@@ -107,6 +110,7 @@ void Converter::on_update(DiagGraph::ConstSharedPtr graph)
107110
HazardStatusStamped hazard;
108111
for (const auto & unit : graph->units()) {
109112
if (unit->path().empty()) continue;
113+
if (report_only_diag_ && unit->type() != "diag") continue;
110114
const bool is_auto_tree = auto_mode_tree_.count(unit);
111115
const auto root_level = is_auto_tree ? auto_mode_root_->level() : DiagnosticStatus::OK;
112116
const auto unit_level = unit->level();
@@ -117,6 +121,8 @@ void Converter::on_update(DiagGraph::ConstSharedPtr graph)
117121
hazard.stamp = graph->updated_stamp();
118122
hazard.status.level = get_system_level(hazard.status);
119123
hazard.status.emergency = hazard.status.level == HazardStatus::SINGLE_POINT_FAULT;
124+
if (report_safe_fault_)
125+
hazard.status.emergency &= hazard.status.level == HazardStatus::SAFE_FAULT;
120126
hazard.status.emergency_holding = false;
121127
pub_hazard_->publish(hazard);
122128
}

system/hazard_status_converter/src/converter.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class Converter : public rclcpp::Node
4141

4242
DiagUnit * auto_mode_root_;
4343
std::unordered_set<DiagUnit *> auto_mode_tree_;
44+
bool report_only_diag_;
45+
bool report_safe_fault_;
4446
};
4547

4648
} // namespace hazard_status_converter

0 commit comments

Comments
 (0)