ROS2 Tutorial: Navigation with keepout zones

Enabling the Costmap Filter

Costmap Filters are implemented via Costamp2D plugins. The KeepoutFilter can be enabled by adding keepout_filter to the plugins parameter in nav2_params.yaml. To perform planning with keepouts, it should be placed in global_costmap, and to make sure the robot will not drive through the keepout zone, it should be placed in local_costmap.
Note that it is better to enable both local and global filtering, to avoid situations when the path goes through the keepout zone (as we didn't set global), but robot can not enter it.

Fragment of nav2_params.yaml

                    global_costmap:
                        global_costmap:
                        ros__parameters:
                            ...
                            plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
                            filters: ["keepout_filter"]
                            ...
                            keepout_filter:
                            plugin: "nav2_costmap_2d::KeepoutFilter"
                            enabled: True
                            filter_info_topic: "/costmap_filter_info"
                    ...
                    local_costmap:
                        local_costmap:
                        ros__parameters:
                            ...
                            plugins: ["voxel_layer", "inflation_layer"]
                            filters: ["keepout_filter"]
                            ...
                            keepout_filter:
                            plugin: "nav2_costmap_2d::KeepoutFilter"
                            enabled: True
                            filter_info_topic: "/costmap_filter_info"
                

For a complete list of parameters supported by KeepoutFilter, see the Keepout Filter Parameters page.

(C) snowcron.com, all rights reserved

Please read the disclaimer