This guide defines a practical, repeatable workflow for debugging SVG maps when rendered geometry and parser behavior diverge.
Robot SF currently parses SVG paths with regex-based waypoint extraction. Some
SVG path commands (for example H, V, curves, relative commands) can look
correct in an editor but produce unexpected waypoints at runtime.
-
Fast text inspection
- Check map labels and route ids:
rg -n "ped_route|robot_route|spawn_zone|goal_zone|obstacle" maps/svg_maps/<map>.svg
-
Structural/semantic inspection (new helper)
- Single map:
uv run python scripts/validation/svg_inspect.py maps/svg_maps/<map>.svg --show-routes- Batch map family:
uv run python scripts/validation/svg_inspect.py maps/svg_maps --pattern "classic_*.svg" --strict warning
-
JSON report for tooling or PR artifacts
uv run python scripts/validation/svg_inspect.py maps/svg_maps --json output/validation/svg_inspection.json
-
Existing map verification (complements this tool)
uv run python scripts/validation/verify_maps.py --scope all --mode local
-
Visual editor pass
- Open SVG in Inkscape to inspect route nodes, labels, and obstacle overlap.
-
Lock behavior with tests
- Add or update tests under
tests/maps/andtests/test_svg_classic_maps_format.py.
- Add or update tests under
- Route-only mode detection:
- routes present but corresponding spawn/goal rectangles absent
- Route index consistency:
- route labels pointing to out-of-range zone indices
- Obstacle-interior crossing:
- route line crosses obstacle interior (
crosses/within)
- route line crosses obstacle interior (
- Risky path commands for parser:
H/V, curves (C/Q/S/T/A), and relative commands (m/l/...)
robot_sf.maps.verification.svg_inspection:- Reusable report API used by the CLI helper.
xml.etree.ElementTree:- Raw SVG attribute and path command extraction.
shapely:- Route-vs-obstacle geometry checks.
- Optional external tools for deeper visual/debug workflows:
svgpathtoolsfor full SVG path evaluation and resampling.cairosvgfor deterministic raster exports (SVG -> PNG/PDF) in CI artifacts.lxmlfor advanced XML querying/transform pipelines.
- Benchmark/canonical maps should prefer explicit spawn/goal zones.
- Route-only maps are supported for rapid prototyping, but validate with
svg_inspect.pybefore training or benchmark runs.