智能车制作
标题:
清华方案,速度控制的输出一直变小,求大神帮主啊,,吉他手老师求助啊!万分感谢
[打印本页]
作者:
分岔口
时间:
2012-4-11 08:26
标题:
清华方案,速度控制的输出一直变小,求大神帮主啊,,吉他手老师求助啊!万分感谢
void SpeedControl(void) {
float fDelta;
float fP, fI;
g_fCarSpeed = (g_nLeftMotorPulseSigma + g_nRightMotorPulseSigma) / 2;
g_nLeftMotorPulseSigma = g_nRightMotorPulseSigma = 0;
g_fCarSpeed *= CAR_SPEED_CONSTANT;
fDelta = CAR_SPEED_SET;
fDelta -= g_fCarSpeed;
fP = fDelta * SPEED_CONTROL_P;
fI = fDelta * SPEED_CONTROL_I;
g_fSpeedControlIntegral += fI;
if(g_fSpeedControlIntegral > SPEED_CONTROL_OUT_MAX)
g_fSpeedControlIntegral = SPEED_CONTROL_OUT_MAX;
if(g_fSpeedControlIntegral < SPEED_CONTROL_OUT_MIN)
g_fSpeedControlIntegral = SPEED_CONTROL_OUT_MIN;
g_fSpeedControlOutOld = g_fSpeedControlOutNew;
g_fSpeedControlOutNew = fP + g_fSpeedControlIntegral;
}
void SpeedControlOutput(void) {
float fValue;
fValue = g_fSpeedControlOutNew - g_fSpeedControlOutOld;
g_fSpeedControlOut = fValue * (g_nSpeedControlPeriod + 1) / SPEED_CONTROL_PERIOD + g_fSpeedControlOutOld;
}
void GetMotorPulse(void) {
unsigned int nLeftPulse, nRightPulse;
COUNTER1_GetNumEvents(&nLeftPulse);
COUNTER2_GetNumEvents(&nRightPulse);
COUNTER1_Reset();
COUNTER2_Reset();
g_nLeftMotorPulse1 = (int)nLeftPulse;
g_nRightMotorPulse1 = (int)nRightPulse;
if(!(g_nLeftMotorPulse1>0)) g_nLeftMotorPulse1 = -g_nLeftMotorPulse1;
if(!(g_nRightMotorPulse1>0)) g_nRightMotorPulse1 = -g_nRightMotorPulse1;
g_nLeftMotorPulseSigma += g_nLeftMotorPulse1;
g_nRightMotorPulseSigma += g_nRightMotorPulse1;
}
各位大神教教小弟这个的参数应该怎么调!
作者:
逝水千年
时间:
2012-6-13 12:05
兄弟啊!我的也是啊!你怎么解决的啊?是哪里出问题了吗?求赐教……
作者:
逝水千年
时间:
2012-6-13 15:06
求指导,求指导啊……
作者:
1272563348
时间:
2012-6-13 18:40
作者:
逗♂++
时间:
2012-7-11 17:05
COUNTER1_GetNumEvents(&nLeftPulse);
COUNTER2_GetNumEvents(&nRightPulse);
COUNTER1_Reset();
COUNTER2_Reset();这几句是啥意思啊大神,求指教
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2