Annotating ROS occupancy grid maps
After a few hours of SLAM tuning you have a beautiful occupancy grid. Now you need to put it in a paper, a report, or a presentation, with the planned route drawn on it, the target poses labelled, the no-go zones shaded. This is what drawtonomy’s ROS map import is for.
What drawtonomy does with .pgm + .yaml
Section titled “What drawtonomy does with .pgm + .yaml”drawtonomy reads a ROS map pair (.pgm image + .yaml metadata) and:
- Places the occupancy grid on the canvas at the correct metric scale.
- Uses the
resolutionandoriginfields from the YAML so world coordinates round-trip. - Lets you draw lanes, intersections, vehicles, pedestrians, traffic lights, and free-form arrows / text on top.
The drawing layer is a separate set of shapes; the original .pgm is never modified.
Why annotate the grid at all
Section titled “Why annotate the grid at all”- Paper figures. “Figure 3: nav2 planning around obstacles.” A bare occupancy grid is barely legible; a grid with planned routes and target poses tells the story.
- Internal docs. A SLAM map annotated with no-go zones, charging-dock locations, and named subareas is the kind of artifact that survives team turnover.
- Lecture material. When teaching nav2 or AMCL, an annotated grid lets students see what the planner sees.
- Bug reproducers. “Robot got stuck here, here is the grid, here is the planned path that fails.”
The drawtonomy workflow
Section titled “The drawtonomy workflow”- Import. Import → ROS map. Drop both
.pgmand.yaml(or zip them together). - Verify scale. The yaml’s
resolutionandoriginare applied automatically. The drawtonomy ruler shows metres. - Annotate. Use Lane, Vehicle, Path, Polygon, and Text shapes. The Polygon tool with low opacity works well for shading no-go zones.
- Save as
.drawtonomy.svg(drawtonomy’s native SVG format). Annotations on a SLAM map are almost never one-shot — new no-go zones get added, named subareas change, the map itself sometimes gets re-recorded..drawtonomy.svgreopens with every annotation in place, so iteration is an edit instead of a redraw. - Export for distribution. From the same scene, export PNG for documentation that doesn’t need scalable vectors, or a flat SVG (with the grid as a raster background and your annotations as vectors) for papers and slides.
A few rendering tips
Section titled “A few rendering tips”- Use a single accent color for the annotation layer. Multiple colors on top of a grayscale grid create visual noise.
- Add a scale bar manually with a Linestring and a Text shape — drawtonomy doesn’t auto-render one, but the rulers tell you exactly how many metres a given length is.
Limits
Section titled “Limits”- Drawtonomy is not a replacement for
nav2’smap_serverediting tools (CLI utilities to crop / inflate / rotate the grid). For those, stay in the ROS toolchain. - The annotation layer is drawtonomy-native; keep the
.drawtonomy.svgfile as the source of truth, and export a flat SVG only when you need the annotation geometry in another tool.
See the Import ROS occupancy grid guide for the import details.