Skip to content

Commit

Permalink
ekf2: always add accel/gyro bias process noise
Browse files Browse the repository at this point in the history
 - continue adding accel/gyro bias process noise even if inhibited
  • Loading branch information
dagar authored and bresch committed Jul 10, 2024
1 parent 419652b commit 223397c
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 131 deletions.
8 changes: 4 additions & 4 deletions src/modules/ekf2/EKF/covariance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,29 @@ void Ekf::predictCovariance(const imuSample &imu_delayed)
// Construct the process noise variance diagonal for those states with a stationary process model
// These are kinematic states and their error growth is controlled separately by the IMU noise variances

// gyro bias: add process noise unless state is inhibited
// gyro bias: add process noise
{
const float gyro_bias_sig = dt * math::constrain(_params.gyro_bias_p_noise, 0.f, 1.f);
const float gyro_bias_process_noise = sq(gyro_bias_sig);

for (unsigned index = 0; index < State::gyro_bias.dof; index++) {
const unsigned i = State::gyro_bias.idx + index;

if (!_gyro_bias_inhibit[index]) {
if (P(i, i) < gyro_var) {
P(i, i) += gyro_bias_process_noise;
}
}
}

// accel bias: add process noise unless state is inhibited
// accel bias: add process noise
{
const float accel_bias_sig = dt * math::constrain(_params.accel_bias_p_noise, 0.f, 1.f);
const float accel_bias_process_noise = sq(accel_bias_sig);

for (unsigned index = 0; index < State::accel_bias.dof; index++) {
const unsigned i = State::accel_bias.idx + index;

if (!_accel_bias_inhibit[index]) {
if (P(i, i) < accel_var(index)) {
P(i, i) += accel_bias_process_noise;
}
}
Expand Down
Loading

0 comments on commit 223397c

Please sign in to comment.