[ros-dynamic-reconfigure] 01/04: Imported Upstream version 1.5.44

Leopold Palomo-Avellaneda leo at alaxarxa.net
Thu Jun 30 08:38:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

lepalom-guest pushed a commit to branch master
in repository ros-dynamic-reconfigure.

commit 2bb17610f1f2a044dce66dcfc34981c113cd6021
Author: Leopold Palomo-Avellaneda <leopold.palomo at upc.edu>
Date:   Thu Jun 30 09:20:05 2016 +0200

    Imported Upstream version 1.5.44
---
 CHANGELOG.rst                          | 29 ++++++++++++
 cmake/dynamic_reconfigure-macros.cmake | 16 ++++++-
 cmake/setup_custom_pythonpath.sh.in    |  4 ++
 package.xml                            |  8 ++--
 src/dynamic_reconfigure/client.py      |  2 +-
 src/dynamic_reconfigure/server.py      | 23 ++++++----
 test/testserver_multiple_ns.py         | 84 ++++++++++++++++++++++++++++++++++
 7 files changed, 153 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index c709390..265ae2d 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -2,6 +2,35 @@
 Changelog for package dynamic_reconfigure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+1.5.44 (2016-06-22)
+-------------------
+* Add server namespaces (`#56 <https://github.com/ros/dynamic_reconfigure/issues/56>`_)
+  * Add optional namespace argument to Python Server
+  * Add test for server with multiple namespaces
+* Merge pull request `#61 <https://github.com/ros/dynamic_reconfigure/issues/61>`_ from vagvaz/Issue_51_Unable_to_reload_parameters_from_file
+  fix issue `#51 <https://github.com/ros/dynamic_reconfigure/issues/51>`_ reloading parameters from dumped file
+* Contributors: Evangelos Vazaios, Mikael Arguedas, v-lopez
+
+1.5.43 (2016-03-19)
+-------------------
+* add devel space to Python environment to allow .cfg files to import them `#60 <https://github.com/ros/dynamic_reconfigure/issues/60>`_
+* Contributors: Dirk Thomas
+
+1.5.42 (2016-03-15)
+-------------------
+* fix Python environment to make it work on the first run `#59 <https://github.com/ros/dynamic_reconfigure/issues/59>`_
+* Contributors: Dirk Thomas
+
+1.5.41 (2016-03-14)
+-------------------
+* fix Python environment to make it work on the first run `#58 <https://github.com/ros/dynamic_reconfigure/issues/58>`_ 
+* Contributors: Dirk Thomas, Mikael Arguedas
+
+1.5.40 (2016-03-11)
+-------------------
+* updated maintainer
+* Contributors: Mikael Arguedas
+
 1.5.39 (2015-04-22)
 -------------------
 * Better error message, to fix `#32 <https://github.com/ros/dynamic_reconfigure/issues/32>`_
diff --git a/cmake/dynamic_reconfigure-macros.cmake b/cmake/dynamic_reconfigure-macros.cmake
index dc1cfc2..e4a93c3 100644
--- a/cmake/dynamic_reconfigure-macros.cmake
+++ b/cmake/dynamic_reconfigure-macros.cmake
@@ -27,8 +27,22 @@ macro(generate_dynamic_reconfigure_options)
     set(_output_wikidoc ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config.wikidoc)
     set(_output_usage ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config-usage.dox) 
 
+    # we need to explicitly add the devel space to the PYTHONPATH
+    # since it might contain dynamic_reconfigure or Python code of the current package
+    set("_CUSTOM_PYTHONPATH_ENV")
+    if(EXISTS "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}")
+      configure_file(
+        "${dynamic_reconfigure_BASE_DIR}/cmake/setup_custom_pythonpath.sh.in"
+        "setup_custom_pythonpath.sh"
+        @ONLY
+      )
+      set("_CUSTOM_PYTHONPATH_ENV" "${CMAKE_CURRENT_BINARY_DIR}/setup_custom_pythonpath.sh")
+    endif()
+
     assert(CATKIN_ENV)
