Skip to content

Issue loading saved map when saved under a subdirectory #3078

@nakai-omer

Description

@nakai-omer

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • ROS2 Version:
    • Humble
  • Version or commit hash:
    • ros-humble-navigation2 1.1.0-2jammy.20220607.182532
  • DDS implementation:
    • Fast-RTPS

Steps to reproduce issue

Call the map saver server with a map_url that includes a subdirectory:

ros2 service call /map_saver/save_map nav2_msgs/srv/SaveMap "{map_topic: map, map_url: maps/nakai_world, image_format: pgm, map_mode: trinary, free_thresh: 0.25, occupied_thresh: 0.65}"

Expected behavior

Output yaml file image file will have a relative path to the yaml file, and not to current working directory. Conversely, when loading the map, map_server should not append the yaml file's path to the image path, rather it should append the currect working directory to the image path.

Actual behavior

Image path inside the map's yaml file, is relative to current working directory and not to the yaml file.

image: maps/nakai_world.pgm 
mode: trinary
resolution: 0.05
origin: [-9.39e-05, -0.68, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25

Additional information

When trying to later load the map using map_server, getting the following error:

[ERROR] [map_io]: Failed to load image file ./maps/maps/nakai_world.pgm for reason: Magick: Unable to open file (./maps/maps/nakai_world.pgm) reported by magick/blob.c:3089 (OpenBlob)

All commands were ran under the same working directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions