Repository navigation
Commit 3899801
authored
fix: normalize ICP2d's returned transform to exact orthonormality (#204)
## Summary
- \`ICP2d\`'s final \`T\` accumulates ordinary floating-point roundoff
through the loop's repeated \`T = T @ new_T\` composition. Traced this
on a real scan-matching case (RTB's \`PoseGraph.scanmatch\`, killian
dataset): deviation from orthonormality grows monotonically from ~1e-16
at iteration 1 to ~7.3e-15 after 15 iterations -- just over
\`ishom2()\`'s \`20*eps ≈ 4.44e-15\` tolerance.
- When that check fails, downstream \`SE2(T)\` construction doesn't
raise -- \`arghandler()\` returns \`False\` and execution falls through
to the branch meant for \`[x, y, theta]\`-style list/tuple arguments,
since a (3,3) array also satisfies \`len(x) == 3\`. This produces a
confusing \`TypeError: only 0-dimensional arrays can be converted to
Python scalars\` deep in \`math.cos()\`, nowhere near the real problem.
(That fallthrough behavior is a separate, pre-existing \`SE2.__init__\`
issue -- not addressed in this PR, flagging it here for visibility.)
- Fix: normalize the returned \`T\` with \`trnorm2()\` before returning,
which is exactly the situation its own docstring describes ("prevent
finite word length arithmetic causing transforms to become
'unnormalized'").
## Test plan
- [x] \`pytest tests/base/test_transforms2d.py\` -- 20 passed
- [x] New \`test_icp2d_returns_valid_se2\` (seed fixed for determinism)
confirmed to fail against the pre-fix implementation and pass with the
fix
- [x] Verified \`RTB\`'s \`PoseGraph.scanmatch(100, 101)\` on the real
killian.g2o lidar dataset, which surfaced this, now runs end-to-end1 parent 7a54cda commit 3899801
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
1315 | | - | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
1316 | 1320 | | |
1317 | 1321 | | |
1318 | 1322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
| |||
0 commit comments