@@ -42,7 +42,9 @@ def get_value(*, parameter_value):
4242
4343def load_parameter_file (* , node , node_name , parameter_file , use_wildcard ):
4444 client = AsyncParameterClient (node , node_name )
45- client .wait_for_services (timeout_sec = 5.0 )
45+ ready = client .wait_for_services (timeout_sec = 5.0 )
46+ if not ready :
47+ raise RuntimeError ('Wait for service timed out' )
4648 future = client .load_parameter_file (parameter_file , use_wildcard )
4749 parameters = list (parameter_dict_from_yaml_file (parameter_file , use_wildcard ).values ())
4850 rclpy .spin_until_future_complete (node , future )
@@ -65,7 +67,9 @@ def load_parameter_file(*, node, node_name, parameter_file, use_wildcard):
6567
6668def call_describe_parameters (* , node , node_name , parameter_names = None ):
6769 client = AsyncParameterClient (node , node_name )
68- client .wait_for_services (timeout_sec = 5.0 )
70+ ready = client .wait_for_services (timeout_sec = 5.0 )
71+ if not ready :
72+ raise RuntimeError ('Wait for service timed out' )
6973 future = client .describe_parameters (parameter_names )
7074 rclpy .spin_until_future_complete (node , future )
7175 response = future .result ()
@@ -77,7 +81,9 @@ def call_describe_parameters(*, node, node_name, parameter_names=None):
7781
7882def call_get_parameters (* , node , node_name , parameter_names ):
7983 client = AsyncParameterClient (node , node_name )
80- client .wait_for_services (timeout_sec = 5.0 )
84+ ready = client .wait_for_services (timeout_sec = 5.0 )
85+ if not ready :
86+ raise RuntimeError ('Wait for service timed out' )
8187 future = client .get_parameters (parameter_names )
8288 rclpy .spin_until_future_complete (node , future )
8389 response = future .result ()
@@ -89,7 +95,9 @@ def call_get_parameters(*, node, node_name, parameter_names):
8995
9096def call_set_parameters (* , node , node_name , parameters ):
9197 client = AsyncParameterClient (node , node_name )
92- client .wait_for_services (timeout_sec = 5.0 )
98+ ready = client .wait_for_services (timeout_sec = 5.0 )
99+ if not ready :
100+ raise RuntimeError ('Wait for service timed out' )
93101 future = client .set_parameters (parameters )
94102 rclpy .spin_until_future_complete (node , future )
95103 response = future .result ()
@@ -101,7 +109,9 @@ def call_set_parameters(*, node, node_name, parameters):
101109
102110def call_list_parameters (* , node , node_name , prefixes = None ):
103111 client = AsyncParameterClient (node , node_name )
104- client .wait_for_services (timeout_sec = 5.0 )
112+ ready = client .wait_for_services (timeout_sec = 5.0 )
113+ if not ready :
114+ raise RuntimeError ('Wait for service timed out' )
105115 future = client .list_parameters (prefixes = prefixes )
106116 rclpy .spin_until_future_complete (node , future )
107117 response = future .result ()
0 commit comments