Skip to content

Commit 8818b41

Browse files
committed
inject noise to avoid local minima for error-free case
1 parent 0189436 commit 8818b41

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

glomap/estimators/global_rotation_averaging.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ double RelAngleError(double angle_12, double angle_1, double angle_2) {
1616

1717
while (est < -EIGEN_PI) est += TWO_PI;
1818

19+
// Inject random noise if the angle is too close to the boundary to break the
20+
// possible balance at the local minima
21+
if (est > EIGEN_PI - 0.01 || est < -EIGEN_PI + 0.01) {
22+
if (est < 0)
23+
est += (rand() % 1000) / 1000.0 * 0.01;
24+
else
25+
est -= (rand() % 1000) / 1000.0 * 0.01;
26+
}
27+
1928
return est;
2029
}
2130
} // namespace

0 commit comments

Comments
 (0)