From c5f5bf74792cb4b0bd6ca230b32fe56d9ba827e2 Mon Sep 17 00:00:00 2001 From: Lucas Walter Date: Wed, 3 Nov 2021 07:32:59 -0700 Subject: [PATCH] Restore time difference order so future extrapolation exceptions don't show non-sensical negative seconds into the future --- tf2/src/cache.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tf2/src/cache.cpp b/tf2/src/cache.cpp index f9614c792..c58dd4e36 100644 --- a/tf2/src/cache.cpp +++ b/tf2/src/cache.cpp @@ -76,7 +76,9 @@ void createExtrapolationException2(ros::Time t0, ros::Time t1, std::string* erro { if (error_str) { - ros::Duration tdiff = t1 - t0; + // Want this to come out positive, because this is a future extrapolation problem with t0 + // t0 needs to come first because it will be bigger than t1 + ros::Duration tdiff = t0 - t1; char str[163]; // Text without formatting strings has 102, each timestamp has up to 20 snprintf( str, sizeof(str),