Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canTransform does not suppress warning when called with error_msg #405

Open
msy22 opened this issue Apr 28, 2021 · 2 comments
Open

canTransform does not suppress warning when called with error_msg #405

msy22 opened this issue Apr 28, 2021 · 2 comments
Assignees

Comments

@msy22
Copy link

msy22 commented Apr 28, 2021

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • ROS2 Foxy, installed in Docker container osrf/ros:foxy-desktop from hub.docker.com
  • Version or commit hash:

I'm trying to find a work-around for the issue described in several Github issues, and addressed in issue #396, where calling canTransform directly or indirectly through lookupTransform results in an error message being spammed to the terminal.

In the process of looking for a way to suppress this output, I found this comment by tfoote in issue #358. The error is generated by function fillOrWarnMessageForInvalidFrame in buffer_core.cpp, and tfoote's comment suggests that calling canTransform with the error_msg parameter != nullptr will result in the function filling the error_msg string instead of generating the error message (i.e. the error message is no longer spammed to terminal and is instead handed to the caller to deal with). And if we look at the code for this:

if (error_msg != nullptr) {
  *error_msg = s;
} else {
  CONSOLE_BRIDGE_logWarn("%s", s.c_str());
}

unless I am missing something, this does seem to be how this code should work. But it doesn't. I still see the error (see below)

Steps to reproduce issue

std::string suppressed_error = "dummy_str";
if (buffer->canTransform(
    target_frame,
    source_frame,
    rclcpp::Time(0),
    frame_timeout,
    &suppressed_error))
{
    std::cout<< "Found " << target_frame << " -> " << source_frame << " transform" << std::endl;
}

Expected behavior

I expect the call to CONSOLE_BRIDGE_logWarn to not be printed because the error_msg is non-null. So I expect to just see this:

[tf_broadcaster_exe-1] Found base_link -> map transform

Actual behavior

Instead I see the same error message being spammed until the transform is found:

[tf_broadcaster_exe-1] Warning: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[tf_broadcaster_exe-1]          at line 133 in /tmp/binarydeb/ros-foxy-tf2-0.13.9/src/buffer_core.cpp
[tf_broadcaster_exe-1] Warning: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[tf_broadcaster_exe-1]          at line 133 in /tmp/binarydeb/ros-foxy-tf2-0.13.9/src/buffer_core.cpp
[tf_broadcaster_exe-1] Warning: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[tf_broadcaster_exe-1]          at line 133 in /tmp/binarydeb/ros-foxy-tf2-0.13.9/src/buffer_core.cpp
[tf_broadcaster_exe-1] Warning: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[tf_broadcaster_exe-1]          at line 133 in /tmp/binarydeb/ros-foxy-tf2-0.13.9/src/buffer_core.cpp
[tf_broadcaster_exe-1] Found base_link -> map transform

I'm sure this is a bug, but I haven't yet identified the cause.

@jlack1987
Copy link

I can report this is still an issue. A very annoying issue at that!

@jlack1987
Copy link

It looks like in the ros1 version of this stuff this was fixed here. If we could get this same fix here 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants