Skip to content

Commit

Permalink
Update flight_imu_unittest.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
ctzsnooze committed Apr 29, 2023
1 parent 273c65d commit b9121e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/flight/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,14 @@ static float imuCalcKpGain(timeUs_t currentTimeUs, bool useAcc, float *gyroAvera
ret = ATTITUDE_RESET_KP_GAIN;
} else {
ret = imuRuntimeConfig.dcm_kp;
#ifdef USE_GPS_RESCUE
if (FLIGHT_MODE(GPS_RESCUE_MODE)) {
ret *= gpsRescueGetDcmKpModifier();
// converge faster if groundspeed differs significantly from velocity to home during fly home phase
// don't converge while climbing or rotating, keep the original IMU information, which in most cases should be OK
// note that if there is significant drift away from nose orientation at the start of the rescue, this always gets locked in
}
#endif
if (!armState) {
ret = ret * 10.0f; // Scale the kP to generally converge faster when disarmed.
}
Expand Down
1 change: 1 addition & 0 deletions src/test/unit/flight_imu_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern "C" {

void imuComputeRotationMatrix(void);
void imuUpdateEulerAngles(void);
void gpsRescueGetDcmKpModifier(void);

extern quaternion q;
extern float rMat[3][3];
Expand Down

0 comments on commit b9121e9

Please sign in to comment.