Skip to content

Commit bd48d6d

Browse files
authored
fix(pose_instability_detector): empty check order (#1561)
1 parent 4bcb436 commit bd48d6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

localization/pose_instability_detector/src/pose_instability_detector.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ void PoseInstabilityDetector::callback_odometry(Odometry::ConstSharedPtr odometr
8888
}
8989

9090
// If twist_buffer_ is empty OR the latest twist is too old, skip the following.
91+
if (twist_buffer_.empty()) {
92+
return;
93+
}
9194
double latest_twist_age =
9295
(current_pose_time - rclcpp::Time(twist_buffer_.back().header.stamp)).seconds();
93-
if (twist_buffer_.empty() || latest_twist_age > window_length_ * 1.5) {
96+
if (latest_twist_age > window_length_ * 1.5) {
9497
return;
9598
}
9699

0 commit comments

Comments
 (0)