Skip to content

Commit

Permalink
fix(pose_instability_detector): empty check order (#1561)
Browse files Browse the repository at this point in the history
  • Loading branch information
yn-mrse authored Oct 1, 2024
1 parent 4bcb436 commit bd48d6d
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 bd48d6d

Please sign in to comment.