You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use ros-kinetic-dynamic-reconfigure 1.5.49-0xenial-20180316-113241-0800.
And occasionally rosrun dynamic_reconfigure dynparam load command reports error updating parameters: don't know parameter xxx. After spent some time to investigate the symptom, I think race condition exits in src/dynamic_reconfigure/client.py
168defupdate_configuration(self, changes):
169"""170 Change the server's configuration171 172 @param changes: dictionary of key value pairs for the parameters that are changing173 @type changes: {str: value}174 """175# Retrieve the parameter descriptions176ifself.param_descriptionisNone:
177self.get_parameter_descriptions()
178179# Cast the parameters to the appropriate types180ifself.param_descriptionisnotNone:
181forname, valueinlist(changes.items())[:]:
182ifname!='groups':
183dest_type=self._param_types.get(name)
184ifdest_typeisNone:
185raiseDynamicReconfigureParameterException('don\'t know parameter: %s'%name)
Line 185 "error updating parameters: don't know parameter xxx” is reported because the parameter xxx is not exist in map self._param_types.
From below code excerpt, we can see self._param_types is initialized after line 338 after self.param_description is extracted in line
331.329def_descriptions_msg(self, msg):
330self.group_description=decode_description(msg)
331self.param_description=extract_params(self.group_description)
332333# Build map from parameter name to type334self._param_types= {}
335forpinself.param_description:
336n, t=p.get('name'), p.get('type')
337ifnisnotNoneandtisnotNone:
338self._param_types[n] =self._param_type_from_string(t) <<---------339340withself._cv:
341self._cv.notifyAll()
342ifself._description_callbackisnotNone:
343self._description_callback(self.param_description)
Function get_parameter_descriptions will return after self.param_description is NOT None
121defget_parameter_descriptions(self, timeout=None):
122"""123 UNSTABLE. Return a description of the parameters for the server.124 Do not use this method as the type that is returned may change.125 126 @param timeout: time to wait before giving up127 @type timeout: float128 """129iftimeoutisNoneortimeout==0.0:
130withself._cv:
131whileself.param_descriptionisNone:
132ifrospy.is_shutdown():
133returnNone134self._cv.wait()
135else:
136start_time=time.time()
137withself._cv:
138whileself.param_descriptionisNone:
139ifrospy.is_shutdown():
140returnNone141secs_left=timeout- (time.time() -start_time)
142ifsecs_left<=0.0:
143break144self._cv.wait(secs_left)
145146returnself.param_description
But self.param_description is NOT None doesn’t mean self._param_types is successfully initialized, if thread 1 is executing Line 333 ~338, some parameters maybe not set.
333# Build map from parameter name to type334self._param_types= {}
335forpinself.param_description:
336n, t=p.get('name'), p.get('type')
337ifnisnotNoneandtisnotNone:
338self._param_types[n] =self._param_type_from_string(t)
Could we fix it by add self._param_types_inited to indicate whether self._param_types is already initialized
@@ -76,6 +76,7 @@
self.group_description = None
self._param_types = None
+ self._param_types_inited = False
self._cv = threading.Condition()
@@ -128,14 +129,14 @@
"""
if timeout is None or timeout == 0.0:
with self._cv:
- while self.param_description is None:+ while self._param_types_inited is False:
if rospy.is_shutdown():
return None
self._cv.wait()
else:
start_time = time.time()
with self._cv:
- while self.param_description is None:+ while self._param_types_inited is False:
if rospy.is_shutdown():
return None
secs_left = timeout - (time.time() - start_time)
@@ -337,6 +338,7 @@
if n is not None and t is not None:
self._param_types[n] = self._param_type_from_string(t)
+ self._param_types_inited = True
with self._cv:
self._cv.notifyAll()
if self._description_callback is not None:
The text was updated successfully, but these errors were encountered:
When using rqt_reconfigure with node with a lot of parameters, it seems some parameters are most of time not found when trying to update the configuration.
The parameters are listed in rqt_dynamic_reconfigure, but when trying to change value of some parameters "update_configuration" raise the exception line 185:
```bash
error updating parameters: don't know parameter xxx
```
rqt_reconfigure returns:
```bash
```
When equivalent commands set and get succed each time:
```bash
rosrun dynparam get <node_name> <param>
rosrun dynparam set <node_name> <param> <value>
```
Not sure of what exactly happen as it is not fully repeatable, but the solution proposed in issue ros#163 seems to do the job.
augustinmanecy
added a commit
to augustinmanecy/dynamic_reconfigure
that referenced
this issue
Mar 3, 2021
When using rqt_reconfigure with node with a lot of parameters, it seems some parameters are most of time not found when trying to update the configuration.
The parameters are listed in rqt_dynamic_reconfigure, but when trying to change value of some parameters "update_configuration" raise the exception line 185:
```bash
error updating parameters: don't know parameter xxx
```
rqt_reconfigure returns:
```bash
```
When equivalent commands set and get succed each time:
```bash
rosrun dynparam get <node_name> <param>
rosrun dynparam set <node_name> <param> <value>
```
Not sure of what exactly happen as it is not fully repeatable, but the solution proposed in issue ros#163 seems to do the job.
We use
ros-kinetic-dynamic-reconfigure 1.5.49-0xenial-20180316-113241-0800
.And occasionally
rosrun dynamic_reconfigure dynparam load
command reportserror updating parameters: don't know parameter xxx
. After spent some time to investigate the symptom, I think race condition exits insrc/dynamic_reconfigure/client.py
Line 185 "error updating parameters: don't know parameter xxx” is reported because the parameter xxx is not exist in map self._param_types.
From below code excerpt, we can see self._param_types is initialized after line 338 after self.param_description is extracted in line
Function get_parameter_descriptions will return after self.param_description is NOT None
But self.param_description is NOT None doesn’t mean self._param_types is successfully initialized, if thread 1 is executing Line 333 ~338, some parameters maybe not set.
Thread 2 execute line 183 will report error.
Could we fix it by add self._param_types_inited to indicate whether self._param_types is already initialized
The text was updated successfully, but these errors were encountered: