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

threading error spews a non-stop stream of messages via printf #92

Closed
mkhansenbot opened this issue Feb 9, 2019 · 5 comments
Closed
Labels
question Further information is requested

Comments

@mkhansenbot
Copy link

Bug report

Required Info:

  • Operating System:
    Ubuntu 18.04
  • Installation type:
    Source
  • Version or commit hash:
    ros2 branch, 0.10.1 tag
  • DDS implementation:
    Fast RTPS
  • Client library (if applicable):
    rclcpp

Steps to reproduce issue


Not sure how exactly to reproduce as I don't fully understand yet.

Expected behavior

Actual behavior

Getting this message spewed to the screen continuously:

Do not call canTransform or lookupTransform with a timeout unless you are using another thread for populating data. Without a dedicated thread it will always timeout.  If you have a seperate thread servicing tf messages, call setUsingDedicatedThread(true) on your Buffer instance.

Warning: Do not taunt happy fun ball! :)

Additional information

Looking at the code, I see that first off this is using ROS_ERROR to print, which is #defined as 'printf', with a TODO to fix it.

ROS_ERROR("%s", tf2_ros::threading_error.c_str());

//TODO(tfoote replace these terrible macros)
#define ROS_ERROR printf
#define ROS_FATAL printf
#define ROS_INFO printf
#define ROS_WARN printf

As for the message itself, what does it really mean? I'm not sure what is causing it exactly except that I get it here:

  node_handle_ = std::shared_ptr<::rclcpp::Node>(this, [](::rclcpp::Node *) {});

  constexpr double kTfBufferCacheTimeInSeconds = 10.;
  tf_broadcaster_.reset(new tf2_ros::TransformBroadcaster(node_handle_));
  tf_buffer_.reset(new tf2_ros::Buffer(get_clock(), tf2::durationFromSec(kTfBufferCacheTimeInSeconds)));
 tf_listener_.reset(new tf2_ros::TransformListener(*tf_buffer_));

When I change the last line to be this to re-use the existing node instead of creating a new one:

  tf_listener_.reset(new tf2_ros::TransformListener(*tf_buffer_, node_handle_, false))

Then I get this error.

I have to make this change, or I get an exception thrown by the logger due to duplicate node names.
ros2/rcl#375

Please let me know how to properly declare a TransformListener so that I don't get this error.

@mkhansenbot
Copy link
Author

Adding @crdelsey to add any additional info.

@tfoote
Copy link
Contributor

tfoote commented Feb 14, 2019

This is related to #89 that we don't have the ability to have custom callback queues. So the listener is starting it's own node to make sure that things are going to come in while it's blocking the callback thread. You can use the false constructor argument as long as you make sure that there's another executor with a thread that will be servicing incoming tf messages. And in that case you should tell the Buffer that you have another thread available using the setUsingDedicatedThread(true) method.

@cottsay
Copy link
Member

cottsay commented Feb 21, 2019

@mkhansen-intel, were you able to work around the errors using @tfoote's suggestions?

@cottsay cottsay added the question Further information is requested label Feb 21, 2019
@mkhansenbot
Copy link
Author

@cottsay - we were able to work around this in our stack, I'm no longer seeing this error.

However, it seems like an issue is still needed to fix the fact that printf is being used instead of the RCLCPP_ERROR logging function.

@mjcarroll
Copy link
Member

Thanks @mkhansen-intel, I captured the printf defect in #97, so I'll close this one.

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

No branches or pull requests

4 participants