-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Manifold instead of LocalParameterization.
Signed-off-by: zjwoody <[email protected]>
- Loading branch information
Showing
8 changed files
with
121 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cartographer/mapping/internal/3d/rotation_parameterization_test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "cartographer/mapping/internal/3d/rotation_parameterization.h" | ||
|
||
#include "ceres/manifold_test_utils.h" | ||
#include "gtest/gtest.h" | ||
|
||
namespace cartographer::mapping { | ||
|
||
template <typename T> | ||
class RotationParameterizationTests : public ::testing::Test {}; | ||
|
||
using TestTypes = | ||
::testing::Types<YawOnlyQuaternionManifold, ConstantYawQuaternionManifold>; | ||
TYPED_TEST_SUITE(RotationParameterizationTests, TestTypes); | ||
|
||
TYPED_TEST(RotationParameterizationTests, ManifoldInvariantsHold) { | ||
const TypeParam manifold; | ||
|
||
constexpr static int kNumTrials = 10; | ||
constexpr static double kTolerance = 1.e-5; | ||
const std::vector<double> delta_magnitutes = {0.0, 1.e-9, 1.e-3, 0.5}; | ||
for (int trial = 0; trial < kNumTrials; ++trial) { | ||
const Eigen::VectorXd x = | ||
Eigen::VectorXd::Random(manifold.AmbientSize()).normalized(); | ||
|
||
for (const double delta_magnitude : delta_magnitutes) { | ||
const Eigen::VectorXd delta = | ||
Eigen::VectorXd::Random(manifold.TangentSize()) * delta_magnitude; | ||
EXPECT_THAT(manifold, ceres::XPlusZeroIsXAt(x, kTolerance)); | ||
EXPECT_THAT(manifold, ceres::XMinusXIsZeroAt(x, kTolerance)); | ||
EXPECT_THAT(manifold, ceres::MinusPlusIsIdentityAt(x, delta, kTolerance)); | ||
const Eigen::VectorXd zero_tangent = | ||
Eigen::VectorXd::Zero(manifold.TangentSize()); | ||
EXPECT_THAT(manifold, | ||
ceres::MinusPlusIsIdentityAt(x, zero_tangent, kTolerance)); | ||
|
||
Eigen::VectorXd y(manifold.AmbientSize()); | ||
ASSERT_TRUE(manifold.Plus(x.data(), delta.data(), y.data())); | ||
EXPECT_THAT(manifold, ceres::PlusMinusIsIdentityAt(x, x, kTolerance)); | ||
EXPECT_THAT(manifold, ceres::PlusMinusIsIdentityAt(x, y, kTolerance)); | ||
EXPECT_THAT(manifold, ceres::HasCorrectPlusJacobianAt(x, kTolerance)); | ||
EXPECT_THAT(manifold, ceres::HasCorrectMinusJacobianAt(x, kTolerance)); | ||
EXPECT_THAT(manifold, | ||
ceres::MinusPlusJacobianIsIdentityAt(x, kTolerance)); | ||
} | ||
} | ||
} | ||
|
||
} // namespace cartographer::mapping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters