diff --git a/tf2/src/buffer_core.cpp b/tf2/src/buffer_core.cpp index c9bcb07d4..9df5daee5 100644 --- a/tf2/src/buffer_core.cpp +++ b/tf2/src/buffer_core.cpp @@ -358,7 +358,7 @@ int BufferCore::walkToTopParent(F& f, ros::Time time, CompactFrameID target_id, break; } - CompactFrameID parent = f.gather(cache, time, &extrapolation_error_string); + CompactFrameID parent = f.gather(cache, time, error_string ? &extrapolation_error_string : NULL); if (parent == 0) { // Just break out here... there may still be a path from source -> target diff --git a/tf2/test/speed_test.cpp b/tf2/test/speed_test.cpp index c63ca18c7..c7987fa96 100644 --- a/tf2/test/speed_test.cpp +++ b/tf2/test/speed_test.cpp @@ -222,4 +222,31 @@ int main(int argc, char** argv) CONSOLE_BRIDGE_logInform("canTransform at Time(2) took %f for an average of %.9f", dur.toSec(), dur.toSec() / (double)count); } #endif + +#if 01 + { + ros::WallTime start = ros::WallTime::now(); + for (uint32_t i = 0; i < count; ++i) + { + bc.canTransform(v_frame1, v_frame0, ros::Time(3)); + } + ros::WallTime end = ros::WallTime::now(); + ros::WallDuration dur = end - start; + CONSOLE_BRIDGE_logInform("canTransform at Time(3) without error string took %f for an average of %.9f", dur.toSec(), dur.toSec() / (double)count); + } +#endif + +#if 01 + { + ros::WallTime start = ros::WallTime::now(); + std::string str; + for (uint32_t i = 0; i < count; ++i) + { + bc.canTransform(v_frame1, v_frame0, ros::Time(3), &str); + } + ros::WallTime end = ros::WallTime::now(); + ros::WallDuration dur = end - start; + CONSOLE_BRIDGE_logInform("canTransform at Time(3) with error string took %f for an average of %.9f", dur.toSec(), dur.toSec() / (double)count); + } +#endif }