30 using namespace gtsam;
39 int main(
int argc,
char* argv[]) {
41 params->setAccelerometerCovariance(I_3x3 * 0.1);
42 params->setGyroscopeCovariance(I_3x3 * 0.1);
43 params->setIntegrationCovariance(I_3x3 * 0.1);
44 params->setUse2ndOrderCoriolis(
false);
51 const Point3 up(0, 0, 1), target(0, 0, 0);
58 double angular_velocity =
M_PI,
60 Vector3 angular_velocity_vector(0, -angular_velocity, 0);
61 Vector3 linear_velocity_vector(radius * angular_velocity, 0, 0);
63 linear_velocity_vector, pose_0);
77 auto noise = noiseModel::Diagonal::Sigmas(
78 (
Vector(6) << Vector3::Constant(0.1), Vector3::Constant(0.3)).finished());
83 auto biasnoise = noiseModel::Diagonal::Sigmas(Vector6::Constant(0.1));
86 auto velnoise = noiseModel::Diagonal::Sigmas(
Vector3(0.1, 0.1, 0.1));
89 n_velocity << 0, angular_velocity * radius, 0;
90 newgraph.
addPrior(
V(0), n_velocity, velnoise);
92 initialEstimate.
insert(
V(0), n_velocity);
98 for (
size_t i = 0;
i < 36; ++
i) {
99 double t =
i * delta_t;
102 initialEstimate.
insert(
X(0), pose_0.compose(delta));
103 initialEstimate.
insert(
X(1), pose_1.compose(delta));
106 initialEstimate.
insert(
X(
i), pose_i.compose(delta));
116 covvec << 0.1, 0.1, 0.1, 0.1, 0.1, 0.1;
117 auto cov = noiseModel::Diagonal::Variances(covvec);
118 auto f = std::make_shared<BetweenFactor<imuBias::ConstantBias> >(
131 newgraph.
add(imufac);
134 initialEstimate.
insert(
V(
i), n_velocity);
139 isam.
update(newgraph, initialEstimate);
142 initialEstimate.
clear();
Simple class to test navigation scenarios.
void integrateMeasurement(const Vector3 &measuredAcc, const Vector3 &measuredOmega, const double dt) override
virtual ISAM2Result update(const NonlinearFactorGraph &newFactors=NonlinearFactorGraph(), const Values &newTheta=Values(), const FactorIndices &removeFactorIndices=FactorIndices(), const std::optional< FastMap< Key, int > > &constrainedKeys={}, const std::optional< FastList< Key > > &noRelinKeys={}, const std::optional< FastList< Key > > &extraReelimKeys={}, bool force_relinearize=false)
Vector3 omega_b(double t) const override
angular velocity in body frame
Rot3 rotation(double t) const
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
static const SmartProjectionParams params
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
Base class for all pinhole cameras.
Pose3 pose(double t) const override
pose at time t
const Pose3 & pose() const
return pose, constant version
Incremental update functionality (ISAM2) for BayesTree, with fluid relinearization.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
NonlinearISAM isam(relinearizeInterval)
static const Vector3 measuredAcc
ConstantTwistScenario scenario(Z_3x1, Vector3(v, 0, 0))
static const Vector3 measuredOmega(w, 0, 0)
void insert(Key j, const Value &val)
static const CalibratedCamera camera(kDefaultPose)
Point3 position(const NavState &X, OptionalJacobian< 3, 9 > H)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
void resetIntegration() override
Re-initialize PreintegratedIMUMeasurements.
int main(int argc, char *argv[])
Matrix3 transpose() const
std::uint64_t Key
Integer nonlinear key type.
Vector3 acceleration_b(double t) const
Values calculateEstimate() const
The most common 5DOF 3D->2D calibration.