Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/urg_node2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ void UrgNode2::scan_thread()
RCLCPP_WARN(get_logger(), "Could not get multi echo scan.");
error_count_++;
total_error_count_++;
prev_time = system_clock.now();
device_status_ = urg_sensor_status(&urg_);
sensor_status_ = urg_sensor_state(&urg_);
is_stable_ = urg_is_stable(&urg_);
Expand All @@ -499,6 +500,7 @@ void UrgNode2::scan_thread()
RCLCPP_WARN(get_logger(), "Could not get single echo scan.");
error_count_++;
total_error_count_++;
prev_time = system_clock.now();
device_status_ = urg_sensor_status(&urg_);
sensor_status_ = urg_sensor_state(&urg_);
is_stable_ = urg_is_stable(&urg_);
Expand All @@ -514,10 +516,8 @@ void UrgNode2::scan_thread()
break;
} else {
// エラーカウントのリセット
rclcpp::Time current_time = system_clock.now();
rclcpp::Duration period = current_time - prev_time;
rclcpp::Duration period = system_clock.now() - prev_time;
if (period.seconds() >= error_reset_period_) {
prev_time = current_time;
error_count_ = 0;
}
}
Expand Down