Skip to content

Commit

Permalink
Remove problematic loops from TestNonLinearOptimizationObjectPoint
Browse files Browse the repository at this point in the history
Summary:
A few tests in this class follow a similar pattern:
1. Generate random ground truth object points.
2. Create two or more camera poses that can see all the ground truth points.
3. For each ground truth object point, create an imperfect one by randomly perturbing it.
4. If an imperfect point is not visible by one of the poses, discard it and create a new random perturbation of the ground truth.

Since there is no theoretical bound to the number of tries it can take to successfully generate an imperfect point, this approach means that it's possible to run out of time or random tries before completing even one iteration. This would either result in hitting `ocean_assert(iterations != 0u)` or (if not a debug build), a skipped test reporting as succeeded.

This change modifies these tests to guarantee that at least one iteration will complete. This is accomplished by changing the procedure as follows:
1. Generate random ground truth object points
2. For each ground truth object point, create an imperfect one by randomly perturbing it.
3. Create two or more camera poses that can see all object points, both ground truth and imperfect.

By including the imperfect points in the bounding volume ahead of time, we remove the need to regenerate them. Since the random perturbations are small, the change to the bounding volume should be minimal in all cases except possibly the corner cases that were causing the timeouts.

Reviewed By: enpe

Differential Revision:
D64914443

Privacy Context Container: L1191897

fbshipit-source-id: 754344b0dd16f36f1f0a9b987bf306bc273bfa92
  • Loading branch information
thorntondr authored and facebook-github-bot committed Oct 29, 2024
1 parent baef1c7 commit e7130ec
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{
"id": "testgeometry",
"test-directory": "impl/ocean/test/testgeometry",
"ctest-args": "-E TestStereoscopicGeometry.CameraPose_6DOF_100|TestNonLinearOptimizationObjectPoint.NonLinearOptimizationOrientationalPosesObjectPoints_20Poses_20Points_Outliers_NoNoise|TestNonLinearOptimizationObjectPoint.NonLinearOptimizationOrientationalPosesObjectPoints_20Poses_20Points_NoOutliers_NoNoise|TestNonLinearOptimizationObjectPoint.NonLinearOptimizationOrientationalPosesObjectPoints_20Poses_20Points_Outliers_Noise",
"ctest-args": "-E TestStereoscopicGeometry.CameraPose_6DOF_100",
"paths": [
"impl/ocean/test/testgeometry/**",
"impl/ocean/geometry/**"
Expand Down
Loading

0 comments on commit e7130ec

Please sign in to comment.