Robotics StackExchange | Archived questions

Nav2 Costmap not assigning free space correctly

Hello,

I cannot understand the behaviour of the costmap plugin when assigning free/obstacle (param file at the bottom). Im working in simulation and using a pointcloud as my source for both the local and global costmaps.

In this case for example, I do not understand why the free space area is so small. It seems like the raytrace only works when the trace ends on the obstacle and not on the ground, as you can see the free space is only a small cone that ends on the obstacle edge (a cube), whiel it should ideally cover the whole angle of the pcl.

https://ibb.co/Fx1W4zJ (sorry for sketchy link, cant upload images without 5 points...)

If I get further away from the obstacle then no free space is detected at all.

https://ibb.co/7tXPkVG

I tried placing smaller objects, below the minobstacleheight, but higher than the "perfect" zero of the floor, with no change, it only creates free space if if there is an obstacle further away.

Any ideas of what is happening here and which parameter would correctly fix this?

Here the config file I am using.

local_costmap:
  local_costmap:
    ros__parameters:
      update_frequency: 5.0
      publish_frequency: 2.0
      global_frame: odom
      robot_base_frame: base_link
      use_sim_time: True
      rolling_window: true
      width: 5
      height: 5
      resolution: 0.05
      robot_radius: 0.5
      plugins: ["obstacle_layer", "inflation_layer"]
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        cost_scaling_factor: 3.0
        inflation_radius: 0.55
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: True
        observation_sources: pointcloud
        pointcloud:  # no frame set, uses frame from message
          topic: /navbox/rs_camera/points_filtered
          max_obstacle_height: 2.0
          min_obstacle_height: 0.3
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          inf_is_valid: true
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          clearing: True
          marking: True
          data_type: "PointCloud2"
      always_send_full_costmap: True

global_costmap:
  global_costmap:
    ros__parameters:
      width: 30
      height: 30
      origin_x: -15.0
      origin_y: -15.0
      update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      use_sim_time: True
      robot_radius: 0.5
      resolution: 0.05
      track_unknown_space: true
      unknown_cost_value: 0
      trinary_costmap: false
      plugins: ["obstacle_layer", "inflation_layer"]
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: True
        observation_sources: pointcloud
        pointcloud:  # no frame set, uses frame from message
          topic: /navbox/rs_camera/points_filtered
          max_obstacle_height: 2.0
          min_obstacle_height: 0.3
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          clearing: True
          inf_is_valid: true
          marking: True
          data_type: "PointCloud2"
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        cost_scaling_factor: 3.0
        inflation_radius: 0.55
      always_send_full_costmap: True

Asked by roboticraccoon on 2023-05-25 09:40:01 UTC

Comments

Answers