From 037ccac27f487aa972b26c71bdc882f4404d8e65 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 20 Nov 2024 12:38:22 +0800 Subject: [PATCH 01/11] Add note on multirobot refactor to migration guide Signed-off-by: Luca Della Vedova --- migration/Jazzy.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index 978a3fa68..868206260 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -99,3 +99,16 @@ In `PR #4675 `_ a ``pub Default value: - true + +Revamped multirobot bringup and config files to use namespaces +******************************************************* + +In `PR #4715 `_ multirobot bringup and the use of namespaces were overhauled to be compatible out of the box with ROS namespaces and remove custom logic, specifically: + +* The ``use_namespace`` parameter has been removed from ``nav2_bringup`` launch files. The ``namespace`` parameter will now always be used and default to ``/`` for "global namespace". +* There is now a single rviz config file for both normal and namespaced robots. Topics have been changed to a relative path (i.e. ``/map`` -> ``map``) and the rviz ``namespace`` will be added automatically. +* There is now a single ``nav2_params.yaml`` config file for both single and multirobot bringup. All the topics have been changed to relative (i.e. ``/scan`` -> ``scan``). + +Note that some plugins / nodes might have their own local namespace. This is the case for ``CostmapLayer`` which will be in a ``/ns/[layer_name]`` namespace. For these, a new function ``joinWithParentNamespace`` has been added to make sure joining relative paths results in ``/ns/topic_name`` rather than ``/ns/[layer_name]/topic_name``. + +If your use case doesn't require multiple robots, keeping absolute paths in your ``nav2_params.yaml`` config file and rviz config file will preserve existing behavior. From 03da77955501e786e1734cd8c80626dfe5727068 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Thu, 21 Nov 2024 10:44:35 +0800 Subject: [PATCH 02/11] Add example for configuration of sensor topic Signed-off-by: Luca Della Vedova --- migration/Jazzy.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index 868206260..41195f296 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -101,7 +101,7 @@ Default value: - true Revamped multirobot bringup and config files to use namespaces -******************************************************* +************************************************************** In `PR #4715 `_ multirobot bringup and the use of namespaces were overhauled to be compatible out of the box with ROS namespaces and remove custom logic, specifically: @@ -112,3 +112,9 @@ In `PR #4715 `_ multiro Note that some plugins / nodes might have their own local namespace. This is the case for ``CostmapLayer`` which will be in a ``/ns/[layer_name]`` namespace. For these, a new function ``joinWithParentNamespace`` has been added to make sure joining relative paths results in ``/ns/topic_name`` rather than ``/ns/[layer_name]/topic_name``. If your use case doesn't require multiple robots, keeping absolute paths in your ``nav2_params.yaml`` config file and rviz config file will preserve existing behavior. + +For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: +* User chosen namespace is `tb4`. +* User chosen topic is `scan`. +* Topic will be remapped to `/tb4/scan` without `local_costmap`. +* Use global topic `/scan` if you do not wish the node namespace to apply From c42eb570e33d608e7d3154c96de94e4f19a2300a Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Fri, 22 Nov 2024 10:31:56 +0800 Subject: [PATCH 03/11] Add notes to topic configuration guides Signed-off-by: Luca Della Vedova --- configuration/packages/costmap-plugins/obstacle.rst | 7 +++++++ configuration/packages/costmap-plugins/range.rst | 7 +++++++ configuration/packages/costmap-plugins/static.rst | 9 ++++++++- configuration/packages/costmap-plugins/voxel.rst | 7 +++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/configuration/packages/costmap-plugins/obstacle.rst b/configuration/packages/costmap-plugins/obstacle.rst index d52f3d272..2e24ae99d 100644 --- a/configuration/packages/costmap-plugins/obstacle.rst +++ b/configuration/packages/costmap-plugins/obstacle.rst @@ -86,6 +86,13 @@ This costmap layer implements a plugin that uses 2D raycasting for 2D lidars, de Description Topic of data. + Relative topics will be relative to the node's parent namespace. + For example, if you specify `topic: scan` in the `obstacle_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. + * User chosen topic is `scan`. + * Topic will be remapped to `/tb4/scan` without `local_costmap`. + * Use global topic `/scan` if you do not wish the node namespace to apply. + :````. ````.sensor_frame: ====== ======= diff --git a/configuration/packages/costmap-plugins/range.rst b/configuration/packages/costmap-plugins/range.rst index 1d789d14a..168d0ff02 100644 --- a/configuration/packages/costmap-plugins/range.rst +++ b/configuration/packages/costmap-plugins/range.rst @@ -29,6 +29,13 @@ This costmap layer implements a plugin that processes sonar, IR, or other 1-D se Description Range topics to subscribe to. + Relative topics will be relative to the node's parent namespace. + For example, if you specify `topics: [range1, /range2]` in the `range_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. + * User chosen topics are [`range1`, `/range2`]. + * Topic will be remapped to `/tb4/range1`, without `local_costmap`, and `/range2`. + * Use global topics such as `/range2` if you do not wish the node namespace to apply. + :````.phi: ====== ======= diff --git a/configuration/packages/costmap-plugins/static.rst b/configuration/packages/costmap-plugins/static.rst index dacb33d1f..eb85dfc60 100644 --- a/configuration/packages/costmap-plugins/static.rst +++ b/configuration/packages/costmap-plugins/static.rst @@ -71,4 +71,11 @@ This implements a costmap layer taking in a map from either SLAM or ``map_server ====== ======= Description - Map topic to subscribe to. If left empty the map topic will default to the global `map_topic` parameter in `costmap_2d_ros`. \ No newline at end of file + Map topic to subscribe to. If left empty the map topic will default to the global `map_topic` parameter in `costmap_2d_ros`. + + Relative topics will be relative to the node's parent namespace. + For example, if you specify `map_topic: map` in the `static_layer` of a `global_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. + * User chosen topic is `map`. + * Topic will be remapped to `/tb4/map` without `global_costmap`. + * Use global topic `/map` if you do not wish the node namespace to apply. diff --git a/configuration/packages/costmap-plugins/voxel.rst b/configuration/packages/costmap-plugins/voxel.rst index 2a7b0105b..f1b52b57b 100644 --- a/configuration/packages/costmap-plugins/voxel.rst +++ b/configuration/packages/costmap-plugins/voxel.rst @@ -151,6 +151,13 @@ This costmap layer implements a plugin that uses 3D raycasting for depth, 3D, or Description Topic of data. + Relative topics will be relative to the node's parent namespace. + For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. + * User chosen topic is `scan`. + * Topic will be remapped to `/tb4/scan` without `local_costmap`. + * Use global topic `/scan` if you do not wish the node namespace to apply. + :````. ````.sensor_frame: ====== ======= From 662efa0ec704cf2057542beb73b56ff50e925c25 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Mon, 25 Nov 2024 14:23:49 +0800 Subject: [PATCH 04/11] Fix formatting Signed-off-by: Luca Della Vedova --- configuration/packages/costmap-plugins/obstacle.rst | 1 + configuration/packages/costmap-plugins/range.rst | 1 + configuration/packages/costmap-plugins/static.rst | 1 + configuration/packages/costmap-plugins/voxel.rst | 1 + migration/Jazzy.rst | 1 + 5 files changed, 5 insertions(+) diff --git a/configuration/packages/costmap-plugins/obstacle.rst b/configuration/packages/costmap-plugins/obstacle.rst index 2e24ae99d..037f0662d 100644 --- a/configuration/packages/costmap-plugins/obstacle.rst +++ b/configuration/packages/costmap-plugins/obstacle.rst @@ -88,6 +88,7 @@ This costmap layer implements a plugin that uses 2D raycasting for 2D lidars, de Relative topics will be relative to the node's parent namespace. For example, if you specify `topic: scan` in the `obstacle_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. * User chosen topic is `scan`. * Topic will be remapped to `/tb4/scan` without `local_costmap`. diff --git a/configuration/packages/costmap-plugins/range.rst b/configuration/packages/costmap-plugins/range.rst index 168d0ff02..f5739ba74 100644 --- a/configuration/packages/costmap-plugins/range.rst +++ b/configuration/packages/costmap-plugins/range.rst @@ -31,6 +31,7 @@ This costmap layer implements a plugin that processes sonar, IR, or other 1-D se Relative topics will be relative to the node's parent namespace. For example, if you specify `topics: [range1, /range2]` in the `range_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. * User chosen topics are [`range1`, `/range2`]. * Topic will be remapped to `/tb4/range1`, without `local_costmap`, and `/range2`. diff --git a/configuration/packages/costmap-plugins/static.rst b/configuration/packages/costmap-plugins/static.rst index eb85dfc60..359ce85b6 100644 --- a/configuration/packages/costmap-plugins/static.rst +++ b/configuration/packages/costmap-plugins/static.rst @@ -75,6 +75,7 @@ This implements a costmap layer taking in a map from either SLAM or ``map_server Relative topics will be relative to the node's parent namespace. For example, if you specify `map_topic: map` in the `static_layer` of a `global_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. * User chosen topic is `map`. * Topic will be remapped to `/tb4/map` without `global_costmap`. diff --git a/configuration/packages/costmap-plugins/voxel.rst b/configuration/packages/costmap-plugins/voxel.rst index f1b52b57b..a34c82997 100644 --- a/configuration/packages/costmap-plugins/voxel.rst +++ b/configuration/packages/costmap-plugins/voxel.rst @@ -153,6 +153,7 @@ This costmap layer implements a plugin that uses 3D raycasting for depth, 3D, or Relative topics will be relative to the node's parent namespace. For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. * User chosen topic is `scan`. * Topic will be remapped to `/tb4/scan` without `local_costmap`. diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index d2362f236..e66d0ce08 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -123,6 +123,7 @@ Note that some plugins / nodes might have their own local namespace. This is the If your use case doesn't require multiple robots, keeping absolute paths in your ``nav2_params.yaml`` config file and rviz config file will preserve existing behavior. For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: + * User chosen namespace is `tb4`. * User chosen topic is `scan`. * Topic will be remapped to `/tb4/scan` without `local_costmap`. From d0275625246fb02b673935721b84a457aa108ba4 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Mon, 25 Nov 2024 14:28:55 +0800 Subject: [PATCH 05/11] Remove use_namespace parameter Signed-off-by: Luca Della Vedova --- tuning/index.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tuning/index.rst b/tuning/index.rst index 2bdd1adce..df9ca6f01 100644 --- a/tuning/index.rst +++ b/tuning/index.rst @@ -162,8 +162,7 @@ Within ``nav2_bringup``, there is a main entryfile ``tb3_simulation_launch.py``. - ``use_robot_state_pub`` : Whether or not to start the robot state publisher to publish the robot's URDF transformations to TF2. Defaults to ``true`` to publish the robot's TF2 transformations. - ``use_rviz`` : Whether or not to launch rviz for visualization. Defaults to ``true`` to show rviz. - ``headless`` : Whether or not to launch the Gazebo front-end alongside the background Gazebo simulation. Defaults to ``true`` to display the Gazebo window. -- ``namespace`` : The namespace to launch robots into, if need be. -- ``use_namespace`` : Whether or not to launch robots into this namespace. Default ``false`` and uses global namespace for single robot. +- ``namespace`` : The namespace to launch robots into. - ``robot_name`` : The name of the robot to launch. - ``robot_sdf`` : The filepath to the robot's gazebo configuration file containing the Gazebo plugins and setup to simulate the robot system. - ``x_pose``, ``y_pose``, ``z_pose``, ``roll``, ``pitch``, ``yaw`` : Parameters to set the initial position of the robot in the simulation. From 744160e3a8d6c5bab220ef476232d4fce5d0ab3b Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Tue, 26 Nov 2024 19:24:41 +0800 Subject: [PATCH 06/11] Remove map_topic parameter and add migration note Signed-off-by: Luca Della Vedova --- .../packages/configuring-costmaps.rst | 11 ---------- migration/Jazzy.rst | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/configuration/packages/configuring-costmaps.rst b/configuration/packages/configuring-costmaps.rst index 1576ce620..af5d33907 100644 --- a/configuration/packages/configuring-costmaps.rst +++ b/configuration/packages/configuring-costmaps.rst @@ -90,17 +90,6 @@ Costmap2D ROS Parameters Description Minimum cost of an occupancy grid map to be considered a lethal obstacle. -:map_topic: - - ============== ======= - Type Default - -------------- ------- - string "map" - ============== ======= - - Description - Topic of map from map_server or SLAM. - :map_vis_z: ============== ======= diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index e66d0ce08..424478dbc 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -128,3 +128,23 @@ For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costm * User chosen topic is `scan`. * Topic will be remapped to `/tb4/scan` without `local_costmap`. * Use global topic `/scan` if you do not wish the node namespace to apply + +Removed global map_topic from Costmap node +****************************************** + +In `PR #4715 `_ the global `map_topic` parameter has been removed from the `Costmap2DROS` node. This parameterwas only used in the `StaticLayer` and should be defined as a parameter local to the `StaticLayer` instead, for example: + +``` +global_costmap: + global_costmap: + ros__parameters: + [...] + # Not supported anymore + map_topic: my_map + static_layer: + plugin: "nav2_costmap_2d::StaticLayer" + map_subscribe_transient_local: True + # Do this instead + map_topic: my_map + +``` From 377c6260636de68294053d46ab18334d296a7706 Mon Sep 17 00:00:00 2001 From: Steve Macenski Date: Tue, 26 Nov 2024 11:57:26 -0800 Subject: [PATCH 07/11] Update Jazzy.rst Signed-off-by: Steve Macenski --- migration/Jazzy.rst | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index 424478dbc..d83e3e69d 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -134,17 +134,16 @@ Removed global map_topic from Costmap node In `PR #4715 `_ the global `map_topic` parameter has been removed from the `Costmap2DROS` node. This parameterwas only used in the `StaticLayer` and should be defined as a parameter local to the `StaticLayer` instead, for example: -``` -global_costmap: +.. code-block:: yaml + global_costmap: - ros__parameters: - [...] - # Not supported anymore - map_topic: my_map - static_layer: - plugin: "nav2_costmap_2d::StaticLayer" - map_subscribe_transient_local: True - # Do this instead + global_costmap: + ros__parameters: + [...] + # Not supported anymore map_topic: my_map - -``` + static_layer: + plugin: "nav2_costmap_2d::StaticLayer" + map_subscribe_transient_local: True + # Do this instead + map_topic: my_map From 835860d0f996e67142bc2fea272d488ef09877fb Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 27 Nov 2024 10:45:01 +0800 Subject: [PATCH 08/11] Add migration note on Costmap2DROS constructors Signed-off-by: Luca Della Vedova --- migration/Jazzy.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index d83e3e69d..88b2c2038 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -147,3 +147,29 @@ In `PR #4715 `_ the glo map_subscribe_transient_local: True # Do this instead map_topic: my_map + +Simplified Costmap2DROS constructors +************************************ + +The following constructors for `Costmap2DROS` have been removed: + +.. code-block:: cpp + + explicit Costmap2DROS( + const std::string & name, + const std::string & parent_namespace, + const std::string & local_namespace, + const bool & use_sim_time); + + explicit Costmap2DROS(const std::string & name, const bool & use_sim_time = false); + +They have been consolidated into a single one: + +.. code-block:: cpp + + explicit Costmap2DROS( + const std::string & name, + const std::string & parent_namespace = "/", + const bool & use_sim_time = false); + +The `local_namespace` parameter has been removed is now automatically set to the node's name (which is what the second removed constructor did) and parameters `parent_namespace` / `use_sim_time` both provide default values to maintain the ability of creating a `Costmap2DROS` object by just specifying a name. From 3cc1e2e5cbde230740064556c9a450d0d6238a69 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 27 Nov 2024 10:53:53 +0800 Subject: [PATCH 09/11] Change all literals to double backtick Signed-off-by: Luca Della Vedova --- migration/Jazzy.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index 88b2c2038..4fda87f8a 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -122,17 +122,17 @@ Note that some plugins / nodes might have their own local namespace. This is the If your use case doesn't require multiple robots, keeping absolute paths in your ``nav2_params.yaml`` config file and rviz config file will preserve existing behavior. -For example, if you specify `topic: scan` in the `voxel_layer` of a `local_costmap` and you launch your bringup with a `tb4` namespace: +For example, if you specify ``topic: scan`` in the ``voxel_layer`` of a ``local_costmap`` and you launch your bringup with a ``tb4`` namespace: -* User chosen namespace is `tb4`. -* User chosen topic is `scan`. -* Topic will be remapped to `/tb4/scan` without `local_costmap`. -* Use global topic `/scan` if you do not wish the node namespace to apply +* User chosen namespace is ``tb4``. +* User chosen topic is ``scan``. +* Topic will be remapped to ``/tb4/scan`` without ``local_costmap``. +* Use global topic ``/scan`` if you do not wish the node namespace to apply Removed global map_topic from Costmap node ****************************************** -In `PR #4715 `_ the global `map_topic` parameter has been removed from the `Costmap2DROS` node. This parameterwas only used in the `StaticLayer` and should be defined as a parameter local to the `StaticLayer` instead, for example: +In `PR #4715 `_ the global ``map_topic`` parameter has been removed from the ``Costmap2DROS`` node. This parameterwas only used in the ``StaticLayer`` and should be defined as a parameter local to the ``StaticLayer`` instead, for example: .. code-block:: yaml @@ -151,7 +151,7 @@ In `PR #4715 `_ the glo Simplified Costmap2DROS constructors ************************************ -The following constructors for `Costmap2DROS` have been removed: +The following constructors for ``Costmap2DROS`` have been removed: .. code-block:: cpp @@ -172,4 +172,4 @@ They have been consolidated into a single one: const std::string & parent_namespace = "/", const bool & use_sim_time = false); -The `local_namespace` parameter has been removed is now automatically set to the node's name (which is what the second removed constructor did) and parameters `parent_namespace` / `use_sim_time` both provide default values to maintain the ability of creating a `Costmap2DROS` object by just specifying a name. +The ``local_namespace`` parameter has been removed is now automatically set to the node's name (which is what the second removed constructor did) and parameters ``parent_namespace`` / ``use_sim_time`` both provide default values to maintain the ability of creating a ``Costmap2DROS`` object by just specifying a name. From 02509d147419e3d01b7a8a14d704857f2452c57a Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 27 Nov 2024 10:56:34 +0800 Subject: [PATCH 10/11] Grammar Signed-off-by: Luca Della Vedova --- migration/Jazzy.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/Jazzy.rst b/migration/Jazzy.rst index 4fda87f8a..65cb22a2c 100644 --- a/migration/Jazzy.rst +++ b/migration/Jazzy.rst @@ -172,4 +172,5 @@ They have been consolidated into a single one: const std::string & parent_namespace = "/", const bool & use_sim_time = false); -The ``local_namespace`` parameter has been removed is now automatically set to the node's name (which is what the second removed constructor did) and parameters ``parent_namespace`` / ``use_sim_time`` both provide default values to maintain the ability of creating a ``Costmap2DROS`` object by just specifying a name. +The ``local_namespace`` parameter has been removed and is now automatically set to the node's name (which is what the second removed constructor did). +Parameters ``parent_namespace`` / ``use_sim_time`` both provide default values to maintain the ability of creating a ``Costmap2DROS`` object by just specifying a name. From 1bc5140fa4ed5b338992c847f575aab2fd224de6 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Tue, 3 Dec 2024 09:53:11 +0800 Subject: [PATCH 11/11] Update default value / remove reference to global param Signed-off-by: Luca Della Vedova --- configuration/packages/costmap-plugins/static.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/packages/costmap-plugins/static.rst b/configuration/packages/costmap-plugins/static.rst index 359ce85b6..c0ef82c47 100644 --- a/configuration/packages/costmap-plugins/static.rst +++ b/configuration/packages/costmap-plugins/static.rst @@ -67,11 +67,11 @@ This implements a costmap layer taking in a map from either SLAM or ``map_server ====== ======= Type Default ------ ------- - string "" + string "map" ====== ======= Description - Map topic to subscribe to. If left empty the map topic will default to the global `map_topic` parameter in `costmap_2d_ros`. + Map topic to subscribe to. Relative topics will be relative to the node's parent namespace. For example, if you specify `map_topic: map` in the `static_layer` of a `global_costmap` and you launch your bringup with a `tb4` namespace: