`waitForTransform()` doesn't respect timeout when `get()` is called on the returned future
@clalancette is already working on this.
Since Dec 3, 2020.
- Dominant language
- C++
- Stars
- 153
- Forks
- 256
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 14
Description
Bug report
Required Info:
- Operating System: Ubuntu 20.04
- Installation type: Binaries
- Version or commit hash: Foxy
- DDS implementation: rmw_cyclonedds_cpp
- Client library (if applicable): rclcpp
Steps to reproduce issue
I made a simple test package with one node that sends two transforms and one node that requests a transform that can be interpolated from those two.
git clone git@github.com:nnmm/tf2_example.git
cd tf2_example
git checkout 5b837b82b15555f1cd5f35df3987b8e95c172e19 # for reproducibility in case the main branch changes
colcon build
source install/setup.bash
ros2 launch wait_for_transform wait_for_transform.launch.xml \
executor:=single \
method:=wft_get \
request_time:=current \
send_first_tf:=after \
send_second_tf:=after
It doesn't matter whether the first transform is sent before, during or after the waiting period.
The code that makes the request request looks essentially like this (wft_get method in receiver.cpp):
auto future = tf_buffer_.waitForTransform("a", "b", request_time_, timeout_, callback_);
const auto lu_time = tf2_ros::fromMsg(future.get().header.stamp);
// some log message indicating either success or an exception being caught
Expected behavior
Calling get() on the future blocks only for the specified timeout duration, after which it will throw an exception (or indicate failure some other way) if the requested transforms have not arrived yet.
Actual behavior
get() blocks indefinitely and only returns when the requested transforms arrive, no matter whether that is before or after the timeout expires. The timeout is 5s, but it waits longer than that.
Additional information
I haven't done much with futures before, but this seems like the way it should work (only guessing since there is no documentation).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.