Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ros1]Correct of uninitialized buffer size in angular_velocity_offset_stop #325

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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