Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configuration/packages/configuring-costmaps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ Plugin Parameters

costmap-plugins/static.rst
costmap-plugins/inflation.rst
costmap-plugins/inflation_legacy.rst
costmap-plugins/obstacle.rst
costmap-plugins/voxel.rst
costmap-plugins/range.rst
Expand Down
42 changes: 42 additions & 0 deletions configuration/packages/costmap-plugins/inflation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,45 @@ This layer places an exponential decay functions around obstacles to increase co

Description
Whether to inflate unknown cells.


:``<inflation layer>``.num_threads:
Comment thread
SteveMacenski marked this conversation as resolved.

==== =======
Type Default
---- -------
int -1
==== =======

Description
Number of threads to use for inflation computation when OpenMP is enabled.
Set to ``-1`` for auto-detection (uses half of available CPU cores), or specify a positive integer for explicit thread count.
Ignored if OpenMP support is not available.

Building with OpenMP
--------------------

OpenMP parallelization is disabled by default. To enable it, pass the ``ENABLE_OPENMP`` CMake option when building:

.. code-block:: bash

# Build with OpenMP enabled
colcon build --packages-select nav2_costmap_2d --cmake-args -DENABLE_OPENMP=ON

# Build with OpenMP disabled (default)
colcon build --packages-select nav2_costmap_2d --cmake-args -DENABLE_OPENMP=OFF

Performance Benchmarks
----------------------

**Test Configuration:** 2000×2000 Grid (4M cells, 50% occupancy, 2m inflation radius)

**Robot Hardware:** 16 cores × 5000 MHz

+---------------------+----------+------------------+---------------------------+
| Configuration | Time | Throughput | vs Legacy Inflation Layer |
+=====================+==========+==================+===========================+
| OpenMP disabled | 48.9 ms | 81.8 M cells/s | 2.1× faster |
+---------------------+----------+------------------+---------------------------+
| OpenMP enabled | 9.11 ms | 468.9 M cells/s | 11.5× faster |
+---------------------+----------+------------------+---------------------------+
70 changes: 70 additions & 0 deletions configuration/packages/costmap-plugins/inflation_legacy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.. inflation:

Legacy Inflation Layer Parameters
=================================

.. warning::

This layer has been deprecated in favor of the refactored :doc:`Inflation Layer <inflation>`, which offers significantly improved performance (up to 11.5× faster with OpenMP enabled). Consider migrating to the new implementation.

This layer places an exponential decay functions around obstacles to increase cost to traverse near collision. It also places a lethal cost around obstacles within the robot's fully inscribed radius - even if a robot is non-circular for optimized first-order collision checking.

``<inflation layer>`` is the corresponding plugin name selected for this type.


:``<inflation layer>``.enabled:

==== =======
Type Default
---- -------
bool True
==== =======

Description
Whether it is enabled.

:``<inflation layer>``.inflation_radius:

====== =======
Type Default
------ -------
double 0.55
====== =======

Description
Radius to inflate costmap around lethal obstacles.

:``<inflation layer>``.cost_scaling_factor:

====== =======
Type Default
------ -------
double 10.0
====== =======

Description
Exponential decay factor across inflation radius.


:``<inflation layer>``.inflate_unknown:

==== =======
Type Default
---- -------
bool False
==== =======

Description
Whether to inflate unknown cells as if lethal.


:``<inflation layer>``.inflate_around_unknown:

==== =======
Type Default
---- -------
bool False
==== =======

Description
Whether to inflate unknown cells.
8 changes: 8 additions & 0 deletions migration/Kilted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -796,3 +796,11 @@ New default_cancel_timeout parameter in bt_navigator
In `PR 5895 <https://github.com/ros-navigation/navigation2/pull/5895>`_, a new `default_cancel_timeout` parameter was introduced to address timeout issues during action cancellation, such as ``Failed to get result for follow_path in node halt!``.

The default value is set to `50` milliseconds, and should be adjusted based on the planning time and overall system performance.

Refactored Inflation layer powered by OpenMP
--------------------------------------------

`PR #5933 <https://github.com/ros-navigation/navigation2/pull/5933>`_ refactors the Inflation layer to leverage OpenMP for parallel processing, significantly improving performance in large maps.

The new implementation replaces the previous queue-based cell iteration with a Felzenszwalb-Huttenlocher distance transform algorithm.
When OpenMP is not available at compile time, the layer falls back to single-threaded operation.
Comment thread
SteveMacenski marked this conversation as resolved.
8 changes: 7 additions & 1 deletion plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ Costmap Layers
| | | occupancy information into |
| | | costmap |
+--------------------------------+------------------------+----------------------------------+
| `Inflation Layer`_ | Eitan Marder-Eppstein | Inflates lethal obstacles in |
| `Inflation Layer` _ | Tony Najjar | Inflates lethal obstacles in |
| | | costmap with exponential decay |
| | | (with the option to use OpenMP |
| | | for parallelization) ____________|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Underscores?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image oops, my editor was hiding them, should be fixed now

+--------------------------------+------------------------+----------------------------------+
| `Legacy Inflation Layer`_ | Eitan Marder-Eppstein | Inflates lethal obstacles in |
| | | costmap with exponential decay |
+--------------------------------+------------------------+----------------------------------+
| `Obstacle Layer`_ | Eitan Marder-Eppstein | Maintains persistent 2D costmap |
Expand Down Expand Up @@ -81,6 +86,7 @@ Costmap Layers
.. _Static Layer: https://github.com/ros-navigation/navigation2/tree/main/nav2_costmap_2d/plugins/static_layer.cpp
.. _Range Layer: https://github.com/ros-navigation/navigation2/tree/main/nav2_costmap_2d/plugins/range_sensor_layer.cpp
.. _Inflation Layer: https://github.com/ros-navigation/navigation2/tree/main/nav2_costmap_2d/plugins/inflation_layer.cpp
.. _Legacy Inflation Layer: https://github.com/ros-navigation/navigation2/tree/main/nav2_costmap_2d/plugins/legacy_inflation_layer.cpp
.. _Obstacle Layer: https://github.com/ros-navigation/navigation2/tree/main/nav2_costmap_2d/plugins/obstacle_layer.cpp
.. _Spatio-Temporal Voxel Layer: https://github.com/SteveMacenski/spatio_temporal_voxel_layer/
.. _Non-Persistent Voxel Layer: https://github.com/SteveMacenski/nonpersistent_voxel_layer
Expand Down
Loading