map-formats

Explains ROS 2 occupancy grid map formats including PGM, PNG, and YAML metadata.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill map-formats-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: map-formats
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/map-formats
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill map-formats-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with ROS 2 navigation maps requires understanding how occupancy grids are encoded in image files and YAML metadata. Misinterpreting pixel values, resolution, origin, or the negate flag leads to corrupted maps, phantom obstacles, and broken localization. ## Core Features & Use Cases - Format Reference: Documents the YAML + image pair structure, pixel-to-occupancy encoding, and the trinary, scale, and raw interpretation modes. - Format Selection Guidance: Compares PGM and PNG trade-offs and explains why lossy formats like JPEG corrupt occupancy data. - Practical Workflows: Covers editing maps in GIMP, choosing resolution, interpreting origin coordinates, and handling SLAM Toolbox serialized posegraph files. - Use Case: After running SLAM on a robot, you need to clean up stray artifacts in the saved map and reload it for localization-only mode without breaking the occupancy thresholds. ## Quick Start Ask the assistant to explain how to interpret and edit a ROS 2 map YAML and PGM file for use with Nav2.

Frequently Asked Questions about map-formats

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do ROS 2 map files store occupancy data?

ROS 2 maps pair a YAML metadata file with a grayscale image. Pixel values encode occupancy: black (0) means occupied, light gray (~205) means free, and near-white (~254) means unknown, converted via occ = (255 - p) / 255 when negate is 0.

Should I use PGM or PNG for ROS 2 maps?

PGM is the default uncompressed format with exact pixel values and fast loading, while PNG offers lossless compression at 60-80% smaller size. Both are safe; never use JPEG because lossy compression corrupts occupancy thresholds.

What does the negate field do in a ROS 2 map YAML?

The negate field inverts how pixel brightness maps to occupancy. With negate 0, black pixels are occupied; with negate 1, white pixels are occupied. Most SLAM outputs use the standard negate 0 convention.

How do I edit a ROS 2 map in GIMP?

Open the PGM or PNG in GIMP, ensure grayscale mode, and use the pencil tool with black for walls, light gray for free space, and near-white for unknown. Export via File → Export As with raw PGM encoding or non-interlaced PNG.

What are SLAM Toolbox .posegraph and .data files?

These binary files store the full SLAM pose graph: nodes, edges, covariances, and associated laser scans. They are not human-readable but enable continued mapping and localization-only mode, convertible to standard PGM via the map saver.

What map resolution should I use for indoor robot navigation?

0.05 meters per pixel is the standard for indoor maps, balancing detail and file size. Use 0.025 for high-quality indoor maps or 0.1 for large buildings and outdoor areas.