中级会员
- 积分
- 292
- 威望
- 180
- 贡献
- 58
- 兑换币
- 86
- 注册时间
- 2013-1-9
- 在线时间
- 27 小时
|
//方向控制
uint16 ADValue0,ADValue1; // 1 主程序使用的变量定义
float Direction_diff=0.0,Direction_sub=0.0,Direction_add=0.0;
float Direction_sub_value=0.0,Direction_sub_old=0.0;
float DirectionOutold=0.0,DirectionOutnew=0.0;
void DirectionControl(void)
{
Direction_sub=(float)ADValue0-(float)ADValue1;
Direction_add=(float)ADValue0+(float)ADValue1;
Direction_diff=Direction_sub/Direction_add;
Direction_sub_value=Direction_sub-Direction_sub_old;
Direction_sub_old=Direction_sub;
DirectionOutold=DirectionOutnew;
DirectionOutnew=1100+K_Direction_P*Direction_diff+K_Direction_D*Direction_sub_value;
}
大神帮我看看程序哪错了啊,大弯道正向能跑过去反向跑不过去
|
|