2013年K60智能车平衡组国赛代码
2013年K60智能车平衡组国赛代码 void DirectionControlOutput(void) { float fValue; fValue =g_fDirectionControlOutNew-g_fDirectionControlOutOld; //fValue =g_fDirectionControlOutOld-g_fDirectionControlOutOld2; g_fDirectionControlOut=fValue*(g_nDirectionControlCount + 1)/DIRECTION_CONTROL_PERIOD+g_fDirectionControlOutOld; ////////////////////////////////////转向限幅 /* if(g_fDirectionControlOut>-DIR_OUT_MIN&&g_fDirectionControlOut<DIR_OUT_MIN) { g_fDirectionControlOut=0; g_fDirectionControlOutNew=0; } */ if(g_fDirectionControlOut<DIR_OUT_MIN) g_fDirectionControlOut=DIR_OUT_MIN; if(g_fDirectionControlOut>DIR_OUT_MAX) g_fDirectionControlOut=DIR_OUT_MAX; // g_fDirectionControlOut=-150; }