Skip to content

Commit

Permalink
Correct of uninitialized buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryohei Sasaki committed Mar 29, 2024
1 parent c2fbdd3 commit 3b932f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class AngularVelocityOffsetStopEstimator
// Angular velocity
Eigen::Vector3d estimated_offset_stop_;
std::deque<Eigen::Vector3d> angular_velocity_buffer_;
size_t buffer_size_;
double angular_stop_judgement_threshold_;

// Velocity
Expand Down
6 changes: 3 additions & 3 deletions eagleye_core/navigation/src/angular_velocity_offset_stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(buffer_size_);
estimated_offset_stop_ = - sum / static_cast<double>(param_.buffer_size);
is_estimation_started_ = true;
status.is_estimated_now = true;
}
Expand Down

0 comments on commit 3b932f9

Please sign in to comment.