Skip to content

Step 1: stationary segments, merge or skip map update - #688

Merged
JanuszBedkowski merged 2 commits into
MapsHD:mainfrom
michalpelka:mp/stationary-segments
Dec 5, 2026
Merged

JanuszBedkowski merged 2 commits into
MapsHD:mainfrom
michalpelka:mp/stationary-segments

Conversation

@michalpelka

@michalpelka michalpelka commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What

A new option for lidar_odometry_step_1: what to do when the device stands still. stationary_mode is off by default, and the two other values are:

  • merge: LIO stops adding nodes. The whole standstill becomes one node with one fixed pose.
  • skip_map_update: LIO runs as usual on the standstill, but its points stay out of the odometry map.
  1. Detection (before chunking, in compute_step_1, both modes). The stretches at rest come from the accelerometer, using VQF's rest detection with a zero gyroscope input. With the gyroscope, VQF never detects rest on Mandeye IMUs: their gyro bias of 3–4 °/s is over VQF's fixed 2 °/s bias clip.
  2. Which stops count (plan_nodes, both modes). A stretch at rest is handled if it lasts at least stationary_min_duration (10 s) and at least two chunks lie entirely inside it. Chunks only partly at rest, at the edges of the stop, stay ordinary chunks.
  3. merge:
    • Nodes: the chunks inside the stop become one node. Every pose of that node is the same pose: the last optimized pose before the stop.
    • LIO: the node gets no IMU prediction and no optimization. Its points enter the map once. The next node starts with zero velocity.
    • Consistency: its poses are held fixed by a strong prior and are not written back.
    • Output: the node is a scan_lio_N of its own, so the step 2 and step 3 pose graphs and loop closures move the standstill as one rigid body. They need no code change.
  4. skip_map_update: the chunks stay ordinary chunks, with normal LIO and normal consistency. Their points go into neither the map nor points_global, the buffer the map is rebuilt from at the sliding-window reset. Output scans are split as usual.

The rest detection moves from mandeye_raw_data_viewer into core/ (ImuRestDetector in Core/imu_rest_detection.h) and is shared by both tools.

Changes users will notice

  • New option, off by default. It is in Parameters → Stationary segments in the main menu (Off / Merge / Skip map update), and in the parameter panel (non-simple GUI) as a combo box together with the thresholds. New TOML section:
    [stationary_segments]
    stationary_mode = "off"          # "off", "merge" or "skip_map_update"
    stationary_min_duration = 10.0   # [s]
    stationary_rest_min_t = 1.5      # [s]
    stationary_rest_th_acc = 0.5     # [m/s^2]
  • New output file stationary_segments.json in the step 1 output, written only when the mode isn't off. It holds stationary_mode, the detector parameters and, for each segment: t_start, t_end, duration, handled and scan_indices (the scan_lio_N the stop ended up in: one with merge, usually several with skip_map_update). The wiki's File Formats page needs an entry.
  • Raw data viewer: the green "motionless" bands now come from the accelerometer only. Before, they rarely or never showed on IMUs with a large gyro bias.
  • Limitation, by design: this is meant for handheld use. An accelerometer cannot tell rest from motion at constant velocity, or from a steady turn about the vertical axis. With merge, such motion during a "stop" is frozen out. With skip_map_update, LIO still tracks it.

Results unchanged with the option off

With off, the chunking is exactly the old one (plan_nodes with no segments) and no chunk is marked. No default changes. Locally, off on calibration-room/trial-1 gives 0.37 mm ATE against the Linux golden (limit 1 mm).

Test

Two recordings, each run with all three modes. Linux, default parameters otherwise.

  • motionless_continousScanning_0143: handheld, 26 chunks, five stops: 8.6 s (start of the recording, under 10 s so not handled), 11.9 s, 48.1 s, 35.6 s and 22.0 s. No ground truth.
  • calibration-room/trial-1 (HUMANOID-LIO, the CI recording): one 22 s stop at the start, and two short pauses (1.6 s and 2.2 s) that are not handled. Ground truth in trial-1/ground-truth/ground_truth.tum: same 76060 timestamps, compared after a rigid alignment with no scale.
