0
$\begingroup$

I have a very similar question to: [ROS2][Nav2] Is there a way to expand the global costmap? and Nav2 to navigate to space outside of global cost map when using static layer

I am working on ros2 jazzy in ubuntu 24.04 custom diff-robot.

I want to set goal poses outside the unknown area, specifically beyond the static layer of the global costmap. However, when I try to do this, the planner server fails to generate a plan because the goal is out of bounds (seams logic).

I've enabled track_unknown_space: true and adjusted the width and height of the global costmap so that the goal should be within bounds, but still unable to plan. I feel like I'm missing something obvious, as I haven't found others encountering this issue.

global_costmap: 
  global_costmap:
    ros__parameters:
      update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      width: 50
      height: 50
      use_sim_time: true
      footprint: "[ [0.2, 0.5], [0.2, -0.5], [-1.1, -0.5] , [-1.1, 0.5] ]"
      resolution: 0.05
      track_unknown_space: true
      plugins: ["static_layer", "obstacle_layer", "inflation_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"
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        enabled: true
        map_subscribe_transient_local: true
        subscribe_to_updates: true
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        enabled: true
        cost_scaling_factor: 3.0
        inflation_radius: 1.2
      always_send_full_costmap: true

enter image description here What I observe is that the costmap is set initially but then resized by the static layer. During startup, I can briefly see the map, set by the params, in RViz before it gets resized. If anyone could provide guidance, it would be greatly appreciated.

$\endgroup$

1 Answer 1

0
$\begingroup$

The static layer is 'special' in that it sets the size of the costmap to be the size of the map it is given. If you wish to use a static sized larger costmap than the map, you'll either need to create your own static layer that doesn't resize that map (when the existing map is larger than the given map), not use the static map, or have your map resized in the image file to be the size you're looking for the total map size to be.

The assumption of the static layer is that this is the navigation map and thus can / should resize the costmap to be its size (but can be dynamically updated with map updates for SLAM or different map sources).

$\endgroup$
1
  • $\begingroup$ ok thank you... I tried without the static map but I need it for proper navigation and I want it to resize if needed. I guess my only options then are creating my own static layer or publishing an empty map when the system is running, to the size where my goal will land or some how have slam_toolbox start with a bigger map. $\endgroup$
    – dodi
    Commented Sep 24 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.