Files
NODEDC_MISSION_CORE/simulation/urban-mapping/README.md
T
DCCONSTRUCTIONS 69dc566665 feat(research): preserve urban geometry pipelines and qualification suites
Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
2026-10-29 09:10:00 +03:00

151 lines
9.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Urban infrastructure mapping
Independent offline batch module. It renders a bounded Gaussian tile, runs the
pinned Mapillary Mask2Former on perspective views, projects depth-visible ground
observations into a metric atlas, and exports closed XYZ contours as JSON and 3D DXF.
The orthographic view supplies a height reference and visual inspection image;
it is not passed to the street-view semantic model. Model preprocessing is the
original downloaded processor configuration.
## Run on a GPU worker
Requires Linux containers, NVIDIA Container Toolkit, a CUDA-compatible NVIDIA GPU,
Docker Compose with GPU support, and the base CUDA/PyTorch image supplied separately.
Qualified on Worker006 (Windows/WSL Docker, RTX4090). On this worker, use
`DOCKER_BUILDKIT=0 docker compose build mapper`: its BuildKit image exporter
currently fails through a Windows credential helper in SSH sessions; the classic
builder completes from the same versioned Dockerfile without changing host settings. No CPU or Mac inference fallback.
CUDA kernels target Ada (8.9); rebuild with a suitable architecture for another GPU.
Do not schedule alongside a simulation that needs the same GPU.
1. Build `docker compose build mapper` on the worker. The default base image is
`ndc-mission-core-m48t-upstream-parity:1.9.4-cu130`; set `MAPPING_BASE_IMAGE` for a
supplied compatible runtime. The accepted base identity is recorded in qualification.
2. Set `MAPPING_INPUT`, `MAPPING_MODEL`, `MAPPING_OUTPUT` to absolute worker directories.
The first two mounts are read-only. Place the job contract in `MAPPING_OUTPUT/job.json`.
3. Run `docker compose run --rm mapper`. Runtime network is disabled. Model files
must already be downloaded and checksummed; the container does not fetch weights.
4. Run synthetic checks with `docker compose run --rm --entrypoint python3 mapper -m unittest test_mapping`.
5. Publish `urban-map.json` using the existing worker bearer credential to
`POST /api/v1/ai-polygon/worker/worlds/{world_id}/urban-map`.
The API rejects a different world or collider revision. No credentials belong in jobs.
The job uses schema `missioncore.urban-mapping-job/v1`: source PLY filename/SHA-256,
world and collider SHA-256, a rigid `source_to_world` matrix; model repository,
revision and per-file SHA-256; XY bounds; optional cell size (default 0.1 m), halo,
confidence and observation quorum; one vertical orthographic reference plus
perspective cameras with eye/target/up, image size and horizontal field of view.
Use scene-local metres with Z up. This is not a georeferenced GIS dataset.
Bounds are limited to one million cells, 32 views and 2048 pixels per dimension.
Camera placement must be reviewed: an eye inside a building is not a valid survey.
`--stage render|infer|atlas` supports repeatable phases. Every downstream phase checks
camera/source/model identity and input hashes; stale cached frames are rejected.
Source code hashes, output hashes and elapsed time are saved in the final receipt.
Retain the accepted job, receipts and previews outside Git, in simulation qualification.
## Interpretation
The 3D export currently contains ground infrastructure: carriageway, sidewalk,
pedestrian/bicycle areas, curbs, curb cuts, parking and markings. Per-view overlays
also show the model's building, pole and sign classes; these are not surveyed 3D
building footprints or a connected intersection graph. An output format compatible
with XYZ polygon features allows future providers without changing the viewer.
Labels are observations, never route permissions. Gaussian expected depth is
approximate and view-dependent. Occluded, low-confidence and conflicting areas
remain unknown; vectorization preserves holes and does not bridge gaps. Tiny
components below 0.08 square metres are omitted. The 0.1 m cell size is sampling
resolution, not a claim of 10 cm survey accuracy. Crosswalk markings can be confused
with other road markings. Review coverage and contours before route integration.
In planning, the infrastructure toggle is independent of Gaussian/collision layers.
Contours do not enter picking, collision or rover control. Hiding the layer leaves
the original scene and route unchanged. Delete only a map's `latest.json` pointer
to unpublish it; immutable previous versions remain available for rollback.
## Whole-location command and shared storage
The planning header command **Проанализировать инфраструктуру** creates one durable
job for the current world/collider/provider identities. The existing Worker coordinator
reserves the shared GPU using the same admission mechanism as simulation, reads the
verified complete-scene source, and launches two separate bounded containers in order:
Gaussian rendering / Mask2Former survey, then VMA object vectorization. Gaussian Pipeline
remains an independently owned module; no service is merged or restarted for this job.
The input is the existing prepared `state/project-packages/<world-sha>/` directory
(resolved through the worker's shared-cache link). Both stages bind the exact existing
files read-only. No downloads, `copy`, new PLY conversions, or source-scene files are
allowed in the analysis output. Output under `runtime/urban-mapping/jobs/<job-key>/`
contains only request/progress metadata and derived images, atlases and vectors.
Sources and receipts are checksum-verified before use. Repeated identical requests
reuse the job; retries validate and resume completed tile receipts.
The first supported source contract is an already prepared complete-scene PLY plus
its calibrated decoded collider. An imported project that exists only as native SOG
has **not** yet qualified for this command: it must not silently invoke another scene
copy or conversion. Missing shared artifacts are reported as preparation failure.
Native-source reading is a separate provider extension, not a claim of this release.
`whole_scene.py` tiles the complete collider XY bounds, independent of route A/B:
40 m core plus 10 m overlap, 60 m / 1200 px orthographic views, and up to four
800×600 perspective views per tile. The supported envelope is 256 tiles. Camera
candidates come from measured near-horizontal geometry. This is a heuristic survey;
roofs, missing ground and occlusion require inspection. All processed tiles and gaps
are recorded. “Whole-scene” describes the requested extent, not complete recognition.
`vector/whole_vectors.py` runs the pinned VMA models, uses semantic/depth evidence to
admit objects, assigns overlapping polygons to one core tile and clips lines in XYZ.
The final v2 map remains unreviewed and observation-only. It is published only when
world/collider/provider/job identities match; a failed analysis preserves the previous
map. Worker restarts reconcile exactly labelled containers before releasing the GPU.
The planning UI has independent Gaussian and collision switches, one infrastructure
switch, and a memory dropdown. Memory contains accumulated visits/attempts across
runs for a scene/collider/robot revision; the dropdown currently displays the latest
robot configuration's accumulated history. Fresh sensing remains authoritative.
## Contour consolidation
After tile assembly, **Согласование контуров** runs in the vector container.
It reads the original survey in place and retains `urban-map.raw.json` before
publishing `urban-map.json`. `contour-refinement.json` records dropped observation
IDs, overlap removal and individual joins. The map stores source IDs, inferred gap
coordinates, spline knots/control points and runtime library versions. Original
observations remain recoverable; this stage never changes the collider or route
permissions.
The geometric engine is GEOS through pinned Shapely 1.8.5.post1 (STRtree,
intersection/difference and linemerge), NetworkX connected components and SciPy
1.13.1 FITPACK cubic B-splines. There is no custom line-merging implementation.
Application policy restricts inputs to matching classes, compatible endpoint
directions/heights, unambiguous junctions and non-crossing geometry. Default
maximum gaps are 1.25 m for curbs, 0.5 m for lane paint, 0.2 m for stop lines;
gaps over 0.12 m additionally require source alpha/depth and oriented image
contrast. These are provisional metric engineering thresholds, not measurement
accuracy or autonomous-driving tolerances. Large missing sections stay open.
Duplicate overlap uses 0.15 m tolerance. Isolated weak fragments below 1.5 m are
removed only with negative image evidence on observed ground. B-spline fitting
preserves structural corners/endpoints and checks rendered XY Hausdorff deviation
<=0.12 m, height deviation <=0.08 m, length and new intersections. Height inside
an inferred bridge is explicitly labelled endpoint interpolation. Crossing areas
and zebra paint polygons are unchanged. Geometric refinement cannot establish
that every VMA classification is correct; dubious long detections are not erased
just because their image contrast is low.
Alternatives reviewed: GRASS `v.clean`/`v.generalize`, CartAGen smoothing,
momepy COINS and neatnet preprocessing. Their generic network simplification
must not collapse distinct curbs/lanes or remove legitimate dead ends. COINS
also expects non-overlapping input. For this stage the existing GEOS/SciPy
runtime avoids introducing another GIS dependency stack into legacy VMA CUDA.
Primary references:
- https://shapely.readthedocs.io/en/1.8.5/manual.html#shapely.ops.linemerge
- https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splprep.html
- https://grass.osgeo.org/grass-stable/manuals/v.clean.html
- https://cartagen.readthedocs.io/en/latest/manual.html
- https://docs.momepy.org/stable/api/momepy.COINS.html
- https://uscuni.org/neatnet/