From 901a9cbbf84dadcb27d19fd40908dd8142b4ce66 Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Fri, 31 Jan 2025 14:38:56 +0100 Subject: [PATCH 1/5] Add ROS 1 to ROS 2 migration note for group parameter handling Add information to help developers safely migrate parameter updates by highlighting that ROS 2's default set_parameters service behaves differently than ROS 1's dynamic_reconfigure regarding atomic updates. Points users to set_parameters_atomically service to maintain atomic behavior during migration. --- source/Concepts/Basic/About-Parameters.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/Concepts/Basic/About-Parameters.rst b/source/Concepts/Basic/About-Parameters.rst index c1378eb7154..6398ea7536d 100644 --- a/source/Concepts/Basic/About-Parameters.rst +++ b/source/Concepts/Basic/About-Parameters.rst @@ -132,3 +132,9 @@ ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``par ros2 run demo_nodes_cpp parameter_blackboard The code for the ``parameter_blackboard`` is `here `__. + +Unlike ROS 1, ROS 2 by default handles parameter groups differently. +In ROS 1, ``dynamic_reconfigure`` handles parameter groups atomically, meaning all parameters in a reconfiguration request are processed together in a single callback. +In ROS 2, the default ``set_parameters`` service processes each parameter individually, which may lead to multiple callback invocations. +To maintain atomic behavior when migrating from ``dynamic_reconfigure``, use the ``set_parameters_atomically`` service, which validates and applies all parameters as a single operation. +If any parameter fails validation, no parameters will be updated. From dc2ae47f0e6f08b453fba9e1f4989b9dd9db49f5 Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Sat, 1 Feb 2025 08:21:23 +0100 Subject: [PATCH 2/5] Remove 'default' terminology from parameter services note --- source/Concepts/Basic/About-Parameters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Concepts/Basic/About-Parameters.rst b/source/Concepts/Basic/About-Parameters.rst index 6398ea7536d..739f945fd69 100644 --- a/source/Concepts/Basic/About-Parameters.rst +++ b/source/Concepts/Basic/About-Parameters.rst @@ -133,8 +133,8 @@ ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``par The code for the ``parameter_blackboard`` is `here `__. -Unlike ROS 1, ROS 2 by default handles parameter groups differently. +When migrating parameter groups from ROS 1 to ROS 2, there are important differences to consider. In ROS 1, ``dynamic_reconfigure`` handles parameter groups atomically, meaning all parameters in a reconfiguration request are processed together in a single callback. -In ROS 2, the default ``set_parameters`` service processes each parameter individually, which may lead to multiple callback invocations. +In ROS 2, the ``set_parameters`` service processes each parameter individually, which may lead to multiple callback invocations. To maintain atomic behavior when migrating from ``dynamic_reconfigure``, use the ``set_parameters_atomically`` service, which validates and applies all parameters as a single operation. If any parameter fails validation, no parameters will be updated. From 998f3ea6e170a5e8272a0d28ddb9a63400e7ad93 Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Thu, 6 Feb 2025 10:48:28 +0100 Subject: [PATCH 3/5] Adapt the structure of the migration guide from ROS 1 to ROS 2 --- source/Concepts/Basic/About-Parameters.rst | 20 +--------------- .../Migrating-Parameters.rst | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/source/Concepts/Basic/About-Parameters.rst b/source/Concepts/Basic/About-Parameters.rst index 739f945fd69..e0f535e1e2d 100644 --- a/source/Concepts/Basic/About-Parameters.rst +++ b/source/Concepts/Basic/About-Parameters.rst @@ -119,22 +119,4 @@ Migrating from ROS 1 The :doc:`Launch file migration guide <../../How-To-Guides/Migrating-from-ROS1/Migrating-Launch-Files>` explains how to migrate ``param`` and ``rosparam`` launch tags from ROS 1 to ROS 2. -The :doc:`YAML parameter file migration guide <../../How-To-Guides/Migrating-from-ROS1/Migrating-Parameters>` explains how to migrate parameter files from ROS 1 to ROS 2. - -In ROS 1, the ``roscore`` acted like a global parameter blackboard where all nodes could get and set parameters. -Since there is no central ``roscore`` in ROS 2, that functionality no longer exists. -The recommended approach in ROS 2 is to use per-node parameters that are closely tied to the nodes that use them. -If a global blackboard is still needed, it is possible to create a dedicated node for this purpose. -ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``parameter_blackboard``; it can be run with: - -.. code-block:: console - - ros2 run demo_nodes_cpp parameter_blackboard - -The code for the ``parameter_blackboard`` is `here `__. - -When migrating parameter groups from ROS 1 to ROS 2, there are important differences to consider. -In ROS 1, ``dynamic_reconfigure`` handles parameter groups atomically, meaning all parameters in a reconfiguration request are processed together in a single callback. -In ROS 2, the ``set_parameters`` service processes each parameter individually, which may lead to multiple callback invocations. -To maintain atomic behavior when migrating from ``dynamic_reconfigure``, use the ``set_parameters_atomically`` service, which validates and applies all parameters as a single operation. -If any parameter fails validation, no parameters will be updated. +The :doc:`Migration guide <../../How-To-Guides/Migrating-from-ROS1/Migrating-Parameters>` explains how to migrate parameter from ROS 1 to ROS 2. diff --git a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst index 5168f906df4..ca491aeba27 100644 --- a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst +++ b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst @@ -74,3 +74,27 @@ Some features of ROS 1 parameters files do not exist in ROS 2: - Mixed types in a list is not supported yet (`related issue `_) - ``deg`` and ``rad`` substitutions are not supported + +Migrating code +-------------- + +In ROS 1, the ``roscore`` acted like a global parameter blackboard where all nodes could get and set parameters. +Since there is no central ``roscore`` in ROS 2, that functionality no longer exists. +The recommended approach in ROS 2 is to use per-node parameters that are closely tied to the nodes that use them. +If a global blackboard is still needed, it is possible to create a dedicated node for this purpose. +ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``parameter_blackboard``; it can be run with: + +.. code-block:: console + + ros2 run demo_nodes_cpp parameter_blackboard + +The code for the ``parameter_blackboard`` is `here `__. + +Parameter groups +^^^^^^^^^^^^^^^^ + +When migrating parameter groups from ROS 1 to ROS 2, there are important differences to consider. +In ROS 1, ``dynamic_reconfigure`` handles parameter groups atomically, meaning all parameters in a reconfiguration request are processed together in a single callback. +In ROS 2, the ``set_parameters`` service processes each parameter individually, which may lead to multiple callback invocations. +To maintain atomic behavior when migrating from ``dynamic_reconfigure``, use the ``set_parameters_atomically`` service, which validates and applies all parameters as a single operation. +If any parameter fails validation, no parameters will be updated. From 1a1fda4e4555cc79604e63e6d8fbc043f19ce701 Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Fri, 7 Feb 2025 08:33:53 +0100 Subject: [PATCH 4/5] Refactor based on code review --- .../Migrating-Parameters.rst | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst index ca491aeba27..c9425c0d2d5 100644 --- a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst +++ b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst @@ -18,6 +18,19 @@ In ROS 2, parameters are associated per node and are configurable at runtime wit * See :doc:`ROS 2 CLI usage <../../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Parameters/Understanding-ROS2-Parameters>` for a better understanding of how the CLI tools work and its differences with ROS 1 tooling. +Global Parameter Server +----------------------- + +In ROS 1, the ``roscore`` acted like a global parameter blackboard where all nodes could get and set parameters. +Since there is no central ``roscore`` in ROS 2, that functionality no longer exists. +The recommended approach in ROS 2 is to use per-node parameters that are closely tied to the nodes that use them. +If a global blackboard is still needed, it is possible to create a dedicated node for this purpose. +ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``parameter_blackboard``; it can be run with: + +.. code-block:: console + ros2 run demo_nodes_cpp parameter_blackboard +The code for the ``parameter_blackboard`` is `here `__. + Migrating YAML Parameter Files ------------------------------ @@ -75,23 +88,9 @@ Some features of ROS 1 parameters files do not exist in ROS 2: - Mixed types in a list is not supported yet (`related issue `_) - ``deg`` and ``rad`` substitutions are not supported -Migrating code --------------- - -In ROS 1, the ``roscore`` acted like a global parameter blackboard where all nodes could get and set parameters. -Since there is no central ``roscore`` in ROS 2, that functionality no longer exists. -The recommended approach in ROS 2 is to use per-node parameters that are closely tied to the nodes that use them. -If a global blackboard is still needed, it is possible to create a dedicated node for this purpose. -ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``parameter_blackboard``; it can be run with: - -.. code-block:: console - - ros2 run demo_nodes_cpp parameter_blackboard - -The code for the ``parameter_blackboard`` is `here `__. -Parameter groups -^^^^^^^^^^^^^^^^ +Parameter Atomic Operation +-------------------------- When migrating parameter groups from ROS 1 to ROS 2, there are important differences to consider. In ROS 1, ``dynamic_reconfigure`` handles parameter groups atomically, meaning all parameters in a reconfiguration request are processed together in a single callback. From a418fd0c759620f3ca427d9ffe34e9aa1235b57a Mon Sep 17 00:00:00 2001 From: Mariusz Szczepanik Date: Fri, 7 Feb 2025 19:10:13 +0100 Subject: [PATCH 5/5] Fix console code-block --- .../How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst index c9425c0d2d5..af99c20e596 100644 --- a/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst +++ b/source/How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.rst @@ -28,7 +28,9 @@ If a global blackboard is still needed, it is possible to create a dedicated nod ROS 2 ships with one in the ``ros-{DISTRO}-demo-nodes-cpp`` package called ``parameter_blackboard``; it can be run with: .. code-block:: console + ros2 run demo_nodes_cpp parameter_blackboard + The code for the ``parameter_blackboard`` is `here `__. Migrating YAML Parameter Files