float Pos_cal(void) { float fValue=0.0; float Value=0.0; LR_Add = 64-middle; //LR_Add = 64-(k1+k2)/2; //LR_Sub = k1-k2; Dir_Error[2] = Dir_Error[1]; Dir_Error[1] = Dir_Error[0]; Dir_Error[0] = LR_Add; Dir_Deviation[2] = Dir_Deviation[1]; Dir_Deviation[1] = Dir_Deviation[0]; Dir_Deviation[0] = Dir_Error[0]- Dir_Error[1]; Fuzzy_lishudu(LR_Add,Dir_Deviation[0]); Dir_P = Fuzzy_Kp(0,0); //Dir_I = Fuzzy_Ki(10,1); //Dir_D = Fuzzy_Kd(0,0); Value = LR_Add*Dir_P +Dir_Deviation[0]*Dir_I/100.0+Dir_Error[1]*Dir_D/100.0; fValue=Value; return fValue; } 新手不理解,能不能解释一下,越清楚越好,谢谢
|