29 using namespace gtsam;
36 TEST(TestImuPreintegration, LoadedSimulationData) {
39 vector<ImuMeasurement> imuMeasurements;
41 double accNoiseSigma = 0.001249;
42 double accBiasRwSigma = 0.000106;
43 double gyrNoiseSigma = 0.000208;
44 double gyrBiasRwSigma = 0.000004;
45 double integrationCovariance = 1
e-8;
46 double biasAccOmegaInt = 1
e-5;
48 double gravity = 9.81;
54 while (getline(inputFile, line)) {
55 stringstream
ss(line);
58 while (getline(ss, str,
',')) {
59 results.push_back(atof(str.c_str()));
62 measurement.
dt =
static_cast<size_t>(1e9 * (1 / rate));
63 measurement.
time = results[2];
64 measurement.
I_a_WI = {results[29], results[30], results[31]};
65 measurement.
I_w_WI = {results[17], results[18], results[19]};
66 imuMeasurements.push_back(measurement);
71 auto imuPreintegratedParams =
72 PreintegratedCombinedMeasurements::Params::MakeSharedU(gravity);
73 imuPreintegratedParams->accelerometerCovariance =
74 I_3x3 *
pow(accNoiseSigma, 2);
75 imuPreintegratedParams->biasAccCovariance = I_3x3 *
pow(accBiasRwSigma, 2);
76 imuPreintegratedParams->gyroscopeCovariance = I_3x3 *
pow(gyrNoiseSigma, 2);
77 imuPreintegratedParams->biasOmegaCovariance = I_3x3 *
pow(gyrBiasRwSigma, 2);
78 imuPreintegratedParams->integrationCovariance = I_3x3 * integrationCovariance;
79 imuPreintegratedParams->biasAccOmegaInt = I_6x6 * biasAccOmegaInt;
90 NavState initialNavState(priorPose, priorVelocity);
100 for (
size_t n = 1;
n < imuMeasurements.size();
n++) {
103 imuMeasurements[
n].I_w_WI, 1 / rate);
105 propState = imuPreintegrated.
predict(initialNavState, priorImuBias);
const Point3 & translation(OptionalJacobian< 3, 6 > Hself={}) const
get translation
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
Eigen::Vector3d I_a_WI
Raw acceleration from the IMU (m/s/s)
#define DOUBLES_EQUAL(expected, actual, threshold)
void integrateMeasurement(const Vector3 &measuredAcc, const Vector3 &measuredOmega, const double dt) override
Some functions to compute numerical derivatives.
static Point2 measurement(323.0, 240.0)
Vector3 rpy(OptionalJacobian< 3, 3 > H={}) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static std::stringstream ss
Velocity3 velocity(const NavState &X, OptionalJacobian< 3, 9 > H)
const Velocity3 & velocity(OptionalJacobian< 3, 9 > H={}) const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW size_t dt
Time since the last message of this type (nanoseconds).
TEST(TestImuPreintegration, LoadedSimulationData)
Uses the GTSAM library to perform IMU preintegration on an acceleration input.
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
NavState predict(const NavState &state_i, const imuBias::ConstantBias &bias_i, OptionalJacobian< 9, 9 > H1={}, OptionalJacobian< 9, 6 > H2={}) const
Predict state at time j.
std::map< std::string, Array< float, 1, 8, DontAlign|RowMajor > > results
Eigen::Vector3d I_w_WI
Raw angular velocity from the IMU (rad/s)
size_t time
The type of message (to enable dynamic/static casting).
const Rot3 & rotation(OptionalJacobian< 3, 6 > Hself={}) const
get rotation
Jet< T, N > pow(const Jet< T, N > &f, double g)
Rot3 rotation(const Pose3 &pose, OptionalJacobian< 3, 6 > H)
Contains data from the IMU mesaurements.
Point3 position(const NavState &X, OptionalJacobian< 3, 9 > H)
utility functions for loading datasets