From a6bba1dfade88ef05f6097e59bd04e8521407756 Mon Sep 17 00:00:00 2001 From: MichalPelka Date: Sun, 22 Nov 2026 23:00:41 +0100 Subject: [PATCH] Step 1: revert decimation and deg-to-rad fixes, restore v0.106 results Reverts 1ca7648f (#597, "Fix discarded decimation") and 547e517b (#598, "Fix deg to rad"). With the decimation fix, the map buffer is decimated at every sliding-window reset (sliding_window_trajectory_length_threshold, 200 m by default). On the trial-1 recording the trajectory then diverges at the first reset (chunk 56, ~286 s) and runs ~81 m away from the start. v0.106 handles the same data. Measured on trial-1 against v0.106 (session_ini_poses.mri, per chunk): - v0.107: 81.4 m max position difference, diverges - v0.107 without #597: 9.7 mm max, no divergence - v0.107 without #597 and #598: 0.0 mm (identical to v0.106) So no other change between v0.106 and v0.107 affects the trajectory. The deg-to-rad fix is reverted as well so results match v0.106 exactly; it should come back together with a validated decimation change. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0158FTTFdaEUtjG7Jvj6EGip --- .../lidar_odometry_utils_optimizers.cpp | 21 ++++++++++++------- .../points_global_spill.h | 1 - 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/lidar_odometry_step_1/lidar_odometry_utils_optimizers.cpp b/apps/lidar_odometry_step_1/lidar_odometry_utils_optimizers.cpp index 7b9efa82..65703a58 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry_utils_optimizers.cpp +++ b/apps/lidar_odometry_step_1/lidar_odometry_utils_optimizers.cpp @@ -1365,12 +1365,18 @@ void optimize_lidar_odometry( ir + 1, ir + 1, 1.0 / (lidar_odometry_motion_model_fix_origin_y_1_sigma_m * lidar_odometry_motion_model_fix_origin_y_1_sigma_m)); tripletListP.emplace_back( ir + 2, ir + 2, 1.0 / (lidar_odometry_motion_model_fix_origin_z_1_sigma_m * lidar_odometry_motion_model_fix_origin_z_1_sigma_m)); - const double sigma_fix_origin_om = lidar_odometry_motion_model_fix_origin_om_1_sigma_deg * DEG_TO_RAD; - const double sigma_fix_origin_fi = lidar_odometry_motion_model_fix_origin_fi_1_sigma_deg * DEG_TO_RAD; - const double sigma_fix_origin_ka = lidar_odometry_motion_model_fix_origin_ka_1_sigma_deg * DEG_TO_RAD; - tripletListP.emplace_back(ir + 3, ir + 3, 1.0 / (sigma_fix_origin_om * sigma_fix_origin_om)); - tripletListP.emplace_back(ir + 4, ir + 4, 1.0 / (sigma_fix_origin_fi * sigma_fix_origin_fi)); - tripletListP.emplace_back(ir + 5, ir + 5, 1.0 / (sigma_fix_origin_ka * sigma_fix_origin_ka)); + tripletListP.emplace_back( + ir + 3, + ir + 3, + 1.0 / (lidar_odometry_motion_model_fix_origin_om_1_sigma_deg * lidar_odometry_motion_model_fix_origin_om_1_sigma_deg)); + tripletListP.emplace_back( + ir + 4, + ir + 4, + 1.0 / (lidar_odometry_motion_model_fix_origin_fi_1_sigma_deg * lidar_odometry_motion_model_fix_origin_fi_1_sigma_deg)); + tripletListP.emplace_back( + ir + 5, + ir + 5, + 1.0 / (lidar_odometry_motion_model_fix_origin_ka_1_sigma_deg * lidar_odometry_motion_model_fix_origin_ka_1_sigma_deg)); tripletListB.emplace_back(ir, 0, 0); tripletListB.emplace_back(ir + 1, 0, 0); @@ -2257,6 +2263,7 @@ bool process_worker_step_update_rgd_after( { acc_distance = 0; std::scoped_lock lock(params.mutex_buckets_indoor, params.mutex_buckets_outdoor); + // the upstream decimate() below discards its result: the buffer is never decimated, so neither is this const Eigen::Vector3d viewport = worker_data.intermediate_trajectory[0].translation(); ++params.buckets_indoor_revision; ++params.buckets_outdoor_revision; @@ -2290,7 +2297,7 @@ bool process_worker_step_update_rgd_after( // decimate if (params.decimation > 0) { - points_global = decimate(points_global, params.decimation, params.decimation, params.decimation); + decimate(points_global, params.decimation, params.decimation, params.decimation); } if (params.ablation_study_use_hierarchical_rgd) diff --git a/apps/lidar_odometry_step_1/points_global_spill.h b/apps/lidar_odometry_step_1/points_global_spill.h index d0066923..c41f98a9 100644 --- a/apps/lidar_odometry_step_1/points_global_spill.h +++ b/apps/lidar_odometry_step_1/points_global_spill.h @@ -14,7 +14,6 @@ //! reset: its second half becomes the new buffer and is folded into the buckets point by point, in order. Kept in a //! file instead of RAM, and streamed back in the same order with the ray-cast decision of its whole size, the buckets //! and so the trajectory are the ones the in-memory buffer gives; the RAM is one chunk. Empty directory = in memory. -//! The exception is params.decimation > 0: the in-memory buffer is decimated at a reset and this one is not, so they differ. //! //! One spill file per compute_step_2 call, owned by a PointsGlobalSpill on that call's stack and reached through //! LidarOdometryParams::points_global_spill: created on entry, its final close checked on success, removed on every exit.