-    set(_cmd ${CATKIN_ENV}
+    set(_cmd
+      ${CATKIN_ENV}
+      ${_CUSTOM_PYTHONPATH_ENV}
       ${_input}
       ${dynamic_reconfigure_BASE_DIR}
       ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}
diff --git a/cmake/setup_custom_pythonpath.sh.in b/cmake/setup_custom_pythonpath.sh.in
new file mode 100755
index 0000000..8d20409
--- /dev/null
+++ b/cmake/setup_custom_pythonpath.sh.in
@@ -0,0 +1,4 @@
+# generated from dynamic_reconfigure/cmake/setup_custom_pythonpath.sh.in
+
+PYTHONPATH=@CATKIN_DEVEL_PREFIX@/@CATKIN_GLOBAL_PYTHON_DESTINATION@:$PYTHONPATH
+exec "$@"
diff --git a/package.xml b/package.xml
index a261aeb..4527747 100644
--- a/package.xml
+++ b/package.xml
@@ -1,14 +1,16 @@
 <package>
   <name>dynamic_reconfigure</name>
-  <version>1.5.39</version>
+  <version>1.5.44</version>
   <description>
     This unary stack contains the dynamic_reconfigure package which provides a means to change
     node parameters at any time without having to restart the node.
   </description>
-  <maintainer email="esteve at osrfoundation.org">Esteve Fernandez</maintainer>
+  <maintainer email="mikael at osrfoundation.org">Mikael Arguedas</maintainer>
   <license>BSD</license>
 
-  <url>http://ros.org/wiki/dynamic_reconfigure</url>
+  <url type="website">http://ros.org/wiki/dynamic_reconfigure</url>
+  <url type="bugtracker">https://github.com/ros/dynamic_reconfigure/issues</url>
+  <url type="repository">https://github.com/ros/dynamic_reconfigure</url>
   <author>Blaise Gassend</author>
 
   <export>
diff --git a/src/dynamic_reconfigure/client.py b/src/dynamic_reconfigure/client.py
index 45390b6..282fe4d 100644
--- a/src/dynamic_reconfigure/client.py
+++ b/src/dynamic_reconfigure/client.py
@@ -178,7 +178,7 @@ class Client(object):
         # Cast the parameters to the appropriate types
         if self.param_description is not None:
             for name, value in list(changes.items())[:]:
-                if not name is 'groups':
+                if name != 'groups':
                     dest_type = self._param_types.get(name)
                     if dest_type is None:
                         raise DynamicReconfigureParameterException('don\'t know parameter: %s' % name)
diff --git a/src/dynamic_reconfigure/server.py b/src/dynamic_reconfigure/server.py
index 24f5cb5..453ef0f 100644
--- a/src/dynamic_reconfigure/server.py
+++ b/src/dynamic_reconfigure/server.py
@@ -54,8 +54,15 @@ from dynamic_reconfigure.msg import IntParameter, BoolParameter, StrParameter, D
 from dynamic_reconfigure.encoding import *
 
 class Server(object):
-    def __init__(self, type, callback):
+    def __init__(self, type, callback, namespace=""):
         self.mutex = threading.Lock()
+        if not namespace:
+            self.ns = "~"
+        else:
+            if namespace[0] not in ["/", "~"]:
+                namespace = "~" + namespace
+            self.ns = (namespace + "/").replace("//", "/")
+
         self.type = type
         self.config = type.defaults.copy()
 
@@ -68,13 +75,13 @@ class Server(object):
         self.config['groups'] = get_tree(self.description)
         self.config = initial_config(encode_config(self.config), type.config_description)
 
-        self.descr_topic = rospy.Publisher('~parameter_descriptions', ConfigDescrMsg, latch=True, queue_size=10)
+        self.descr_topic = rospy.Publisher(self.ns + 'parameter_descriptions', ConfigDescrMsg, latch=True, queue_size=10)
         self.descr_topic.publish(self.description);
-        
-        self.update_topic = rospy.Publisher('~parameter_updates', ConfigMsg, latch=True, queue_size=10)
+
+        self.update_topic = rospy.Publisher(self.ns + 'parameter_updates', ConfigMsg, latch=True, queue_size=10)
         self._change_config(self.config, ~0) # Consistent with the C++ API, the callback gets called with level=~0 (i.e. -1)
-        
-        self.set_service = rospy.Service('~set_parameters', ReconfigureSrv, self._set_callback)
+
+        self.set_service = rospy.Service(self.ns + 'set_parameters', ReconfigureSrv, self._set_callback)
 
     def update_configuration(self, changes):
         with self.mutex:
@@ -86,13 +93,13 @@ class Server(object):
     def _copy_from_parameter_server(self):
         for param in extract_params(self.type.config_description):
             try:
-                self.config[param['name']] = rospy.get_param("~" + param['name'])
+                self.config[param['name']] = rospy.get_param(self.ns + param['name'])
             except KeyError:
                 pass
 
     def _copy_to_parameter_server(self):
         for param in extract_params(self.type.config_description):
-            rospy.set_param('~' + param['name'], self.config[param['name']])
+            rospy.set_param(self.ns + param['name'], self.config[param['name']])
 
     def _change_config(self, config, level):
         self.config = self.callback(config, level)
diff --git a/test/testserver_multiple_ns.py b/test/testserver_multiple_ns.py
new file mode 100755
index 0000000..6e5c178
--- /dev/null
+++ b/test/testserver_multiple_ns.py
@@ -0,0 +1,84 @@
+#! /usr/bin/env python
+#*********************************************************************
+# Software License Agreement (BSD License)
+#
+#  Copyright (c) 2009-2010, Willow Garage, Inc.
+#  All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above
+#     copyright notice, this list of conditions and the following
+#     disclaimer in the documentation and/or other materials provided
+#     with the distribution.
+#   * Neither the name of the Willow Garage nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+#  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+#  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+#  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#********************************************************************/
+
+import roslib; roslib.load_manifest('dynamic_reconfigure')
+import rospy
+import dynamic_reconfigure.server
+from dynamic_reconfigure.cfg import TestConfig
+import time
+
+def main():
+    rospy.init_node("python_test_multiple_ns_server")
+    dynamic_reconfigure.server.Server(TestConfig, reconfigure)
+    dynamic_reconfigure.server.Server(TestConfig, reconfigure_alternate_ns,
+                                      "~alternate_ns")
+    dynamic_reconfigure.server.Server(TestConfig, reconfigure_2lvls_ns,
+                                      "~alternate_ns/second_lvl")
+    dynamic_reconfigure.server.Server(TestConfig, reconfigure_absolute_ns,
+                                      "/absolute_ns")
+    while not rospy.is_shutdown():
+        time.sleep(0.1)
+
+def reconfigure(config, level):
+    print config
+
+    config['int_'] |= 1;
+    config['double_'] = -config['double_'];
+    config['str_'] += "A";
+    config['bool_'] = not config['bool_'];
+    config['level'] = level;
+
+    rospy.loginfo("Reconfigured to     : %i %f %s %s %i"%(config['int_'], config['double_'], config['str_'], config['bool_'], config['level']))
+
+    return config # Returns the updated configuration.
+
+def reconfigure_default(config,level):
+    rospy.loginfo("Reconfigure request on default ns")
+    return reconfigure(config, level)
+
+def reconfigure_alternate_ns(config,level):
+    rospy.loginfo("Reconfigure request on alternate_ns")
+    return reconfigure(config, level)
+
+def reconfigure_2lvls_ns(config,level):
+    rospy.loginfo("Reconfigure request on alternate_ns/second_lvl")
+    return reconfigure(config, level)
+
+def reconfigure_absolute_ns(config,level):
+    rospy.loginfo("Reconfigure request on /absolute_ns")
+    return reconfigure(config, level)
+
+if __name__ == '__main__':
+    main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/ros-dynamic-reconfigure.git



More information about the debian-science-commits mailing list