Skip to content
Snippets Groups Projects
Commit 65aa92df authored by Quirin Apfel's avatar Quirin Apfel
Browse files

regler mit schwellen

parent 596b23bc
No related branches found
No related tags found
No related merge requests found
...@@ -68,22 +68,30 @@ float pi_control(float e) ...@@ -68,22 +68,30 @@ float pi_control(float e)
*/ */
float pid_control(float e) float pid_control(float e)
{ {
float K = 0.8f; float K = 0.4f;
const float T_i = 0.1f;//0.18 const float T_i = 0.1f;//0.18
const float T_d = 0.05; const float T_d = 0.025;
float ee = e;
if(e > 2 || e < -2){ if(e > 10.0 || e < -10.0){
K = 5.0; //K = 2.4;
ee = e*e*e;
/*if(e<0){
ee = -ee;
}*/
} }
if(e > 1.5 || e < -1.5){
K = 100.0;
}
static float e_old = 0; static float e_old = 0;
/*
float ee = e*e; float ee = e*e;
if(e<0){ if(e<0){
ee = -ee; ee = -ee;
} }
*/
sum_error += ee/F_CONTROL; sum_error += e/F_CONTROL;
float derivative = (e - e_old)*F_CONTROL; float derivative = (e - e_old)*F_CONTROL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment