Go to the documentation of this file.
26 using namespace gtsam;
39 Point2 x_initial(0.0, 0.0);
56 Point2 expected1(1.0, 0.0);
57 Point2 expected2(2.0, 0.0);
58 Point2 expected3(3.0, 0.0);
106 using Base::evaluateError;
119 G << 1.0, 0.0, 0.0, 1.0;
120 w << 1.0, 0.0, 0.0, 1.0;
123 Q_ =
w*
w.transpose();
133 double x = x_t0.x() * x_t0.x();
134 double y = x_t0.x() * x_t0.y();
161 std::cout <<
s <<
": NonlinearMotionModel\n";
162 std::cout <<
" TestKey1: " << keyFormatter(key<1>()) << std::endl;
163 std::cout <<
" TestKey2: " << keyFormatter(key<2>()) << std::endl;
168 const This *
e =
dynamic_cast<const This*
> (&
f);
169 return (
e !=
nullptr) && (key<1>() ==
e->key<1>()) && (key<2>() ==
e->key<2>());
178 return 0.5 *
w.dot(
w);
182 size_t dim()
const override {
188 return QInvSqrt(
c.at<
Point2>(key<1>()))*unwhitenedError(
c);
199 const X1&
x1 =
c.at<
X1>(key<1>());
200 const X2&
x2 =
c.at<
X2>(key<2>());
204 std::dynamic_pointer_cast<noiseModel::Constrained>(this->noiseModel_);
205 if (constrained.get() !=
nullptr) {
207 A2,
b, constrained));
231 *H2 = Matrix::Identity(dim(),dim());
234 return (
p2 - prediction);
253 using Base::evaluateError;
258 Base(noiseModel::Unit::Create(
z.
size()), TestKey), z_(
z), R_(1,1) {
275 z_hat(0) = 2*x_t1.x()*x_t1.x() - x_t1.x()*x_t1.y() - 2.5*x_t1.x() + 7*x_t1.y();
283 H(0,0) = 4*x_t1.x() - x_t1.y() - 2.5;
284 H(0,1) = -1*x_t1.x() + 7;
297 std::cout <<
s <<
": NonlinearMeasurementModel\n";
298 std::cout <<
" TestKey: " << keyFormatter(
key()) << std::endl;
303 const This *
e =
dynamic_cast<const This*
> (&
f);
304 return (
e !=
nullptr) && Base::equals(
f);
313 return 0.5 *
w.dot(
w);
317 size_t dim()
const override {
323 return RInvSqrt(
c.at<
Point2>(
key()))*unwhitenedError(
c);
337 std::dynamic_pointer_cast<noiseModel::Constrained>(this->noiseModel_);
338 if (constrained.get() !=
nullptr) {
369 Point2 expected_predict[10];
370 Point2 expected_update[10];
371 expected_predict[0] =
Point2(0.81,0.99);
372 expected_update[0] =
Point2(0.824926197027,0.29509808);
373 expected_predict[1] =
Point2(0.680503230541,0.24343413);
374 expected_update[1] =
Point2(0.773360464065,0.43518355);
375 expected_predict[2] =
Point2(0.598086407378,0.33655375);
376 expected_update[2] =
Point2(0.908781566884,0.60766713);
377 expected_predict[3] =
Point2(0.825883936308,0.55223668);
378 expected_update[3] =
Point2(1.23221370495,0.74372849);
379 expected_predict[4] =
Point2(1.51835061468,0.91643243);
380 expected_update[4] =
Point2(1.32823362774,0.855855);
381 expected_predict[5] =
Point2(1.76420456986,1.1367754);
382 expected_update[5] =
Point2(1.36378040243,1.0623832);
383 expected_predict[6] =
Point2(1.85989698605,1.4488574);
384 expected_update[6] =
Point2(1.24068063304,1.3431964);
385 expected_predict[7] =
Point2(1.53928843321,1.6664778);
386 expected_update[7] =
Point2(1.04229257957,1.4856408);
387 expected_predict[8] =
Point2(1.08637382142,1.5484724);
388 expected_update[8] =
Point2(1.13201933157,1.5795507);
389 expected_predict[9] =
Point2(1.28146776705,1.7880819);
390 expected_update[9] =
Point2(1.22159588179,1.7434982);
406 Point2 x_initial(0.90, 1.10);
413 Point2 x_predict(0,0), x_update(0,0);
414 for(
unsigned int i = 0;
i < 10; ++
i){
417 x_predict = ekf.
predict(motionFactor);
421 x_update = ekf.
update(measurementFactor);
static int runAllTests(TestResult &result)
NonlinearMotionModel(const Symbol &TestKey1, const Symbol &TestKey2)
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
Vector evaluateError(const Point2 &p, OptionalMatrixType H1) const override
~NonlinearMotionModel() override
Matrix QInvSqrt(const Point2 &x_t0) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define EXPECT(condition)
Vector h(const Point2 &x_t1) const
NoiseModelFactorN< Point2 > Base
NonlinearMeasurementModel()
Matrix inverse_square_root(const Matrix &A)
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 x
Point2 f(const Point2 &x_t0) const
std::shared_ptr< GaussianFactor > linearize(const Values &c) const override
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
bool equals(const NonlinearFactor &f, double tol=1e-9) const override
static shared_ptr Sigmas(const Vector &sigmas, bool smart=true)
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Matrix F(const Point2 &x_t0) const
NonlinearMeasurementModel(const Symbol &TestKey, Vector z)
Matrix H(const Point2 &x_t1) const
T update(const NoiseModelFactor &measurementFactor)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
double error(const Values &c) const override
std::shared_ptr< This > shared_ptr
shared_ptr to this class
static shared_ptr Create(size_t dim)
noiseModel::Diagonal::shared_ptr SharedDiagonal
Vector whitenedError(const Values &c) const
NonlinearMotionModel This
NoiseModelFactorN< Point2, Point2 > Base
Vector whitenedError(const Values &c) const
double error(const Values &c) const override
NonlinearMeasurementModel This
T predict(const NoiseModelFactor &motionFactor)
const gtsam::Symbol key('X', 0)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Non-linear factor base classes.
The quaternion class used to represent 3D orientations and rotations.
Class to perform generic Kalman Filtering using nonlinear factor graphs.
TEST(SmartFactorBase, Pinhole)
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
JacobiRotation< float > G
static noiseModel::Diagonal::shared_ptr Diagonal(const Matrix &covariance)
Matrix RInvSqrt(const Point2 &x_t0) const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
~NonlinearMeasurementModel() override
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Matrix * OptionalMatrixType
size_t dim() const override
size_t dim() const override
typename std::tuple_element< I - 1, std::tuple< ValueTypes... > >::type ValueType
Vector evaluateError(const Point2 &p1, const Point2 &p2, OptionalMatrixType H1, OptionalMatrixType H2) const override
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
Rot2 R(Rot2::fromAngle(0.1))
std::shared_ptr< GaussianFactor > linearize(const Values &c) const override
bool equals(const NonlinearFactor &f, double tol=1e-9) const override
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:26