Skip to content

Commit 21aa2f8

Browse files
committed
Even more stable! Wow!
1 parent 1da9ece commit 21aa2f8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

glider/config/graph_params.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ origin_x: 482990.7375634047
77
origin_y: 4421250.443879729
88
gravity: 9.81
99
bias_num_measurements: 100
10-
gps_noise: 2.5
10+
gps_noise: 2.0
1111
odom_noise: 0.5
12-
heading_noise: 0.5
12+
heading_noise: 0.1
1313
odom_orientation_noise: 0.1
1414
odom_translation_noise: 1.0
1515
odom_scale_noise: 50.0

glider/src/factor_manager.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ FactorManager::FactorManager(const Parameters& params)
3838
last_optimize_time_ = 0.0;
3939
last_imu_time_ = 0.0;
4040
imu_params_ = defaultImuParams(params.gravity);
41+
gravity_vec_ = Eigen::Vector3d(0.0, 0.0, params.gravity);
4142

4243
prior_noise_ = gtsam::noiseModel::Isotropic::Sigma(6, params.gps_noise); // maybe this can be odom noise??
4344
gps_noise_ = gtsam::noiseModel::Isotropic::Sigma(3, params.gps_noise);
@@ -148,8 +149,9 @@ void FactorManager::addGpsFactor(int64_t timestamp, const Eigen::Vector3d& gps)
148149
}
149150

150151
if (key_index_ > 0)
151-
{
152-
std::lock_guard<std::mutex> lock(std::mutex);
152+
{
153+
static std::mutex imu_mutex;
154+
std::unique_lock<std::mutex> lock(imu_mutex);
153155

154156
graph_.add(gtsam::CombinedImuFactor(X(key_index_),
155157
V(key_index_),
@@ -167,6 +169,8 @@ void FactorManager::addGpsFactor(int64_t timestamp, const Eigen::Vector3d& gps)
167169
smoother_timestamps_[X(key_index_)] = timestamp_f;
168170
smoother_timestamps_[V(key_index_)] = timestamp_f;
169171
smoother_timestamps_[B(key_index_)] = timestamp_f;
172+
173+
lock.unlock();
170174
}
171175

172176
gtsam::Rot3 imu_rot = gtsam::Rot3(orient_(0), orient_(1), orient_(2), orient_(3));
@@ -246,7 +250,8 @@ void FactorManager::addImuFactor(int64_t timestamp, const Eigen::Vector3d& accel
246250
double timestamp_f = nanosecInt2Float(timestamp);
247251
gtsam::Quaternion q(orient(0), orient(1), orient(2), orient(3));
248252

249-
std::lock_guard<std::mutex> lock(std::mutex);
253+
static std::mutex imu_mutex;
254+
std::lock_guard<std::mutex> lock(imu_mutex);
250255
//imu_buffer_.add(timestamp_f, accel, gyro, orient);
251256

252257
//Eigen::Vector3d accel_meas = accel;

0 commit comments

Comments
 (0)