Go to the documentation of this file.
39 using namespace std::placeholders;
41 using namespace gtsam;
56 const Vector3& biasHat,
const list<Vector3>& measuredOmegas,
57 const list<double>& deltaTs) {
60 list<Vector3>::const_iterator itOmega = measuredOmegas.begin();
61 list<double>::const_iterator itDeltaT = deltaTs.begin();
62 for (; itOmega != measuredOmegas.end(); ++itOmega, ++itDeltaT) {
63 result.integrateMeasurement(*itOmega, *itDeltaT);
80 Rot3 expectedDeltaR1 = Rot3::Roll(0.5 *
M_PI / 100.0);
94 Rot3 expectedDeltaR2 = Rot3::Roll(2.0 * 0.5 *
M_PI / 100.0);
106 Matrix3 gyroscopeCovariance = I_3x3 * 0.4;
107 Vector3 omegaCoriolis(0.1, 0.5, 0.9);
111 double deltaTij = 0.02;
112 Matrix3 delRdelBiasOmega = I_3x3 * 0.5;
113 Matrix3 preintMeasCov = I_3x3 * 0.2;
115 std::make_shared<PreintegratedRotationParams>(
params),
bias, deltaTij,
116 deltaRij, delRdelBiasOmega, preintMeasCov);
146 Vector3 errorExpected(0, 0, 0);
174 Vector3 errorExpected(0, 0, 0);
195 auto f = [&](
const Vector3& biasOmega) {
200 Matrix expectedH = numericalDerivative11<Rot3, Vector3>(
f, biasOmega);
205 Matrix3 actualH = -Jr *
deltaT;
217 auto f = [thetaHat](
const Vector3 deltaTheta) {
224 Matrix expectedH = numericalDerivative11<Vector3, Vector3>(
f, deltaTheta);
228 double norm =
x.norm();
229 const Matrix3 actualH =
231 (1 / (norm * norm) - (1 +
cos(norm)) / (2 * norm *
sin(norm))) *
X *
X;
253 Matrix3 delRdelBiasOmega =
256 const Matrix expectedRot =
260 const Matrix3 hatRot =
262 const Matrix3 actualRot =
263 hatRot *
Rot3::Expmap(delRdelBiasOmega * deltaBiasOmega).matrix();
277 list<Vector3> measuredOmegas;
278 list<double> deltaTs;
279 measuredOmegas.push_back(
Vector3(
M_PI / 100.0, 0.0, 0.0));
280 deltaTs.push_back(0.01);
281 measuredOmegas.push_back(
Vector3(
M_PI / 100.0, 0.0, 0.0));
282 deltaTs.push_back(0.01);
283 for (
int i = 1;
i < 100;
i++) {
284 measuredOmegas.push_back(
286 deltaTs.push_back(0.01);
298 Matrix expectedDelRdelBias = numericalDerivative11<Rot3, Vector3>(
f,
bias);
299 Matrix expectedDelRdelBiasOmega = expectedDelRdelBias.rightCols(3);
315 omegaCoriolis << 0, 0.1, 0.1;
319 auto p = std::make_shared<PreintegratedAhrsMeasurements::Params>();
348 for (
int i = 0;
i < 1000; ++
i) {
352 Matrix expectedMeasCov(3, 3);
360 Rot3 expectedRot = Rot3::Ypr(20 *
M_PI, 0, 0);
365 Matrix expectedH = numericalDerivative11<Vector3, Vector3>(
376 Rot3 Ri(Rot3::RzRyRx(0, 0, 0));
377 Rot3 Rj(Rot3::RzRyRx(0,
M_PI / 4, 0));
393 for (
size_t i = 0;
i < 5; ++
i) {
405 Rot3 expectedRot(Rot3::RzRyRx(0,
M_PI / 4, 0));
413 int numRotations = 10;
414 const Vector3 noiseBetweenBiasSigma(3.0
e-6, 3.0
e-6, 3.0
e-6);
415 SharedDiagonal biasNoiseModel = Diagonal::Sigmas(noiseBetweenBiasSigma);
418 const double omega = 0.1;
420 const Vector3 realBias(1, 2, 3);
423 auto p = std::make_shared<PreintegratedAhrsMeasurements::Params>();
425 p->gyroscopeCovariance = 1
e-8 * I_3x3;
429 const Vector3 priorNoisePoseSigmas(0.001, 0.001, 0.001);
430 const Vector3 priorNoiseBiasSigmas(0.5
e-1, 0.5
e-1, 0.5
e-1);
431 SharedDiagonal priorNoisePose = Diagonal::Sigmas(priorNoisePoseSigmas);
432 SharedDiagonal priorNoiseBias = Diagonal::Sigmas(priorNoiseBiasSigmas);
449 const Vector3 zeroBias(0, 0, 0);
450 for (
int i = 1;
i < numRotations;
i++) {
452 for (
int j = 0;
j < 200; ++
j)
474 for (
int i = 0;
i < numRotations;
i++) {
static int runAllTests(TestResult &result)
static Rot3 predict(const Rot3 &rot_i, const Vector3 &bias, const PreintegratedAhrsMeasurements &pim, const Vector3 &omegaCoriolis, const std::optional< Pose3 > &body_P_sensor={})
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
virtual const Values & optimize()
Linear Factor Graph where all factors are Gaussians.
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
#define EXPECT_CORRECT_FACTOR_JACOBIANS(factor, values, numerical_derivative_step, tolerance)
Check the Jacobians produced by a factor against finite differences.
const Matrix3 & delRdelBiasOmega() const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Jet< T, N > sin(const Jet< T, N > &f)
#define EXPECT(condition)
std::shared_ptr< Base > shared_ptr
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
const Rot3 & deltaRij() const
const Matrix3 kMeasuredOmegaCovariance
const Vector3 & biasHat() 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 x
const Vector3 bias(1, 2, 3)
void integrateMeasurements(const vector< ImuMeasurement > &measurements, PIM *pim)
static const SmartProjectionParams params
Parameters for Levenberg-Marquardt trust-region scheme.
static Pose3 body_P_sensor(Rot3::RzRyRx(-M_PI_2, 0.0, -M_PI_2), Point3(0.25, -0.10, 1.0))
Matrix3 skewSymmetric(double wx, double wy, double wz)
Vector3 predict(const Vector3 &bias, OptionalJacobian< 3, 3 > H={}) const
Vector evaluateError(const Rot3 &rot_i, const Rot3 &rot_j, const Vector3 &bias, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
vector of errors
Jet< T, N > cos(const Jet< T, N > &f)
Provides additional testing facilities for common data structures.
static const double deltaT
std::optional< Vector3 > getOmegaCoriolis() const
Pose2_ Expmap(const Vector3_ &xi)
const ValueType at(Key j) const
Some functions to compute numerical derivatives.
const Matrix3 & getGyroscopeCovariance() const
const Vector3 measuredOmega
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
#define DOUBLES_EQUAL(expected, actual, threshold)
noiseModel::Diagonal::shared_ptr SharedDiagonal
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
Evaluate derivatives of a nonlinear factor numerically.
void insert(Key j, const Vector &value)
noiseModel::Diagonal::shared_ptr model
void integrateMeasurement(const Vector3 &measuredOmega, double deltaT)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
const double & deltaTij() const
const Matrix3 & preintMeasCov() const
A class for computing marginals in a NonlinearFactorGraph.
Vector3 kZeroOmegaCoriolis(0, 0, 0)
Factor Graph consisting of non-linear factors.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
T compose(const T &t1, const T &t2)
static noiseModel::Diagonal::shared_ptr Diagonal(const Matrix &covariance)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
NonlinearFactorGraph graph
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
TEST(AHRSFactor, PreintegratedAhrsMeasurements)
Rot2 R(Rot2::fromAngle(0.1))
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:10