智能车制作

标题: 直立 急求 [打印本页]

作者: lcl1993213    时间: 2015-7-12 09:16
标题: 直立 急求
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_SETfDelta - g_fCarSpeed;
fP = fDelta * SPEED_CONTROL_P;
fI = fDelta * SPEED_CONTROL_I;
g_fSpeedControlIntegral += fI;
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;
}
g_nSpeedControlPeriod   是什么意思

SpeedControlOutput(void) 函数有点不理解

能解释一下吗?

谢谢




作者: 执子守候    时间: 2015-7-12 15:15
看不懂单词请用有道!
作者: mrlrh    时间: 2015-12-12 19:27
g_nSpeedControlPeriod应该是一个将偏差量转化为PWM输出的一个系数把?





欢迎光临 智能车制作 (http://111.231.132.190/) Powered by Discuz! X3.2