mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
finally retain iTerm correctly while moving sticks, but reset at start
This commit is contained in:
parent
0459a4f082
commit
dc77f67c8e
1 changed files with 5 additions and 3 deletions
|
@ -165,7 +165,7 @@ void resetPositionControlParams(void) { // at the start, and while sticks are mo
|
|||
posHold.previousDistancePitch = 0.0f;
|
||||
posHold.previousVelocityPitch = 0.0f;
|
||||
posHold.previousHeading = attitude.values.yaw * 0.1f;
|
||||
if (!posHold.sticksActive) {
|
||||
if (!posHold.isDeceleratingAtStart && !posHold.sticksActive) {
|
||||
posHold.pitchI = 0.0f;
|
||||
posHold.rollI = 0.0f;
|
||||
}
|
||||
|
@ -317,8 +317,10 @@ bool positionControl(void) {
|
|||
// needs to be attenuated towards zero when close to target to avoid overshoot and circling
|
||||
// hence cannot completely eliminate position error due to wind, will tend to end up a little bit down-wind
|
||||
|
||||
posHold.rollI += distanceRoll * positionPidCoeffs.Ki * gpsDataIntervalS;
|
||||
posHold.pitchI += distancePitch * positionPidCoeffs.Ki * gpsDataIntervalS;
|
||||
if (!posHold.isDeceleratingAtStart) {
|
||||
posHold.rollI += distanceRoll * positionPidCoeffs.Ki * gpsDataIntervalS;
|
||||
posHold.pitchI += distancePitch * positionPidCoeffs.Ki * gpsDataIntervalS;
|
||||
}
|
||||
|
||||
// rotate iTerm if heading changes
|
||||
const float currentHeading = attitude.values.yaw * 0.1f; // from tenths of a degree to degrees
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue