Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/config_sensors.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
/*** Sensor configurations ***
// --- IMU config ---
// imu_gravity_magnitude : Gravity magnitude used for IMU preintegration
// imu_acc_noise : Accelerometer noise
// imu_gyro_noise : Gyroscope noise
// imu_int_noise : Integration noise
Expand Down Expand Up @@ -44,6 +45,7 @@
*/
"sensors": {
// IMU config
"imu_gravity_magnitude": 9.80665,
"imu_acc_noise": 0.05,
"imu_gyro_noise": 0.02,
"imu_int_noise": 0.001,
Expand Down Expand Up @@ -96,4 +98,4 @@
-0.03279627881588615
]
}
}
}
3 changes: 2 additions & 1 deletion include/glim/common/imu_integration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct IMUIntegrationParams {
~IMUIntegrationParams();

bool upright; // If true, +Z = up
double gravity_magnitude; // Gravity magnitude used by GTSAM IMU preintegration
double acc_noise; // Linear acceleration noise
double gyro_noise; // Angular velocity noise
double int_noise; // Integration noise
Expand Down Expand Up @@ -94,4 +95,4 @@ class IMUIntegration {
std::shared_ptr<gtsam::PreintegratedImuMeasurements> imu_measurements;
std::deque<Eigen::Matrix<double, 7, 1>> imu_queue;
};
} // namespace glim
} // namespace glim
5 changes: 3 additions & 2 deletions src/glim/common/imu_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ IMUIntegrationParams::IMUIntegrationParams(const bool upright) {
glim::Config config_sensors(glim::GlobalConfig::get_config_path("config_sensors"));

this->upright = upright;
this->gravity_magnitude = config_sensors.param<double>("sensors", "imu_gravity_magnitude", 9.80665);
this->acc_noise = config_sensors.param<double>("sensors", "imu_acc_noise", 0.01);
this->gyro_noise = config_sensors.param<double>("sensors", "imu_gyro_noise", 0.001);
this->int_noise = config_sensors.param<double>("sensors", "imu_int_noise", 0.001);
Expand All @@ -16,9 +17,9 @@ IMUIntegrationParams::IMUIntegrationParams(const bool upright) {
IMUIntegrationParams::~IMUIntegrationParams() {}

IMUIntegration::IMUIntegration(const IMUIntegrationParams& params) {
auto imu_params = gtsam::PreintegrationParams::MakeSharedU();
auto imu_params = gtsam::PreintegrationParams::MakeSharedU(params.gravity_magnitude);
if (!params.upright) {
imu_params = gtsam::PreintegrationParams::MakeSharedD();
imu_params = gtsam::PreintegrationParams::MakeSharedD(params.gravity_magnitude);
}

imu_params->accelerometerCovariance = gtsam::Matrix3::Identity() * std::pow(params.acc_noise, 2);
Expand Down