43 constexpr
size_t N = 2;
49 TEST(BasisFactors, EvaluationFactor) {
54 auto model = Isotropic::Sigma(1, 1.0);
55 EvaluationFactor<Chebyshev2> factor(
key, measured,
model,
N, 0);
61 functionValues.setZero();
67 parameters.setMaxIterations(20);
75 TEST(BasisFactors, VectorEvaluationFactor) {
81 auto model = Isotropic::Sigma(M, 1.0);
82 VectorEvaluationFactor<Chebyshev2> factor(
key, measured,
model, M,
N, 0);
93 parameters.setMaxIterations(20);
107 auto model = Isotropic::Sigma(M, 1.0);
108 VectorEvaluationFactor<Chebyshev2> factor(
key, measured,
model, M,
N, 0);
112 " noise model: unit (1) \n" 113 "FunctorizedFactor(X0)\n" 117 " noise model sigmas: 1\n";
123 TEST(BasisFactors, VectorComponentFactor) {
127 const double measured = 0.0,
t = 3.0,
a = 2.0,
b = 4.0;
128 auto model = Isotropic::Sigma(1, 1.0);
129 VectorComponentFactor<Chebyshev2> factor(
key, measured,
model, P,
N, i,
t,
a,
141 parameters.setMaxIterations(20);
149 TEST(BasisFactors, ManifoldEvaluationFactor) {
152 const double t = 3.0,
a = 2.0,
b = 4.0;
153 auto model = Isotropic::Sigma(3, 1.0);
154 ManifoldEvaluationFactor<Chebyshev2, Pose2> factor(
key, measured,
model,
N, t,
166 parameters.setMaxIterations(20);
176 TEST(BasisFactors, VecDerivativePrior) {
181 auto model = Isotropic::Sigma(M, 1.0);
182 VectorDerivativeFactor<Chebyshev2> vecDPrior(
key, measured,
model, M,
N, 0);
185 graph.
add(vecDPrior);
193 parameters.setMaxIterations(20);
201 TEST(BasisFactors, ComponentDerivativeFactor) {
206 auto model = Isotropic::Sigma(1, 1.0);
207 ComponentDerivativeFactor<Chebyshev2> controlDPrior(
key, measured,
model, M,
211 graph.
add(controlDPrior);
218 parameters.setMaxIterations(20);
const gtsam::Symbol key('X', 0)
Provides additional testing facilities for common data structures.
Matrix< RealScalar, Dynamic, Dynamic > M
virtual const Values & optimize()
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
bool assert_print_equal(const std::string &expected, const V &actual, const std::string &s="")
noiseModel::Diagonal::shared_ptr model
Factor definitions for various Basis functors.
Evaluate derivatives of a nonlinear factor numerically.
NonlinearFactorGraph graph
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
TEST(BasisFactors, EvaluationFactor)
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
Factor for enforcing the scalar value of the polynomial BASIS representation at x is the same as the ...
Compute an interpolating basis.
#define EXPECT(condition)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Pseudo-spectral parameterization for Chebyshev polynomials of the second kind.
double error(const Values &values) const
static ConjugateGradientParameters parameters
typedef and functions to augment Eigen's VectorXd
std::vector< float > Values
#define EXPECT_CORRECT_FACTOR_JACOBIANS(factor, values, numerical_derivative_step, tolerance)
Check the Jacobians produced by a factor against finite differences.
void insert(Key j, const Value &val)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)