11 using namespace gtsam;
16 const double tol=1
e-5;
18 const double g = 9.81,
l = 1.0;
20 const double deg2rad =
M_PI/180.0;
21 double q1(deg2rad*30.0), q2(deg2rad*31.0);
22 double v1(deg2rad*1.0/h),
v2((
v1-h*g/
l*
sin(q1)));
27 TEST( testPendulumFactor1, evaluateError) {
36 TEST( testPendulumFactor2, evaluateError) {
45 TEST( testPendulumFactorPk, evaluateError) {
49 double pk( 1/h * (q2-q1) + h*g*
sin(q1) );
56 TEST( testPendulumFactorPk1, evaluateError) {
60 double pk1( 1/h * (q2-q1) );
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Jet< T, N > sin(const Jet< T, N > &f)
void g(const string &key, int i)
static const Line3 l(Rot3(), 1, 1)
Vector evaluateError(const double &pk1, const double &qk, const double &qk1, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
Vector evaluateError(const double &vk1, const double &vk, const double &q, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
#define EXPECT(condition)
Three-way factors for the pendulum dynamics as in [Stern06siggraph] for (1) explicit Euler method...
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Vector evaluateError(const double &qk1, const double &qk, const double &v, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
TEST(SmartFactorBase, Pinhole)
Vector evaluateError(const double &pk, const double &qk, const double &qk1, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override