From 3b932f97370b0f6b5ab1afc60f00e20a6850957f Mon Sep 17 00:00:00 2001 From: Ryohei Sasaki Date: Fri, 29 Mar 2024 09:50:00 +0900 Subject: [PATCH] Correct of uninitialized buffer size --- .../include/navigation/angular_velocity_offset_stop.hpp | 1 - .../navigation/src/angular_velocity_offset_stop.cpp | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/eagleye_core/navigation/include/navigation/angular_velocity_offset_stop.hpp b/eagleye_core/navigation/include/navigation/angular_velocity_offset_stop.hpp index e6a9f16d..97775260 100644 --- a/eagleye_core/navigation/include/navigation/angular_velocity_offset_stop.hpp +++ b/eagleye_core/navigation/include/navigation/angular_velocity_offset_stop.hpp @@ -86,7 +86,6 @@ class AngularVelocityOffsetStopEstimator // Angular velocity Eigen::Vector3d estimated_offset_stop_; std::deque angular_velocity_buffer_; - size_t buffer_size_; double angular_stop_judgement_threshold_; // Velocity diff --git a/eagleye_core/navigation/src/angular_velocity_offset_stop.cpp b/eagleye_core/navigation/src/angular_velocity_offset_stop.cpp index c6b9b5f8..464d3aa6 100755 --- a/eagleye_core/navigation/src/angular_velocity_offset_stop.cpp +++ b/eagleye_core/navigation/src/angular_velocity_offset_stop.cpp @@ -77,16 +77,16 @@ AngularVelocityOffsetStopStatus AngularVelocityOffsetStopEstimator::imuCallback( angular_velocity_buffer_.push_back(angular_velocity); // Remove element if buffer size is exceeded - if (angular_velocity_buffer_.size() > buffer_size_) + if (angular_velocity_buffer_.size() > param_.buffer_size) { angular_velocity_buffer_.pop_front(); } // Estimate offset stop if buffer is full - if (angular_velocity_buffer_.size() == buffer_size_) + if (angular_velocity_buffer_.size() == param_.buffer_size) { Eigen::Vector3d sum = std::accumulate(angular_velocity_buffer_.begin(), angular_velocity_buffer_.end(), Eigen::Vector3d(0.0, 0.0, 0.0)); - estimated_offset_stop_ = - sum / static_cast(buffer_size_); + estimated_offset_stop_ = - sum / static_cast(param_.buffer_size); is_estimation_started_ = true; status.is_estimated_now = true; }