Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Fix buffer_client.py using default timeout_padding (ros#437)
Browse files Browse the repository at this point in the history
* Fix buffer_client.py using default timeout_padding

fixes ros#436

Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
charlielito and clalancette authored Jul 8, 2021
1 parent c36999b commit 141e3cb
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tf2_ros_py/tf2_ros/buffer_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ def __init__(
timeout_padding: Duration = Duration(seconds=2.0)
) -> None:
"""
.. function:: __init__(ns, check_frequency = 10.0, timeout_padding = rospy.Duration.from_sec(2.0))
Constructor.
Constructor.
:param node: The ROS2 node.
:param ns: The namespace in which to look for a BufferServer.
:param check_frequency: How frequently to check for updates to known transforms.
:param timeout_padding: A constant timeout to add to blocking calls.
:param node: The ROS2 node.
:param ns: The namespace in which to look for a BufferServer.
:param check_frequency: How frequently to check for updates to known transforms.
:param timeout_padding: A constant timeout to add to blocking calls.
"""
tf2_ros.BufferInterface.__init__(self)
self.node = node
Expand Down Expand Up @@ -226,7 +224,7 @@ def unblock_by_timeout():
clock = Clock()
start_time = clock.now()
timeout = Duration.from_msg(goal.timeout)
timeout_padding = Duration(seconds=self.timeout_padding)
timeout_padding = self.timeout_padding
while not send_goal_future.done() and not event.is_set():
if clock.now() > start_time + timeout + timeout_padding:
break
Expand All @@ -243,7 +241,7 @@ def unblock_by_timeout():

event.wait()

#This shouldn't happen, but could in rare cases where the server hangs
# This shouldn't happen, but could in rare cases where the server hangs
if not send_goal_future.done():
raise tf2.TimeoutException("The LookupTransform goal sent to the BufferServer did not come back in the specified time. Something is likely wrong with the server.")

Expand Down

0 comments on commit 141e3cb

Please sign in to comment.