In get_D function
Code: Select all
.
.
.
// update state
pid->last_input = input;
pid->lastderivative = pid->derivative;
// add in derivative component
return pid_param->kD * pid->derivative;
}
get_D is called one time per axis in the navmodes.
But they will share pid->last_input & pid->lastderivative ....
Each axis should have a own set of "Last state" parameters.
I think this can cause problems in the calculations.