From 79fd7f1e7268322fd59bbd046dfcc3ab14b88b2d Mon Sep 17 00:00:00 2001 From: Matej Petrlik Date: Thu, 2 Jan 2025 14:33:20 +0100 Subject: [PATCH] changed wall time to ros time for calculating of passthrough odom rate --- .../mrs_uav_state_estimators/estimators/state/passthrough.h | 2 +- src/estimators/state/passthrough.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mrs_uav_state_estimators/estimators/state/passthrough.h b/include/mrs_uav_state_estimators/estimators/state/passthrough.h index 9e8811e..91464bd 100644 --- a/include/mrs_uav_state_estimators/estimators/state/passthrough.h +++ b/include/mrs_uav_state_estimators/estimators/state/passthrough.h @@ -55,7 +55,7 @@ class Passthrough : public mrs_uav_managers::StateEstimator { ros::Timer timer_check_passthrough_odom_hz_; void timerCheckPassthroughOdomHz(const ros::TimerEvent &event); std::atomic counter_odom_msgs_ = 0; - ros::WallTime t_check_hz_last_; + ros::Time t_check_hz_last_; double prev_avg_hz_ = 0; bool kickoff_ = false; diff --git a/src/estimators/state/passthrough.cpp b/src/estimators/state/passthrough.cpp index 8f81784..b1e1f56 100644 --- a/src/estimators/state/passthrough.cpp +++ b/src/estimators/state/passthrough.cpp @@ -49,7 +49,7 @@ void Passthrough::initialize(ros::NodeHandle &parent_nh, const std::shared_ptr(shopts, msg_topic_, &Passthrough::callbackPassthroughOdom, this); // | ------------------ timers initialization ----------------- | - t_check_hz_last_ = ros::WallTime::now(); + t_check_hz_last_ = ros::Time::now(); prev_avg_hz_ = 0; timer_check_passthrough_odom_hz_ = nh.createTimer(ros::Rate(1.0), &Passthrough::timerCheckPassthroughOdomHz, this); @@ -156,7 +156,7 @@ void Passthrough::timerCheckPassthroughOdomHz([[maybe_unused]] const ros::TimerE // calculate average rate of messages if (counter_odom_msgs_ > 0) { - ros::WallTime t_now = ros::WallTime::now(); + ros::Time t_now = ros::Time::now(); double dt = (t_now - t_check_hz_last_).toSec(); double avg_hz = counter_odom_msgs_ / dt; t_check_hz_last_ = t_now;