Skip to content

Commit

Permalink
Converge IMU faster at higher groundspeed during GPS Rescue
Browse files Browse the repository at this point in the history
  • Loading branch information
ctzsnooze committed Apr 28, 2023
1 parent 34057bf commit 4f3d45e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/flight/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,18 @@ static float imuCalcKpGain(timeUs_t currentTimeUs, bool useAcc, float *gyroAvera
lastArmState = armState;

if (attitudeResetActive) {
ret = ATTITUDE_RESET_KP_GAIN;
ret = ATTITUDE_RESET_KP_GAIN; // 25
} else {
ret = imuRuntimeConfig.dcm_kp;
if (!armState) {
ret = ret * 10.0f; // Scale the kP to generally converge faster when disarmed.
}
ret = imuRuntimeConfig.dcm_kp; // 0.25 (2500/10,000)
#if defined(USE_GPS_RESCUE)
if (FLIGHT_MODE(GPS_RESCUE_MODE)) {
ret *= gpsSol.groundSpeed / 200.0f;
// converge faster generally during a rescue, more quickly the faster the rescue, and slower when moving slowly
}
#endif
if (!armState) {
ret *= 10.0f; // 2.5, 10x faster convergence when disarmed
}
}

return ret;
Expand Down

0 comments on commit 4f3d45e

Please sign in to comment.