mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
resolved sign mistake by required accel z computing
This commit is contained in:
parent
bbb348575e
commit
1cedc2cb59
1 changed files with 2 additions and 2 deletions
|
@ -77,8 +77,8 @@ static void updateAstaticAccelZController(const pidProfile_t *pidProfile, float
|
|||
{
|
||||
if (pidProfile->afcs_pitch_accel_i_gain != 0) {
|
||||
const float servoVelocityLimit = 100.0f / (pidProfile->afcs_servo_time * 0.001f); // Limit servo velocity %/s
|
||||
float accelReq = pitchPilotCtrl > 0.0f ? (0.1f * pidProfile->afcs_pitch_accel_max - 1.0f) * pitchPilotCtrl * 0.01f + 1.0f
|
||||
: (0.1f * pidProfile->afcs_pitch_accel_min + 1.0f) * pitchPilotCtrl * 0.01f + 1.0f;
|
||||
float accelReq = pitchPilotCtrl < 0.0f ? (1.0f - 0.1f * pidProfile->afcs_pitch_accel_max) * pitchPilotCtrl * 0.01f + 1.0f
|
||||
: -(1.0f + 0.1f * pidProfile->afcs_pitch_accel_min) * pitchPilotCtrl * 0.01f + 1.0f;
|
||||
float accelDelta = accelZ - accelReq;
|
||||
float servoVelocity = accelDelta * (pidProfile->afcs_pitch_accel_i_gain * 0.1f);
|
||||
servoVelocity = constrainf(servoVelocity, -servoVelocityLimit, servoVelocityLimit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue