diff --git a/controller_manager/controller_manager/hardware_spawner.py b/controller_manager/controller_manager/hardware_spawner.py index c95fb6181e..13c004082e 100644 --- a/controller_manager/controller_manager/hardware_spawner.py +++ b/controller_manager/controller_manager/hardware_spawner.py @@ -45,7 +45,8 @@ def first_match(iterable, predicate): def wait_for_value_or(function, node, timeout, default, description): while node.get_clock().now() < timeout: - if result := function(): + result = function() + if result: return result node.get_logger().info( f"Waiting for {description}", throttle_duration_sec=2, skip_first=True diff --git a/controller_manager/controller_manager/spawner.py b/controller_manager/controller_manager/spawner.py index 536162612e..44c31ef001 100644 --- a/controller_manager/controller_manager/spawner.py +++ b/controller_manager/controller_manager/spawner.py @@ -52,7 +52,8 @@ def first_match(iterable, predicate): def wait_for_value_or(function, node, timeout, default, description): while node.get_clock().now() < timeout: - if result := function(): + result = function() + if result: return result node.get_logger().info( f'Waiting for {description}',