Skip to content

Commit

Permalink
fix(pose_instability_detector): empty check order
Browse files Browse the repository at this point in the history
  • Loading branch information
yn-mrse authored Sep 27, 2024
1 parent 8d261d7 commit a007188
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ void PoseInstabilityDetector::callback_odometry(Odometry::ConstSharedPtr odometr
}

// If twist_buffer_ is empty OR the latest twist is too old, skip the following.
if (twist_buffer_.empty()) {
return;
}
double latest_twist_age =
(current_pose_time - rclcpp::Time(twist_buffer_.back().header.stamp)).seconds();
if (twist_buffer_.empty() || latest_twist_age > window_length_ * 1.5) {
if (latest_twist_age > window_length_ * 1.5) {
return;
}

Expand Down

0 comments on commit a007188

Please sign in to comment.