off merge skip_map_update
motionless: wall time 1:23 0:33 1:21
motionless: peak RAM 1.71 GB 1.86 GB 1.12 GB
motionless: scan_lio files 30 12 30
motionless: trajectory length 21.78 m 19.39 m 21.78 m
motionless: per stop, net drift / path walked 2–10 mm / 1.3–7.2 m 2–6 mm / ≤ 0.02 m same as off
calibration room: wall time 4:01 4:17 4:30
calibration room: ATE against ground truth (RMSE / max) 32.2 / 169.9 mm 29.3 / 165.4 mm 32.2 / 169.8 mm
calibration room: RPE over 1 s (translation / rotation) 13.1 mm / 0.197° 12.6 mm / 0.194° 13.1 mm / 0.196°
calibration room: ATE against the Linux golden 0.37 mm 16.4 mm 0.92 mm
  • merge freezes the stops: inside each merged scan, every pose matches the scan's first pose to within 2e-12. On calibration room, it is slightly closer to the ground truth than off.
  • No jump where motion resumes (merge): in the first second after each stop, the pose-to-pose steps are the same as with off, to within 0.6 mm. The large steps there are the real start of motion.
  • skip_map_update changes almost nothing with the default parameters, because the existing code already skips map updates at rest. With ablation_study_use_hierarchical_rgd = true (the default), process_worker_step_update_rgd_after already skips the map update when the chunk moved less than half an indoor bucket since the last update. What this mode adds is keeping the stop out of points_global, which matters only at the sliding-window rebuild (200 m by default). On motionless, the trajectory is identical to off. On calibration room, it differs from pose 52161 on, after the rebuild: 0.33 mm on average, 11 mm at most.
  • Shorter trajectory with merge: without merging, the chunks move around slightly while the device stands still, and that jitter counts as distance.
  • Unit tests: doctest for ImuRestDetector, plan_nodes (with and without merging) and parse_stationary_mode.

Speed over time, per mode

Speed over 0.1 s steps, one panel per mode. Grey: stops that were handled. Hatched: stops under 10 s, not handled.

  • Motionless recording: during the four handled stops, off and skip_map_update creep at 1.9 cm/s on average (8.4 cm/s at most). That adds up to 2.16 m of travel that never happened, nearly all of the 2.4 m difference in trajectory length. With merge, the speed is exactly 0 for each stop.
  • Calibration room: during the initial 12 s stop, off and skip_map_update "move" at about 0.1 m/s, and merge holds still.
  • While walking, the three curves match.

Plot script: https://gist.github.com/michalpelka/399e226fadf5d6e1510e4bb1acaff64d (python3 plot_velocity.py <out.png> <title> <label>=<step1_output_dir> ..., one panel per run; it reads session_poses.mrp, trajectory_lio_N.csv and stationary_segments.json).

Pros and cons of each mode

off (default)

  • Pro: nothing changes; it matches the golden trajectory.
  • Con: while standing still, the poses jitter: 1.3–7.2 m of path walked per stop on the motionless recording, against 2–10 mm of net drift. A stop is many small chunks, so steps 2 and 3 can deform it.

merge

  • Pro: a stop doesn't move at all, with no jitter (path walked ≤ 0.02 m per stop).
  • Pro: the fastest mode: 2.5× faster on the motionless recording (1:23 → 0:33), because the stops skip optimization.
  • Pro: each stop is one rigid scan_lio_N, so the step 2 and step 3 loop closures cannot deform it.
  • Pro: slightly closer to the ground truth on calibration room (ATE 29.3 mm against 32.2 mm, RPE over 1 s 12.6 mm against 13.1 mm).
  • Pro: no jump when motion resumes. The steps in the first second after a stop match off to within 0.6 mm.
  • Con: any motion during a detected stop is frozen out. That covers constant velocity and a slow steady turn about the vertical axis, both of which the accelerometer can't tell from rest. It's meant for handheld use.
  • Con: the trajectory changes against the golden (16.4 mm ATE on calibration room), so it can't become the default without going through CONTRIBUTING.md.
  • Con: a long stop is one scan: all of its points are held in memory at once, and it produces one large LAZ.

