Skip to content

Make Ransac_4Dof real RANSAC and init GPS only on its inliers - #133

Open
woosik2510 wants to merge 1 commit into
masterfrom
feat/gps-ransac
Open

woosik2510 wants to merge 1 commit into
masterfrom
feat/gps-ransac

Conversation

@woosik2510

Copy link
Copy Markdown
Collaborator

Bring mins/src/update/gps/ under unit test, and straighten out what the tests expose.

# Scope Status
1/7 WGS-84 geodetic conversions (ECEF, ENU, composition) shipped #105
2/7 4-DOF solvers: solve_quartic, solve_QCQP, compute_RBtoA1Dof, compute_4Dof shipped #106
3/7 fix the 4-DOF return contract, split Align_4Dof out of the hypothesis loop shipped #107
4/7 collapse the QCQP to w = (A^T b).normalized(), delete solve_quartic shipped #112
5/7 class MathGPS (statics only) to free functions in a namespace shipped #115
6/7 simulate GPS outliers shipped #116
7/7 make Ransac_4Dof actually RANSAC, tested against those outliers THIS PR

Summary

Ransac_4Dof wasn't RANSAC. Every hypothesis fit all the fixes, the rng was re-seeded on every call so every shuffle was the same, the call site asked for 1 hypothesis, and the best fit was never refit on its inliers. So one bad fix in the init window went straight into T_WtoE.

Now:

  • each hypothesis is fit to 2 random fixes (the minimum that pins yaw + translation), 100 hypotheses, rng seeded once per call so runs repeat
  • the best hypothesis is refit on its inliers, and inliers are flagged again against the refit
  • it fails unless more than half the fixes are inliers
  • it returns the inlier mask, and try_initialization builds the init system from the inliers only. Rejected fixes still get dropped from data_stack, so they don't come back through the update either
  • inlier threshold is 10 sigma of the first fix, was 100 sigma. 10 sigma leaves room for VIO drift over the init window

count_inliers and get_random_subset are replaced by find_inliers.

Verification

gps_wtoe sim scenario from calibration.yml (rotated true T_WtoE, GPS init from about 6 fixes), 20 seeds, with #116's gps_outlier at rate 0.1, magnitude 50 m. Error of the T_WtoE init:

outliers off: yaw / pos, median (max) outliers on: yaw / pos, median (max)
master 0.113 deg (0.529) / 0.126 m (0.219) 0.167 deg (125.6) / 0.175 m (52.0)
this PR 0.115 deg (0.527) / 0.126 m (0.219) 0.089 deg (0.527) / 0.122 m (0.219)

On master, 7 of 20 seeds had an outlier in the init window, and each of those was off by 7 to 126 deg and 7 to 52 m. With this PR all 7 drop their outliers (1 of 6 fixes five times, 2 of 6 once, 5 of 11 once) and land with the clean runs. With outliers off nothing is rejected and the numbers only move in the last digit.

  • test_MathGPS 21/21: new RansacRecoversTheTransformDespiteOutliers (two 50 m outliers, Align_4Dof ends up over 1 m off, RANSAC is exact and flags exactly those two). The no-inlier test became RansacReportsFailureWhenMostCorrespondencesAreOutliers (2 of 6 bad passes, 3 of 6 fails).
  • test_UpdaterGPS 24/24: new LeavesAnOutlierFixOutAndStillDropsItFromTheQueue. It fails if construct_init_linsys is handed all the fixes instead of the inliers.
  • ctest 10/10.

KAIST not run locally. The tighter threshold could leave real KAIST fixes out of the init, so ICGLW may move. IC, ICW, IL and ILW have no GPS and should be bit-identical.

Chain

