Skip to content

Local and global costmap ~half cell misalignment when both using the global frame #5232

Open
@DylanDeCoeyer-Quimesis

Description

@DylanDeCoeyer-Quimesis

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Computer:
  • ROS2 Version:
    • ROS2 Iron
  • Version or commit hash:
    • 1.2.10
  • DDS implementation:
    • Cyclone DDS

Steps to reproduce issue

Use a rolling local costmap and a static global costmap. Configure both with the same global frame. Typically:

local_costmap:
  local_costmap:
    ros__parameters:
      update_frequency: 5.0
      publish_frequency: 5.0
      global_frame: map
      robot_base_frame: base_link
      rolling_window: true
      trinary_costmap: False
      width: 3
      height: 3
      resolution: 0.1
      robot_radius: 0.8
      use_maximum: true

      plugins: ["sync_layer"]
      sync_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: True
        map_topic: "/global_costmap/costmap"
        subscribe_to_updates: True
        enabled: True
      always_send_full_costmap: True

global_costmap:
  global_costmap:
    ros__parameters:
      publish_frequency: 1.0
      update_frequency: 5.0
      global_frame: map
      robot_base_frame: base_link
      robot_radius: 0.8
      resolution: 0.1
      track_unknown_space: False
      use_maximum: true

      plugins: [...]

Expected behavior

The local and global costmap are perfectly aligned since their sizes are integers, and the rolling costmap center coordinates is also casted to integer (https://github.com/ros-navigation/navigation2/blob/iron/nav2_costmap_2d/src/costmap_2d.cpp#L331).

Image

450640192-408c6cfd-27ae-45d4-ae35-8edcbbaa872e.mp4

Actual behavior

In some cases / after some time (still unclear), the rolling local costmap appears slightly shifted (~40% of a cell) with respect to the global costmap.

Image

Reproduction instructions

Additional information

Issue originally mentioned in #5152

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions