31
31
# POSSIBILITY OF SUCH DAMAGE.
32
32
33
33
"""
34
- Python client API for dynamic_reconfigure (L{DynamicReconfigureClient}) as well as
34
+ Python client API for dynamic_reconfigure (L{DynamicReconfigureClient}) as well as
35
35
example server implementation (L{DynamicReconfigureServer}).
36
36
"""
37
37
42
42
except :
43
43
pass
44
44
import rospy
45
- import rosservice
45
+ import rosservice
46
46
import sys
47
47
import threading
48
48
import time
@@ -63,7 +63,7 @@ class Client(object):
63
63
def __init__ (self , name , timeout = None , config_callback = None , description_callback = None ):
64
64
"""
65
65
Connect to dynamic_reconfigure server and return a client object
66
-
66
+
67
67
@param name: name of the server to connect to (usually the node name)
68
68
@type name: str
69
69
@param timeout: time to wait before giving up
@@ -75,15 +75,15 @@ def __init__(self, name, timeout=None, config_callback=None, description_callbac
75
75
self .config = None
76
76
self .param_description = None
77
77
self .group_description = None
78
-
78
+
79
79
self ._param_types = None
80
80
81
81
self ._cv = threading .Condition ()
82
82
83
83
self ._config_callback = config_callback
84
84
self ._description_callback = description_callback
85
85
86
- self ._set_service = self ._get_service_proxy ('set_parameters' , timeout )
86
+ self ._set_service = self ._get_service_proxy ('set_parameters' , timeout )
87
87
self ._descriptions_sub = self ._get_subscriber ('parameter_descriptions' , ConfigDescrMsg , self ._descriptions_msg )
88
88
self ._updates_sub = self ._get_subscriber ('parameter_updates' , ConfigMsg , self ._updates_msg )
89
89
@@ -100,7 +100,7 @@ def get_configuration(self, timeout=None):
100
100
if timeout is None or timeout == 0.0 :
101
101
if self .get_configuration (timeout = 1.0 ) is None :
102
102
print >> sys .stderr , 'Waiting for configuration...'
103
-
103
+
104
104
with self ._cv :
105
105
while self .config is None :
106
106
if rospy .is_shutdown ():
@@ -123,7 +123,7 @@ def get_parameter_descriptions(self, timeout=None):
123
123
"""
124
124
UNSTABLE. Return a description of the parameters for the server.
125
125
Do not use this method as the type that is returned may change.
126
-
126
+
127
127
@param timeout: time to wait before giving up
128
128
@type timeout: float
129
129
"""
@@ -184,7 +184,7 @@ def update_configuration(self, changes):
184
184
dest_type = self ._param_types .get (name )
185
185
if dest_type is None :
186
186
raise DynamicReconfigureParameterException ('don\' t know parameter: %s' % name )
187
-
187
+
188
188
try :
189
189
found = False
190
190
descr = [x for x in self .param_description if x ['name' ].lower () == name .lower ()][0 ]
@@ -237,7 +237,7 @@ def update_groups(self, changes):
237
237
@param changes: dictionary of key value pairs for the parameters that are changing
238
238
@type changes: {str: value}
239
239
"""
240
-
240
+
241
241
descr = self .get_group_descriptions ()
242
242
243
243
groups = []
@@ -248,7 +248,7 @@ def update_state(group, description):
248
248
else :
249
249
update_state (group , g )
250
250
return description
251
-
251
+
252
252
for change in changes :
253
253
descr = update_state (change , descr )
254
254
@@ -279,7 +279,7 @@ def set_config_callback(self, value):
279
279
280
280
config_callback = property (get_config_callback , set_config_callback )
281
281
282
- ## description_callback
282
+ ## description_callback
283
283
284
284
def get_description_callback (self ):
285
285
"""
@@ -315,14 +315,14 @@ def _get_service_proxy(self, suffix, timeout):
315
315
316
316
def _get_subscriber (self , suffix , type , callback ):
317
317
topic_name = rospy .resolve_name (self .name + '/' + suffix )
318
-
318
+
319
319
return rospy .Subscriber (topic_name , type , callback = callback )
320
320
321
321
def _updates_msg (self , msg ):
322
322
if self .group_description is None :
323
323
self .get_group_descriptions ()
324
324
self .config = decode_config (msg , self .group_description )
325
-
325
+
326
326
with self ._cv :
327
327
self ._cv .notifyAll ()
328
328
if self ._config_callback is not None :
0 commit comments