Skip to content

Commit

Permalink
Replace deprecated spin_until_future_complete with spin_until_complete
Browse files Browse the repository at this point in the history
Signed-off-by: Hubert Liberacki <[email protected]>
  • Loading branch information
hliberacki committed Mar 31, 2022
1 parent eeac508 commit 89c87b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions launch_testing_ros/test/examples/set_param_launch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@ def __init__(self, name='test_node'):
super().__init__(name)

def set_parameter(self, state=True, timeout=5.0):
parameters = [rclpy.Parameter('demo_parameter_1', value=state).to_parameter_msg()]
parameters = [rclpy.Parameter(
'demo_parameter_1', value=state).to_parameter_msg()]

client = self.create_client(SetParameters, 'demo_node_1/set_parameters')
client = self.create_client(
SetParameters, 'demo_node_1/set_parameters')
ready = client.wait_for_service(timeout_sec=timeout)
if not ready:
raise RuntimeError('Wait for service timed out')

request = SetParameters.Request()
request.parameters = parameters
future = client.call_async(request)
rclpy.spin_until_future_complete(self, future, timeout_sec=timeout)
rclpy.spin_until_complete(self, future, timeout_sec=timeout)

assert future.done(), 'Client request timed out'

Expand Down

0 comments on commit 89c87b8

Please sign in to comment.