* Test that error does give the right result when it is zero. /* ************************************************************************* */
| 45 | * Test that error does give the right result when it is zero. |
| 46 | /* ************************************************************************* */ |
| 47 | TEST(testGeneralParallelPlaneRegularBasicFactor, ErrorIsZero) { |
| 48 | /// Plane keys. |
| 49 | Key plane_key_1(1); |
| 50 | Key plane_key_2(2); |
| 51 | |
| 52 | /// Noise model for cosntraint between the two planes. |
| 53 | noiseModel::Diagonal::shared_ptr parallel_plane_noise = |
| 54 | noiseModel::Diagonal::Sigmas(Vector3(0.1, 0.1, 0.1)); |
| 55 | |
| 56 | /// Measured distance between plane. |
| 57 | double measured_distance_from_plane2_to_plane1 = 0.8; |
| 58 | |
| 59 | /// GeneralParallelism constraint between Plane 1 and Plane 2. |
| 60 | GeneralParallelPlaneRegularBasicFactor factor( |
| 61 | plane_key_1, plane_key_2, parallel_plane_noise, |
| 62 | measured_distance_from_plane2_to_plane1); |
| 63 | |
| 64 | /// Planes. |
| 65 | OrientedPlane3 plane_1(0.1, 0.1, 0.9, 0.9); |
| 66 | OrientedPlane3 plane_2(0.1, 0.1, 0.9, 0.1); |
| 67 | |
| 68 | /// Calculate error. |
| 69 | Vector error = factor.evaluateError(plane_1, plane_2); |
| 70 | |
| 71 | /// Expected error. |
| 72 | Vector4 expected_error = Vector4::Constant(0.0); |
| 73 | |
| 74 | EXPECT_TRUE(gtsam::assert_equal(expected_error, error, tol)); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Test that error does give the right result when it is not zero. |
nothing calls this directly
no test coverage detected