Skip to content

Commit 139725c

Browse files
authored
Add timeouts to all spin_until_future_complete calls (ros-navigation#1998)
* Add timeouts to all spin_until_future_complete calls Signed-off-by: Sarthak Mittal <[email protected]> * Update default timeout value Signed-off-by: Sarthak Mittal <[email protected]>
1 parent 9e7c427 commit 139725c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nav2_bringup/nav2_gazebo_spawner/nav2_gazebo_spawner/nav2_gazebo_spawner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def main():
3636
help='the y component of the initial position [meters]')
3737
parser.add_argument('-z', type=float, default=0,
3838
help='the z component of the initial position [meters]')
39+
parser.add_argument('-k', '--timeout', type=float, default=10.0,
40+
help="Seconds to wait. Block until the future is complete if negative. Don't wait if 0.")
3941

4042
group = parser.add_mutually_exclusive_group(required=True)
4143
group.add_argument('-t', '--turtlebot_type', type=str,
@@ -97,7 +99,7 @@ def main():
9799

98100
node.get_logger().info('Sending service request to `/spawn_entity`')
99101
future = client.call_async(request)
100-
rclpy.spin_until_future_complete(node, future)
102+
rclpy.spin_until_future_complete(node, future, args.timeout)
101103
if future.result() is not None:
102104
print('response: %r' % future.result())
103105
else:

0 commit comments

Comments
 (0)