Skip to content

Keep One Map Over Time

A long-term map store keeps the mapping sessions of one place. Each new session finds itself in the stored map without an initial pose, is added to it, and can remove what has gone. The store exports one Autoware map bundle (pointcloud_map/, map_projector_info.yaml) from all its sessions. It runs without ROS 2 (pip install lidarslam).

The store is experimental. The results below are from NCLT (one campus, 20 sessions over fourteen months); the long-term mapping plan has every check and its preregistered rule.

Start a store

The first session creates the store:

python -m lidarslam live first.bag --out run1 --store STORE \
  --odometry-params ODOMETRY.yaml --backend-params BACKEND.yaml

live plays the log as a live session and adds the session to STORE when it finishes.

Add a session

python -m lidarslam live later.bag --out run2 --store STORE \
  --odometry-params ODOMETRY.yaml --backend-params BACKEND.yaml \
  --relocalize-anywhere --detect-changes
  • --relocalize-anywhere searches the whole store for where the session is, for as long as it runs, so the session can start anywhere. --start-near-first-submap (search within 5 m of the first stored submap) and --initial-pose are the alternatives when the start is known.
  • --detect-changes traces the session's scans through the stored map and removes old points it sees through. --refine-visibility also holds back new points seen only briefly and is the recommended change mode (Review Map Updates).

A session that never anchors is still written, in its own frame, but the export of a store needs one common frame.

Heights are fitted to the store

Odometry drifts in height, and an anchor transform fitted at the start can leave a session tilted or offset by a metre or more further on. Before an anchored session is committed, live compares its submap heights with the stored sessions where their paths overlap (within 1.5 m) and, by default:

  1. fits a roll, pitch and height offset to the session (--no-tilt-correction turns it off);
  2. fits a height offset along the session, every 30 submaps (--no-height-profile turns it off);
  3. refuses the session if the remaining height difference is above 1.5 m at the 95th percentile (--max-height-drift M; 0 turns the check off). A refused session stays uncommitted.

Each step needs at least 20 compared submaps, so a session that overlaps the store only briefly is added at its anchor transform, unchecked. The change evidence is traced where the session is finally placed, after these corrections.

On NCLT, the corrections brought the height consistency of the 20-session store to 0.11 m (the median over sessions of the 95th percentile of the height difference), and on sessions the chain had not used they cut the median from 0.21 m (tilt only) to 0.11 m. Tracing the change evidence after the corrections cut the removed voxels that a later session still sees from 22% to 17%.

Several robots

Robots can update one store at the same time: every change of store.json holds a lock (store.lock) and reads the list again first, so no commit is lost. Each robot localizes in, fits its heights to and traces its changes through the sessions committed when it started, not those of the robots running beside it; a session committed meanwhile is recorded in its entry as concurrent_with. On NCLT, three robots added at once matched, within 0.002 m of height consistency, the same three added one after another. The lock is a POSIX flock on the store directory, so the robots must share one file system (not a network share without locking).

Robots on their own computers share a store through a map server:

Three robots sharing a store through the map server

python -m lidarslam serve STORE --host 0.0.0.0 --port 8770      # on the server

python -m lidarslam live robot.bag --out run --store MIRROR \
  --map-server http://SERVER:8770 \
  --odometry-params ODOMETRY.yaml --backend-params BACKEND.yaml \
  --relocalize-anywhere --detect-changes                          # on each robot

Each robot pulls the committed sessions it lacks into its mirror, maps the session against them, and pushes it back; the server commits it (with concurrent_with) and rebuilds the bundle. GET /map/cells?x=&y=&r= lists the bundle's 20 m cells around a position and GET /map/pointcloud_map/<cell>.pcd fetches one. The server has no authentication: serve it on a trusted network. On NCLT, three robots through the server committed sessions byte-identical to the same three sharing a store directory.

Measure how far surfaces moved (experimental)

What moved in fourteen months on NCLT

python -m lidarslam store displacement STORE --from 0003 --to 0017 --out displacement

Measures how far the surfaces of one session moved by another, along the surface normal (M3C2), after re-aligning the later session tile by tile (ICP). It writes displacement.pcd (each core point with its displacement, level of detection and whether it is significant), summary.json, and cells.csv (fill and cut volumes per 5 m cell, from upward-facing surfaces). Foliage is left out.

Read median_lod_m in summary.json first: a displacement is significant only above its level of detection, which depends on how well the two sessions were mapped. On NCLT it was 0.05-0.12 m for most pairs of sessions and about 0.23 m with a session that had drifted; moved patches were recovered to within 0.03 m in most cases. A movement that covers a whole 30 m tile is taken as misalignment and removed.

The volumes count significant displacements only (small holes in a surface are filled from their neighbours). On NCLT, ground raised or lowered by four to nine times the run's level of detection came out 5-16% short of its true volume; by one to three times it, 18-49% short. Read them for changes several times the level of detection, as a lower bound for smaller ones.

Inspect, export, undo

python -m lidarslam store info STORE         # the committed sessions
python -m lidarslam store export STORE       # the Autoware bundle in STORE/export
python -m lidarslam store rollback STORE     # take the latest session off the map

Sessions are append-only; a rollback leaves the session's files in place. What a session changed can be reviewed and edited, by a person or an agent, before it is used: Review Map Updates.

Limits

  • The change evidence makes mistakes. On NCLT, 17-19% of the removals a later session decided were kept by it. Most are removals decided closest to the rule, and some are real changes: an older session still sees what a newer one removed.
  • A brief overlap is neither corrected nor checked. Below 20 compared submaps the height fits and the height check do not run. NCLT 2012-04-29 (14 submaps) needed no correction, but a session that drifts in a brief overlap goes in as it is.
  • Map-quality metrics do not show the corrections. The corrected store's entropy is slightly lower and more of it is planar, but its plane patches are thicker on average, so the preregistered comparison was mixed.
  • A brief visit may not anchor. --relocalize-anywhere anchors once two searches agree on a verified place. A session that is in the store only for a short while may not give them: on NCLT, 2012-04-29, which is in a new store for a few seconds and then for its last 20 s, did not anchor in real time, and 2012-02-12 anchored only at the end of its first 17 s visit. The search itself is fast enough at the shipped Scan Context gate (the median search takes 0.05-2.3 s per session in real time).
  • A second site. On Oxford Spires (handheld), with stacked levels kept apart, the six Christ Church sessions went into one store with a height consistency of 0.11-0.16 m each; at the Bodleian Library the second session overlapped the first too little to be corrected and is 0.4 m off in height (the checks).
  • Stacked levels. Where the store has passed both under and over a place, the height check and fits compare with the nearest stored level (heights more than 2 m apart), so a session that drifts by about a floor height onto another level would be taken as on it. Comparing with the median of both levels had refused a session on the upper one (Oxford Spires, Christ Church 03).