26 using namespace gtsam;
38 *Hpose = Hvel__rot * Hrot__pose;
48 : measured_velocity_(measured_wheel_speed, 0, 0) {}
57 const Vector3 scaled_velocity = (vscale + 1.0) * measured_velocity_;
59 *
H = measured_velocity_;
61 return scaled_velocity;
69 TEST(ExpressionTesting, Issue16) {
70 const double tol = 1
e-4;
71 const double numerical_step = 1
e-3;
78 const auto pose_key =
Symbol(
'x', 1);
79 const auto vel_key =
Symbol(
'v', 1);
80 const auto scale_key =
Symbol(
's', 1);
85 values.
insert<
double>(scale_key, 0);
92 const auto err_expr = body_vel - scaled_measured_vel;
94 const auto err = err_expr.
value(values);
98 "ScaleAndCompare", err_expr, values, numerical_step, tol));
bool testExpressionJacobians(const std::string &name_, const gtsam::Expression< T > &expression, const gtsam::Values &values, double nd_step, double tolerance)
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
static int runAllTests(TestResult &result)
Expression< double > Double_
void insert(Key j, const Value &val)
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from world to rotated frame
Vector3 operator()(double vscale, OptionalJacobian< 3, 1 > H=boost::none) const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Test harness methods for expressions.
#define EXPECT(condition)
Vector3 measured_velocity_
Array< double, 1, 3 > e(1./3., 0.5, 2.)
ScaledVelocityFunctor(double measured_wheel_speed)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
#define EXPECT_LONGS_EQUAL(expected, actual)
T value(const Values &values, boost::optional< std::vector< Matrix > & > H=boost::none) const
Return value and optional derivatives, reverse AD version Notes: this is not terribly efficient...
TEST(LPInitSolver, InfiniteLoopSingleVar)
Expression< Pose3 > Pose3_
Vector3 bodyVelocity(const Pose3 &w_t_b, const Vector3 &vec_w, OptionalJacobian< 3, 6 > Hpose=boost::none, OptionalJacobian< 3, 3 > Hvel=boost::none)
const Rot3 & rotation(OptionalJacobian< 3, 6 > Hself=boost::none) const
get rotation
Expression< Vector3 > Vector3_