0
$\begingroup$

I'm using slam_toolbox and nav2 stack to carry out SLAM with a quadcopter equipped with a LIDAR and a odometry camera in a simulated environment using Gazebo Garden (ROS2, Humble).

enter image description here

On the left, the simulation and on the right, the Rviz representation showing the map generated by the slam_toolbox.

The global costmap generated is the following:

enter image description here

If I publish in /goal_pose inside the global costmap, the path is correctly generated. However, if the pose is outside the global costmap, the path is not generated, and the planner throws the following error:

[planner_server-3] [WARN] [1696935861.787104060] [planner_server]: The goal sent to the planner is off the global costmap. Planning will always fail to this goal.
[planner_server-3] [WARN] [1696935861.787135374] [planner_server]: GridBased: failed to create plan with tolerance 0.50.
[planner_server-3] [WARN] [1696935861.787145046] [planner_server]: Planning algorithm GridBased failed to generate a valid path to (0.00, -1.00)
[planner_server-3] [WARN] [1696935861.787152422] [planner_server]: [compute_path_to_pose] [ActionServer] Aborting handle.
[planner_server-3] [INFO] [1696935861.806963997] [global_costmap.global_costmap]: Received request to clear entirely the global_costmap

I have tried setting the width and the height of the global costmap to 10 meters, but the initial size keeps being the same. As the quadcopter moves around, the map gets larger and so the global costmap does. I have also tried using the Smac planner, but the path is not calculated either.

Setting the parameter rolling_window to True makes effectively the initial costmap larger, but I would rather use a not-rolling map, with a big-enough initial size whose size increases when the robot approaches its boundaries.

Any ideas how to do it? Am I doing something wrong?

Thanks in advance!

PD, this is my local and global costmap configuration:

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: 3
      height: 3
      resolution: 0.05
      robot_radius: 1.0
      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: scan
        scan:
          topic: /scan
          max_obstacle_height: 2.0
          clearing: True
          marking: True
          data_type: "LaserScan"
      static_layer:
        map_subscribe_transient_local: True
        always_send_full_costmap: True
  local_costmap_client:
    ros__parameters:
      use_sim_time: False
  local_costmap_rclcpp_node:
    ros__parameters:
      use_sim_time: False

global_costmap:
  global_costmap:
    ros__parameters:
      update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      use_sim_time: True
      robot_radius: 0.22
      resolution: 0.05
      track_unknown_space: true

      rolling_window: false
      width: 10
      height: 10

      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: 3.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
$\endgroup$
0

1 Answer 1

0
$\begingroup$

In case someone faces the same problem: I ended up creating an interceding node which takes the map from the slam algorithm and increases it when the robot approaches the limits of the map or when a goal off the costmap limits. The added areas of the map are marked as unknown.

Default:

slam_toolbox -> /map -> nav2

Now:

slam_toolbox -> /map_raw -> map_mod_node -> /map -> nav2

If someone finds a better solution, it would be nice to hear it =)

$\endgroup$

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.