How to use the Obstacle Layer alone?

As a part of the study, I would like to see if we only use the obstacle layer, what will the map look like? The experiment is inspired by your Exercise 4.7. If I use the static_layer and the obstacle_layer, it seems to work fine.

However, If I use the obstacle_layer, it builds a small map and begins to complain.


The robot is exactly the Sam bot in the official tutorial of NAV2.
I use the following codes to connect the map and odom.

    publish_map_ododm_cmd = Node(
                package='tf2_ros',
                executable='static_transform_publisher',
                name='static_transform_publisher_node',
                output='screen',
                arguments=['0', '0', '0', '0', '0', '0', 'map', 'odom'])
    ld.add_action(publish_map_ododm_cmd)

The following is my config file.

map_server:
ros__parameters:
use_sim_time: True
yaml_filename: “turtlebot3_world.yaml”

map_saver:
ros__parameters:
use_sim_time: True
save_map_timeout: 5.0
free_thresh_default: 0.25
occupied_thresh_default: 0.65
map_subscribe_transient_local: True

planner_server:
ros__parameters:
expected_planner_frequency: 20.0
use_sim_time: True
planner_plugins: [“GridBased”]
GridBased:
plugin: “nav2_navfn_planner/NavfnPlanner”
tolerance: 0.5
use_astar: false
allow_unknown: true

planner_server_rclcpp_node:
ros__parameters:
use_sim_time: True

global_costmap:
global_costmap:
ros__parameters:
update_frequency: 1.0
publish_frequency: 1.0
global_frame: map
robot_base_frame: base_link
#robot_base_frame: base_footprint
use_sim_time: True
robot_radius: 0.3
resolution: 0.05
track_unknown_space: true
# plugins: [“static_layer”, “obstacle_layer”, “inflation_layer”]
plugins: [“obstacle_layer”]
obstacle_layer:
plugin: “nav2_costmap_2d::ObstacleLayer”
enabled: True
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: “LaserScan”
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
static_layer:
plugin: “nav2_costmap_2d::StaticLayer”
map_subscribe_transient_local: True
inflation_layer:
plugin: “nav2_costmap_2d::InflationLayer”
cost_scaling_factor: 3.0
inflation_radius: 0.55
always_send_full_costmap: True
global_costmap_client:
ros__parameters:
use_sim_time: True
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True

Hi @bluebird we will try to give you some pointers or ideas of what you could try next week.

Cheers,

Roberto

1 Like