Skip to content

Commit

Permalink
Removed ekf_rate_ in ekf_localizer.cpp/hpp
Browse files Browse the repository at this point in the history
Signed-off-by: TaikiYamada4 <[email protected]>
  • Loading branch information
TaikiYamada4 committed Nov 7, 2023
1 parent 15c5f8a commit 0ad3c9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ class EKFLocalizer : public rclcpp::Node

const HyperParameters params_;

double ekf_rate_;
double ekf_dt_;

bool is_activated_;
Expand Down
6 changes: 2 additions & 4 deletions localization/ekf_localizer/src/ekf_localizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ EKFLocalizer::EKFLocalizer(const std::string & node_name, const rclcpp::NodeOpti
: rclcpp::Node(node_name, node_options),
warning_(std::make_shared<Warning>(this)),
params_(this),
ekf_rate_(params_.ekf_rate),
ekf_dt_(params_.ekf_dt),
pose_queue_(params_.pose_smoothing_steps),
twist_queue_(params_.twist_smoothing_steps)
Expand Down Expand Up @@ -104,9 +103,8 @@ void EKFLocalizer::updatePredictFrequency()
if (get_clock()->now() < *last_predict_time_) {
warning_->warn("Detected jump back in time");
} else {
ekf_rate_ = 1.0 / (get_clock()->now() - *last_predict_time_).seconds();
DEBUG_INFO(get_logger(), "[EKF] update ekf_rate_ to %f hz", ekf_rate_);
ekf_dt_ = 1.0 / std::max(ekf_rate_, 0.1);
ekf_dt_ = std::min((get_clock()->now() - *last_predict_time_).seconds(), 10.0);
DEBUG_INFO(get_logger(), "[EKF] update ekf_rate_ to %f hz", 1 / ekf_dt_);
}
}
last_predict_time_ = std::make_shared<const rclcpp::Time>(get_clock()->now());
Expand Down

0 comments on commit 0ad3c9f

Please sign in to comment.