Chains off PR 6/7 (#116). Last in the chain.
Not in this PR: the GPS update chi2 gate (still 9999, since a plain gate locks out after a few rejections) and the x10 noise inflation at init.

@github-actions

Copy link
Copy Markdown

Unit Test Results

Test Cases Result Duration
test_WheelTypes 7/7 ✅ Passed 0.00s

10/10 test binaries passed, 148/148 cases

@github-actions

Copy link
Copy Markdown

Unit Test Code Coverage

Area master this branch
update/cam 0.0% 0.0% (0/623)
update/gps 92.0% 91.8% (472/514) -0.2
update/lidar 61.8% 61.8% (1097/1775)
update/vicon 98.9% 98.9% (86/87)
update/wheel 98.9% 98.9% (527/533)
update 38.8% 38.8% (31/80)
state 49.2% 49.2% (699/1422)
init 0.0% 0.0% (0/704)
options 48.3% 48.1% (366/761) -0.3
core 0.0% 0.0% (0/962)
sim 0.0% 0.0% (0/1094)
utils 11.6% 11.6% (68/587)
other 41.1% 41.1% (387/941)

Overall 37.0% (3733/10083) across mins/src, master is 37.0%.

Full HTML report is in the coverage-report artifact of this run.

@github-actions

Copy link
Copy Markdown

Simulation regression report - master vs PR

8 seeds/config, sim UD_Warehouse, informational only (does not block merge).
Delta is PR relative to master (mean). Lower is better for RMSE / Time; NEES closer to ~1-3 is well-calibrated.

full
Metric master PR Delta (mean)
RMSE ori (deg) 0.165 +/- 0.038 0.165 +/- 0.038 +0.0%
RMSE pos (m) 0.052 +/- 0.009 0.052 +/- 0.009 +0.0%
NEES ori 3.400 +/- 1.300 3.400 +/- 1.300 +0.0%
NEES pos 2.700 +/- 0.700 2.700 +/- 0.600 +0.0%
Time (s) 23.600 +/- 0.200 23.500 +/- 0.100 -0.4%
stereo_gps
Metric master PR Delta (mean)
RMSE ori (deg) 0.158 +/- 0.033 0.158 +/- 0.033 +0.0%
RMSE pos (m) 0.076 +/- 0.012 0.076 +/- 0.012 +0.0%
NEES ori 4.400 +/- 2.100 4.400 +/- 2.100 +0.0%
NEES pos 3.800 +/- 1.200 3.800 +/- 1.200 +0.0%
Time (s) 14.200 +/- 0.100 14.200 +/- 0.100 +0.0%
vicon
Metric master PR Delta (mean)
RMSE ori (deg) 0.148 +/- 0.005 0.148 +/- 0.005 +0.0%
RMSE pos (m) 0.008 +/- 0.000 0.008 +/- 0.000 +0.0%
NEES ori 4.200 +/- 0.200 4.200 +/- 0.200 +0.0%
NEES pos 4.200 +/- 0.200 4.200 +/- 0.200 +0.0%
Time (s) 0.500 +/- 0.000 0.500 +/- 0.000 +0.0%
vicon_lidar
Metric master PR Delta (mean)
RMSE ori (deg) 0.132 +/- 0.005 0.132 +/- 0.005 +0.0%
RMSE pos (m) 0.008 +/- 0.000 0.008 +/- 0.000 +0.0%
NEES ori 3.900 +/- 0.300 3.900 +/- 0.300 +0.0%
NEES pos 4.100 +/- 0.200 4.100 +/- 0.200 +0.0%
Time (s) 8.300 +/- 0.000 8.300 +/- 0.000 +0.0%
vio_stereo
Metric master PR Delta (mean)
RMSE ori (deg) 0.174 +/- 0.036 0.174 +/- 0.036 +0.0%
RMSE pos (m) 0.111 +/- 0.032 0.111 +/- 0.032 +0.0%
NEES ori 2.000 +/- 0.900 2.000 +/- 0.900 +0.0%
NEES pos 12.600 +/- 16.500 12.600 +/- 16.500 +0.0%
Time (s) 14.100 +/- 0.100 14.100 +/- 0.100 +0.0%
wheel_2d_ang
Metric master PR Delta (mean)
RMSE ori (deg) 0.129 +/- 0.004 0.129 +/- 0.004 +0.0%
RMSE pos (m) 0.007 +/- 0.000 0.007 +/- 0.000 +0.0%
NEES ori 3.900 +/- 0.300 3.900 +/- 0.300 +0.0%
NEES pos 4.000 +/- 0.200 4.000 +/- 0.200 +0.0%
Time (s) 0.400 +/- 0.000 0.400 +/- 0.000 +0.0%
wheel_2d_cen
Metric master PR Delta (mean)
RMSE ori (deg) 0.129 +/- 0.004 0.129 +/- 0.004 +0.0%
RMSE pos (m) 0.007 +/- 0.000 0.007 +/- 0.000 +0.0%
NEES ori 3.800 +/- 0.300 3.800 +/- 0.300 +0.0%
NEES pos 4.100 +/- 0.200 4.100 +/- 0.200 +0.0%
Time (s) 0.700 +/- 0.000 0.700 +/- 0.000 +0.0%
wheel_2d_lin
Metric master PR Delta (mean)
RMSE ori (deg) 0.130 +/- 0.005 0.130 +/- 0.005 +0.0%
RMSE pos (m) 0.007 +/- 0.000 0.007 +/- 0.000 +0.0%
NEES ori 3.900 +/- 0.300 3.900 +/- 0.300 +0.0%
NEES pos 4.000 +/- 0.300 4.000 +/- 0.300 +0.0%
Time (s) 0.700 +/- 0.000 0.700 +/- 0.000 +0.0%
wheel_3d_ang
Metric master PR Delta (mean)
RMSE ori (deg) 0.113 +/- 0.004 0.113 +/- 0.004 +0.0%
RMSE pos (m) 0.006 +/- 0.000 0.006 +/- 0.000 +0.0%
NEES ori 3.700 +/- 0.200 3.700 +/- 0.200 +0.0%
NEES pos 3.700 +/- 0.200 3.700 +/- 0.200 +0.0%
Time (s) 0.600 +/- 0.000 0.600 +/- 0.000 +0.0%
wheel_3d_cen
Metric master PR Delta (mean)
RMSE ori (deg) 0.115 +/- 0.004 0.115 +/- 0.004 +0.0%
RMSE pos (m) 0.006 +/- 0.000 0.006 +/- 0.000 +0.0%
NEES ori 3.900 +/- 0.200 3.900 +/- 0.200 +0.0%
NEES pos 3.900 +/- 0.200 3.900 +/- 0.200 +0.0%
Time (s) 0.400 +/- 0.000 0.400 +/- 0.000 +0.0%
wheel_3d_lin
Metric master PR Delta (mean)
RMSE ori (deg) 0.114 +/- 0.004 0.114 +/- 0.004 +0.0%
RMSE pos (m) 0.006 +/- 0.000 0.006 +/- 0.000 +0.0%
NEES ori 3.800 +/- 0.200 3.800 +/- 0.200 +0.0%
NEES pos 3.800 +/- 0.200 3.800 +/- 0.200 +0.0%
Time (s) 0.700 +/- 0.000 0.700 +/- 0.000 +0.0%

@github-actions

Copy link
Copy Markdown

Calibration Convergence Report

10 seeds · sim UD_Warehouse · informational only (does not block merge).

Scenario Parameters ±3σ
Camera Time Offset 1/1 params ✅
Camera Extrinsic (IMU↔Cam) 6/6 params ✅
Camera Intrinsics 8/8 params ✅
GPS Time Offset 1/1 params ✅
GPS Extrinsic (IMU↔GPS) 3/3 params ✅
GPS World-to-ENU Init (one-shot) 4/4 params ✅
LiDAR Time Offset 1/1 params ✅
LiDAR Extrinsic (IMU↔LiDAR) 6/6 params ✅
Vicon Time Offset 1/1 params ✅
Vicon Extrinsic (IMU↔Vicon) 6/6 params ✅
Wheel Time Offset 1/1 params ✅
Wheel Extrinsic (IMU↔Wheel) 6/6 params ✅
Wheel Intrinsics (Wheel2DAng) 3/3 params ✅
Wheel Intrinsics (Wheel3DAng) 3/3 params ✅
Per-parameter details

✅ Camera Time Offset

Parameter final abs error final σ ±3σ
time offset (s) 0.000179 0.00015 ✅

✅ Camera Extrinsic (IMU↔Cam)

Parameter final abs error final σ ±3σ
φ_x (rad) 0.00015 0.000271 ✅
φ_y (rad) 6.79e-05 0.000287 ✅
φ_z (rad) 0.000162 0.000268 ✅
p_x (m) 0.00314 0.00382 ✅
p_y (m) 0.00489 0.0049 ✅
p_z (m) 0.0039 0.00348 ✅

✅ Camera Intrinsics

Parameter final abs error final σ ±3σ
fu (px) 0.109 0.0788 ✅
fv (px) 0.115 0.0998 ✅
cu (px) 0.085 0.0998 ✅
cv (px) 0.0855 0.102 ✅
k₁ 0.000165 0.000196 ✅
k₂ 0.000104 0.000131 ✅
p₁ 2.43e-05 3.69e-05 ✅
p₂ 3.16e-05 2.35e-05 ✅

✅ GPS Time Offset

Parameter final abs error final σ ±3σ
time offset (s) 0.0031 0.00235 ✅

✅ GPS Extrinsic (IMU↔GPS)

Parameter final abs error final σ ±3σ
p_x (m) 0.0132 0.0229 ✅
p_y (m) 0.0216 0.0233 ✅
p_z (m) 0.0238 0.0237 ✅

✅ GPS World-to-ENU Init (one-shot)

Parameter final abs error final σ ±3σ
yaw (rad) 0.00225 0.0421 ✅
p_x (m) 0.025 1.01 ✅
p_y (m) 0.0881 0.574 ✅
p_z (m) 0.0723 0.413 ✅

✅ LiDAR Time Offset

Parameter final abs error final σ ±3σ
time offset (s) 0.000839 0.000187 ✅

✅ LiDAR Extrinsic (IMU↔LiDAR)

Parameter final abs error final σ ±3σ
φ_x (rad) 0.000539 0.000328 ✅
φ_y (rad) 0.000287 0.000315 ✅
φ_z (rad) 0.000254 0.000374 ✅
p_x (m) 0.00333 0.00556 ✅
p_y (m) 0.00568 0.00585 ✅
p_z (m) 0.00659 0.00836 ✅

✅ Vicon Time Offset

Parameter final abs error final σ ±3σ
time offset (s) 0.000105 0.000148 ✅

✅ Vicon Extrinsic (IMU↔Vicon)

Parameter final abs error final σ ±3σ
φ_x (rad) 0.000155 0.000546 ✅
φ_y (rad) 0.000295 0.000535 ✅
φ_z (rad) 0.000384 0.000576 ✅
p_x (m) 0.00313 0.00908 ✅
p_y (m) 0.00442 0.00919 ✅
p_z (m) 0.00327 0.00981 ✅

✅ Wheel Time Offset

Parameter final abs error final σ ±3σ
time offset (s) 8.74e-05 0.000212 ✅

✅ Wheel Extrinsic (IMU↔Wheel)

Parameter final abs error final σ ±3σ
φ_x (rad) 0.00413 0.00207 ✅
φ_y (rad) 0.000256 0.000346 ✅
φ_z (rad) 0.000184 0.00036 ✅
p_x (m) 0.000521 0.0023 ✅
p_y (m) 0.000627 0.00216 ✅
p_z (m) 0.0204 0.0237 ✅

✅ Wheel Intrinsics (Wheel2DAng)

Parameter final abs error final σ ±3σ
left radius (m) 1.42e-05 2.59e-05 ✅
right radius (m) 1.34e-05 2.59e-05 ✅
baseline (m) 0.000641 0.000938 ✅

✅ Wheel Intrinsics (Wheel3DAng)

Parameter final abs error final σ ±3σ
left radius (m) 1.51e-05 8.43e-05 ✅
right radius (m) 1.29e-05 8.5e-05 ✅
baseline (m) 0.00072 0.00209 ✅

cam_dt

cam_ext

cam_int

gps_dt

gps_ext

gps_wtoe

lidar_dt

lidar_ext

vicon_dt

vicon_ext

wheel_dt

wheel_ext

wheel_int_2d_ang

wheel_int_3d_ang

@github-actions

Copy link
Copy Markdown

KAIST Urban vs MINS paper Table 6 (SE3 ATE per GT km)

Mean m/km over the sequences where the paper, master and PR all have a full-length result.

config seq paper master pr
IC 11 2.65 3.02 3.02
ICW 22 7.43 7.12 7.12
IL 11 4.48 4.52 4.52
ILW 22 5.47 6.38 6.38
ICGLW 22 1.64 1.12 1.12
  • = no result in the paper (and none here), fail = no trajectory, * = run ended early, >1000 = diverged. Green = PR better than master, grey = same, red = worse.
config row 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
km   3.9   3.0   3.2   3.7   3.4   3.4   4.2   2.5   4.0   5.2  11.2   3.6   5.4  11.3   7.1   7.4   7.9   3.2   9.0  11.7  11.2  10.7
IC paper     -     -     -     -     -     -     -     -  2.04  2.86  1.45  3.43  3.50  5.39  4.69  1.98  1.47     -     -     -  1.13  1.17
master     -     -     -     -     -     -     -     -  1.61  2.45  1.21  4.65  2.82  9.00  4.22  2.90  2.63     -     -     -  0.73  1.04
pr     -     -     -     -     -     -     -     - 1.61 2.45 1.21 4.65 2.82 9.00 4.22 2.90 2.63     -     -     - 0.73 1.04
ICW paper  7.13  8.74  8.24  8.47  9.16  7.10  8.17 10.73  1.57  3.85  1.10  3.16  2.03 29.79  4.15  2.46  2.43  8.15 16.47 18.50  0.94  1.23
master  8.57  8.99  8.55  9.46  9.72  7.56  8.52 10.54  2.43  2.54  1.24  5.67  3.20 16.12  6.35  2.99  2.40  8.36 14.54 16.97  1.20  0.81
pr 8.57 8.99 8.55 9.46 9.72 7.56 8.52 10.54 2.43 2.54 1.24 5.67 3.20 16.12 6.35 2.99 2.40 8.36 14.54 16.97 1.20 0.81
IL paper     -     -     -     -     -     -     -     -  2.69  2.97  2.53  3.96  6.21  5.11  5.68  9.18  5.30     -     -     -  3.50  2.17
master     -     -     -     -     -     -     -     -  2.17  3.24  2.53  4.10  6.13  6.53  5.99  8.90  4.86     -     -     -  3.04  2.17
pr     -     -     -     -     -     -     -     - 2.17 3.24 2.53 4.10 6.13 6.53 5.99 8.90 4.86     -     -     - 3.04 2.17
ILW paper  6.96  8.11  4.20  2.99  6.90  4.24  6.85  3.76  2.24  4.15  2.71  4.39  5.47  5.01  4.73  7.92  7.86  6.13 12.01  7.96  3.24  2.50
master  9.46 12.83  3.85  3.56 13.86  3.61  5.82  9.87  2.49  4.37  2.89  4.44  6.40  5.37  5.25  8.43  6.85  6.21 12.13  6.61  3.11  2.83
pr 9.46 12.83 3.85 3.56 13.86 3.61 5.82 9.87 2.49 4.37 2.89 4.44 6.40 5.37 5.25 8.43 6.85 6.21 12.13 6.61 3.11 2.83
ICGLW paper  1.52  3.46  0.85  0.79  1.49  1.38  1.85  3.44  1.06  1.72  0.79  2.58  1.83  0.70  0.77  1.16  0.94  5.46  2.38  0.60  0.64  0.56
master  1.42  0.76  0.24  0.42  0.55  0.72  1.17  2.81  0.92  1.74  0.79  2.52  1.82  0.58  0.65  1.19  0.46  1.80  2.26  0.52  0.62  0.59
pr 1.41 0.76 0.24 0.42 0.55 0.72 1.17 2.80 0.92 1.74 0.79 2.56 1.82 0.58 0.65 1.18 0.46 1.76 2.26 0.52 0.62 0.59

Trajectories bit-identical to master: 66 of 88

  • urban18 pr_ICGLW differs
  • urban19 pr_ICGLW differs
  • urban20 pr_ICGLW differs
  • urban21 pr_ICGLW differs
  • urban22 pr_ICGLW differs
  • urban23 pr_ICGLW differs
  • urban24 pr_ICGLW differs
  • urban25 pr_ICGLW differs
  • urban26 pr_ICGLW differs
  • urban27 pr_ICGLW differs
  • urban28 pr_ICGLW differs
  • urban29 pr_ICGLW differs
  • urban30 pr_ICGLW differs
  • urban31 pr_ICGLW differs
  • urban32 pr_ICGLW differs
  • urban33 pr_ICGLW differs
  • urban34 pr_ICGLW differs
  • urban35 pr_ICGLW differs
  • urban36 pr_ICGLW differs
  • urban37 pr_ICGLW differs
  • urban38 pr_ICGLW differs
  • urban39 pr_ICGLW differs

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.

1 participant