@@ -232,15 +232,6 @@ AutowareErrorMonitor::AutowareErrorMonitor(const rclcpp::NodeOptions & options)
232
232
// Subscriber
233
233
sub_diag_array_ = create_subscription<diagnostic_msgs::msg::DiagnosticArray>(
234
234
" input/diag_array" , rclcpp::QoS{1 }, std::bind (&AutowareErrorMonitor::onDiagArray, this , _1));
235
- sub_current_gate_mode_ = create_subscription<tier4_control_msgs::msg::GateMode>(
236
- " ~/input/current_gate_mode" , rclcpp::QoS{1 },
237
- std::bind (&AutowareErrorMonitor::onCurrentGateMode, this , _1));
238
- sub_autoware_state_ = create_subscription<autoware_system_msgs::msg::AutowareState>(
239
- " ~/input/autoware_state" , rclcpp::QoS{1 },
240
- std::bind (&AutowareErrorMonitor::onAutowareState, this , _1));
241
- sub_control_mode_ = create_subscription<autoware_vehicle_msgs::msg::ControlModeReport>(
242
- " ~/input/control_mode" , rclcpp::QoS{1 },
243
- std::bind (&AutowareErrorMonitor::onControlMode, this , _1));
244
235
245
236
// Publisher
246
237
pub_hazard_status_ = create_publisher<autoware_system_msgs::msg::HazardStatusStamped>(
@@ -440,6 +431,31 @@ bool AutowareErrorMonitor::isDataHeartbeatTimeout()
440
431
441
432
void AutowareErrorMonitor::onTimer ()
442
433
{
434
+ const auto autoware_state_msg = sub_autoware_state_.takeData ();
435
+ const auto current_gate_msg = sub_current_gate_mode_.takeData ();
436
+ const auto control_mode_msg = sub_control_mode_.takeData ();
437
+
438
+ if (autoware_state_msg) {
439
+ autoware_state_ = autoware_state_msg;
440
+ // for Heartbeat
441
+ autoware_state_stamp_ = this ->now ();
442
+ }
443
+
444
+ if (current_gate_msg) {
445
+ current_gate_mode_ = current_gate_msg;
446
+ // for Heartbeat
447
+ current_gate_mode_stamp_ = this ->now ();
448
+ }
449
+
450
+ if (control_mode_msg) {
451
+ control_mode_ = control_mode_msg;
452
+ // for Heartbeat
453
+ control_mode_stamp_ = this ->now ();
454
+ }
455
+
456
+
457
+ // for Heartbeat
458
+ current_gate_mode_stamp_ = this ->now ();
443
459
if (!isDataReady ()) {
444
460
if ((this ->now () - initialized_time_).seconds () > params_.data_ready_timeout ) {
445
461
RCLCPP_WARN_THROTTLE (
0 commit comments