From f63c7ae2f3cc78a76e4c86cbd8b5609579973cf0 Mon Sep 17 00:00:00 2001 From: Lucas Wendland <82680922+CursedRock17@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:51:56 -0400 Subject: [PATCH] Warning Message Intervals for canTransform (#663) Signed-off-by: CursedRock17 --- tf2/include/tf2/buffer_core.h | 2 +- tf2/src/buffer_core.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tf2/include/tf2/buffer_core.h b/tf2/include/tf2/buffer_core.h index 6d75127da..cb6f78c44 100644 --- a/tf2/include/tf2/buffer_core.h +++ b/tf2/include/tf2/buffer_core.h @@ -46,11 +46,11 @@ #include "LinearMath/Transform.h" #include "geometry_msgs/msg/transform_stamped.hpp" +#include "rcutils/logging_macros.h" #include "tf2/buffer_core_interface.h" #include "tf2/exceptions.h" #include "tf2/transform_storage.h" #include "tf2/visibility_control.h" -#include "rcutils/logging_macros.h" namespace tf2 { diff --git a/tf2/src/buffer_core.cpp b/tf2/src/buffer_core.cpp index 4c270800e..3da2b2d48 100644 --- a/tf2/src/buffer_core.cpp +++ b/tf2/src/buffer_core.cpp @@ -89,7 +89,10 @@ void fillOrWarnMessageForInvalidFrame( if (error_msg != nullptr) { *error_msg = s; } else { - RCUTILS_LOG_WARN("%s", s.c_str()); + static constexpr std::chrono::milliseconds warning_interval = + std::chrono::milliseconds(2500); + + RCUTILS_LOG_WARN_THROTTLE(RCUTILS_STEADY_TIME, warning_interval.count(), "%s", s.c_str()); } }