skip_map_update

  • Pro: LIO keeps tracking during a stop, so slow motion the accelerometer misses is still followed.
  • Pro: the lowest risk: it stays close to the golden (0.92 mm ATE) and the ground truth (32.2 mm, same as off).
  • Pro: lower peak RAM on the motionless recording (1.12 GB against 1.71 GB).
  • Con: with the default parameters it changes almost nothing, because the hierarchical RGD update already skips map updates at rest (see Test). It only matters at the sliding-window rebuild, or when ablation_study_use_hierarchical_rgd is off.
  • Con: the jitter stays (same path walked as off), there is no speedup, and output scans are split as usual, so steps 2 and 3 can still deform a stop.

Not yet tested: the consistency pass with a mode on (GUI only), a Windows build, and a long stop with merge. During such a stop, all of its points are held in memory at once.

🤖 Generated with Claude Code

michalpelka and others added 2 commits December 4, 2026 15:19
Optional (merge_stationary_segments, off by default). Step 1 finds the
stretches at rest from the accelerometer (VQF's rest detection fed a zero
gyroscope: the Mandeye gyro bias of 3-4 deg/s is over VQF's 2 deg/s bias
clip, so with the gyroscope VQF never detects rest). The whole chunks of a
stretch of at least stationary_min_duration (10 s) become one node:

- every pose of the node is one pose: the last optimized pose before it
- no prediction and no LIO optimization; its points enter the map once
- consistency holds its poses fixed
- it is a scan_lio_N of its own, so steps 2 and 3 move it as one rigid body
- stationary_segments.json in the step 1 output lists the segments

The rest detection moves from mandeye_raw_data_viewer into
core/imu_rest_detection (ImuRestDetector), shared by both tools; the raw
viewer's motionless segments are now from the accelerometer alone too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merge_stationary_segments becomes stationary_mode, a three-way setting:
- off: no rest detection (default)
- merge: as before, one node with one fixed pose per stop
- skip_map_update: odometry runs on the stop as usual, but its points
  stay out of the map and of points_global

stationary_segments.json records the mode, and each segment now has
handled and scan_indices instead of merged and scan_index. The GUI has a
Parameters -> Stationary segments submenu and a combo box in the panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michalpelka michalpelka changed the title Step 1: merge stationary segments into one fixed node Step 1: stationary segments, merge or skip map update Dec 4, 2026
@michalpelka

michalpelka commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Here is a plot of velocity with every mode:

image
  • off, speed jitters and LIOtravels back and fourth, longer trajectory due to jitter.
  • merge - motionless segments are merged together, number of segments is still (LIO is not computed during motionless segments). Faster, shortest trajectory
  • skip-map-update
off merge skip_map_update
LIO nodes, so called WorkerData (chunks of 20 poses) 1502 334 (330 ordinary + 4 merged stops) 1502
Trajectory poses written (one per timestamp) 30040 30040 30040
Distinct poses 30040 6604 30040
scan_lio files 30 12 30

Trajectory given by skip_map_update and merge are the same, only difference is in the map, so do not think this mode is needed. What is more currently (in main) :

  // std::cout << "translation_change: " << translation_change << std::endl;
            if (translation_change < params.in_out_params_indoor.resolution_X * 0.5)
            {
                // std::cout << "skipping update_rgd_hierarchy due to small translation change" << std::endl;
                return true;
            }

And this code is working in default config.

IHMO, there is no point on adding skipping of RGD update since it is already implemented in current code and my code is redudand. Only Merge mode is beneficial (no stretch effect on loop closure).

@michalpelka
michalpelka marked this pull request as ready for review December 5, 2026 01:25
@JanuszBedkowski
JanuszBedkowski merged commit e6c9582 into MapsHD:main Dec 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants